MCPcopy Index your code
hub / github.com/RustPython/RustPython / from_module

Method from_module

Lib/test/test_import/__init__.py:207–217  ·  view source on GitHub ↗
(cls, mod)

Source from the content-addressed store, hash-verified

205
206 @classmethod
207 def from_module(cls, mod):
208 name = mod.__spec__.name
209 cached = sys.modules.get(name)
210 return cls(
211 id=id(mod),
212 module=mod,
213 ns=types.SimpleNamespace(**mod.__dict__),
214 ns_id=id(mod.__dict__),
215 cached=cached,
216 cached_id=id(cached),
217 )
218
219 SCRIPT = textwrap.dedent('''
220 {imports}

Callers 3

from_moduleMethod · 0.45
loadMethod · 0.45
re_loadMethod · 0.45

Calls 3

idFunction · 0.85
clsClass · 0.50
getMethod · 0.45

Tested by

no test coverage detected