|
2 | 2 | from .ffi import ffi |
3 | 3 |
|
4 | 4 |
|
5 | | -__all__ = ["Runtime"] |
| 5 | +__all__ = ["get_mono", "get_netfx", "get_coreclr"] |
6 | 6 |
|
7 | 7 |
|
8 | 8 | class ClrFunction: |
@@ -43,29 +43,29 @@ class Runtime: |
43 | 43 | def __init__(self, impl): |
44 | 44 | self._impl = impl |
45 | 45 |
|
46 | | - @classmethod |
47 | | - def get_mono(cls, domain=None): |
48 | | - from .mono import Mono |
| 46 | + def get_assembly(self, path): |
| 47 | + return Assembly(self._impl, path) |
49 | 48 |
|
50 | | - impl = Mono(domain=domain) |
51 | | - return cls(impl) |
| 49 | + def __getitem__(self, path): |
| 50 | + return self.get_assembly(path) |
52 | 51 |
|
53 | | - @classmethod |
54 | | - def get_coreclr(cls, runtime_config, dotnet_root=None): |
55 | | - from .hostfxr import HostFxr |
56 | 52 |
|
57 | | - impl = HostFxr(runtime_config=runtime_config, dotnet_root=dotnet_root) |
58 | | - return cls(impl) |
| 53 | +def get_mono(cls, domain=None): |
| 54 | + from .mono import Mono |
59 | 55 |
|
60 | | - @classmethod |
61 | | - def get_netfx(cls, name=None, config_file=None): |
62 | | - from .netfx import NetFx |
| 56 | + impl = Mono(domain=domain) |
| 57 | + return cls(impl) |
63 | 58 |
|
64 | | - impl = NetFx(name=name, config_file=config_file) |
65 | | - return cls(impl) |
66 | 59 |
|
67 | | - def get_assembly(self, path): |
68 | | - return Assembly(self._impl, path) |
| 60 | +def get_coreclr(cls, runtime_config, dotnet_root=None): |
| 61 | + from .hostfxr import HostFxr |
69 | 62 |
|
70 | | - def __getitem__(self, path): |
71 | | - return self.get_assembly(path) |
| 63 | + impl = HostFxr(runtime_config=runtime_config, dotnet_root=dotnet_root) |
| 64 | + return cls(impl) |
| 65 | + |
| 66 | + |
| 67 | +def get_netfx(cls, name=None, config_file=None): |
| 68 | + from .netfx import NetFx |
| 69 | + |
| 70 | + impl = NetFx(name=name, config_file=config_file) |
| 71 | + return cls(impl) |
0 commit comments