MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / run_module

Function run_module

_pydevd_bundle/pydevd_runpy.py:231–243  ·  view source on GitHub ↗

Execute a module's code without importing it Returns the resulting top level namespace dictionary

(mod_name, init_globals=None, run_name=None, alter_sys=False)

Source from the content-addressed store, hash-verified

229
230
231def run_module(mod_name, init_globals=None, run_name=None, alter_sys=False):
232 """Execute a module's code without importing it
233
234 Returns the resulting top level namespace dictionary
235 """
236 mod_name, mod_spec, code = _get_module_details(mod_name)
237 if run_name is None:
238 run_name = mod_name
239 if alter_sys:
240 return _run_module_code(code, init_globals, run_name, mod_spec)
241 else:
242 # Leave the sys module alone
243 return _run_code(code, {}, init_globals, run_name, mod_spec)
244
245
246def _get_main_module_details(error=ImportError):

Callers

nothing calls this directly

Calls 3

_get_module_detailsFunction · 0.85
_run_module_codeFunction · 0.85
_run_codeFunction · 0.85

Tested by

no test coverage detected