Skip to content

Commit ce982e4

Browse files
committed
Move runtime getter functions to top-level
1 parent f4c59c0 commit ce982e4

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

clr_loader/__init__.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from .ffi import ffi
33

44

5-
__all__ = ["Runtime"]
5+
__all__ = ["get_mono", "get_netfx", "get_coreclr"]
66

77

88
class ClrFunction:
@@ -43,29 +43,29 @@ class Runtime:
4343
def __init__(self, impl):
4444
self._impl = impl
4545

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)
4948

50-
impl = Mono(domain=domain)
51-
return cls(impl)
49+
def __getitem__(self, path):
50+
return self.get_assembly(path)
5251

53-
@classmethod
54-
def get_coreclr(cls, runtime_config, dotnet_root=None):
55-
from .hostfxr import HostFxr
5652

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
5955

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)
6358

64-
impl = NetFx(name=name, config_file=config_file)
65-
return cls(impl)
6659

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
6962

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

Comments
 (0)