MCPcopy Index your code
hub / github.com/python/cpython / from_module

Method from_module

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

Source from the content-addressed store, hash-verified

210
211 @classmethod
212 def from_module(cls, mod):
213 name = mod.__spec__.name
214 cached = sys.modules.get(name)
215 return cls(
216 id=id(mod),
217 module=mod,
218 ns=types.SimpleNamespace(**mod.__dict__),
219 ns_id=id(mod.__dict__),
220 cached=cached,
221 cached_id=id(cached),
222 )
223
224 SCRIPT = textwrap.dedent('''
225 {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