Python imp.get_importer() Examples
The following are 14
code examples of imp.get_importer().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
imp
, or try the search function
.
Example #1
Source File: runpy.py From meddle with MIT License | 6 votes |
def run_module(mod_name, init_globals=None, run_name=None, alter_sys=False): """Execute a module's code without importing it Returns the resulting top level namespace dictionary """ mod_name, loader, code, fname = _get_module_details(mod_name) if run_name is None: run_name = mod_name pkg_name = mod_name.rpartition('.')[0] if alter_sys: return _run_module_code(code, init_globals, run_name, fname, loader, pkg_name) else: # Leave the sys module alone return _run_code(code, {}, init_globals, run_name, fname, loader, pkg_name) # XXX (ncoghlan): Perhaps expose the C API function # as imp.get_importer instead of reimplementing it in Python?
Example #2
Source File: runpy.py From ironpython2 with Apache License 2.0 | 6 votes |
def run_module(mod_name, init_globals=None, run_name=None, alter_sys=False): """Execute a module's code without importing it Returns the resulting top level namespace dictionary """ mod_name, loader, code, fname = _get_module_details(mod_name) if run_name is None: run_name = mod_name pkg_name = mod_name.rpartition('.')[0] if alter_sys: return _run_module_code(code, init_globals, run_name, fname, loader, pkg_name) else: # Leave the sys module alone return _run_code(code, {}, init_globals, run_name, fname, loader, pkg_name) # XXX (ncoghlan): Perhaps expose the C API function # as imp.get_importer instead of reimplementing it in Python?
Example #3
Source File: runpy.py From BinderFilter with MIT License | 6 votes |
def run_module(mod_name, init_globals=None, run_name=None, alter_sys=False): """Execute a module's code without importing it Returns the resulting top level namespace dictionary """ mod_name, loader, code, fname = _get_module_details(mod_name) if run_name is None: run_name = mod_name pkg_name = mod_name.rpartition('.')[0] if alter_sys: return _run_module_code(code, init_globals, run_name, fname, loader, pkg_name) else: # Leave the sys module alone return _run_code(code, {}, init_globals, run_name, fname, loader, pkg_name) # XXX (ncoghlan): Perhaps expose the C API function # as imp.get_importer instead of reimplementing it in Python?
Example #4
Source File: runpy.py From oss-ftp with MIT License | 6 votes |
def run_module(mod_name, init_globals=None, run_name=None, alter_sys=False): """Execute a module's code without importing it Returns the resulting top level namespace dictionary """ mod_name, loader, code, fname = _get_module_details(mod_name) if run_name is None: run_name = mod_name pkg_name = mod_name.rpartition('.')[0] if alter_sys: return _run_module_code(code, init_globals, run_name, fname, loader, pkg_name) else: # Leave the sys module alone return _run_code(code, {}, init_globals, run_name, fname, loader, pkg_name) # XXX (ncoghlan): Perhaps expose the C API function # as imp.get_importer instead of reimplementing it in Python?
Example #5
Source File: runpy.py From scoop with GNU Lesser General Public License v3.0 | 6 votes |
def run_module(mod_name, init_globals=None, run_name=None, alter_sys=False): """Execute a module's code without importing it Returns the resulting top level namespace dictionary """ mod_name, loader, code, fname = _get_module_details(mod_name) if run_name is None: run_name = mod_name pkg_name = mod_name.rpartition('.')[0] if alter_sys: return _run_module_code(code, init_globals, run_name, fname, loader, pkg_name) else: # Leave the sys module alone return _run_code(code, {}, init_globals, run_name, fname, loader, pkg_name) # XXX (ncoghlan): Perhaps expose the C API function # as imp.get_importer instead of reimplementing it in Python?
Example #6
Source File: runpy.py From Splunking-Crime with GNU Affero General Public License v3.0 | 6 votes |
def run_module(mod_name, init_globals=None, run_name=None, alter_sys=False): """Execute a module's code without importing it Returns the resulting top level namespace dictionary """ mod_name, loader, code, fname = _get_module_details(mod_name) if run_name is None: run_name = mod_name pkg_name = mod_name.rpartition('.')[0] if alter_sys: return _run_module_code(code, init_globals, run_name, fname, loader, pkg_name) else: # Leave the sys module alone return _run_code(code, {}, init_globals, run_name, fname, loader, pkg_name) # XXX (ncoghlan): Perhaps expose the C API function # as imp.get_importer instead of reimplementing it in Python?
Example #7
Source File: runpy.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def run_module(mod_name, init_globals=None, run_name=None, alter_sys=False): """Execute a module's code without importing it Returns the resulting top level namespace dictionary """ mod_name, loader, code, fname = _get_module_details(mod_name) if run_name is None: run_name = mod_name pkg_name = mod_name.rpartition('.')[0] if alter_sys: return _run_module_code(code, init_globals, run_name, fname, loader, pkg_name) else: # Leave the sys module alone return _run_code(code, {}, init_globals, run_name, fname, loader, pkg_name) # XXX (ncoghlan): Perhaps expose the C API function # as imp.get_importer instead of reimplementing it in Python?
Example #8
Source File: runpy.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def run_module(mod_name, init_globals=None, run_name=None, alter_sys=False): """Execute a module's code without importing it Returns the resulting top level namespace dictionary """ mod_name, loader, code, fname = _get_module_details(mod_name) if run_name is None: run_name = mod_name pkg_name = mod_name.rpartition('.')[0] if alter_sys: return _run_module_code(code, init_globals, run_name, fname, loader, pkg_name) else: # Leave the sys module alone return _run_code(code, {}, init_globals, run_name, fname, loader, pkg_name) # XXX (ncoghlan): Perhaps expose the C API function # as imp.get_importer instead of reimplementing it in Python?
Example #9
Source File: runpy.py From RevitBatchProcessor with GNU General Public License v3.0 | 6 votes |
def run_module(mod_name, init_globals=None, run_name=None, alter_sys=False): """Execute a module's code without importing it Returns the resulting top level namespace dictionary """ mod_name, loader, code, fname = _get_module_details(mod_name) if run_name is None: run_name = mod_name pkg_name = mod_name.rpartition('.')[0] if alter_sys: return _run_module_code(code, init_globals, run_name, fname, loader, pkg_name) else: # Leave the sys module alone return _run_code(code, {}, init_globals, run_name, fname, loader, pkg_name) # XXX (ncoghlan): Perhaps expose the C API function # as imp.get_importer instead of reimplementing it in Python?
Example #10
Source File: runpy.py From PokemonGo-DesktopMap with MIT License | 6 votes |
def run_module(mod_name, init_globals=None, run_name=None, alter_sys=False): """Execute a module's code without importing it Returns the resulting top level namespace dictionary """ mod_name, loader, code, fname = _get_module_details(mod_name) if run_name is None: run_name = mod_name pkg_name = mod_name.rpartition('.')[0] if alter_sys: return _run_module_code(code, init_globals, run_name, fname, loader, pkg_name) else: # Leave the sys module alone return _run_code(code, {}, init_globals, run_name, fname, loader, pkg_name) # XXX (ncoghlan): Perhaps expose the C API function # as imp.get_importer instead of reimplementing it in Python?
Example #11
Source File: runpy.py From unity-python with MIT License | 6 votes |
def run_module(mod_name, init_globals=None, run_name=None, alter_sys=False): """Execute a module's code without importing it Returns the resulting top level namespace dictionary """ mod_name, loader, code, fname = _get_module_details(mod_name) if run_name is None: run_name = mod_name pkg_name = mod_name.rpartition('.')[0] if alter_sys: return _run_module_code(code, init_globals, run_name, fname, loader, pkg_name) else: # Leave the sys module alone return _run_code(code, {}, init_globals, run_name, fname, loader, pkg_name) # XXX (ncoghlan): Perhaps expose the C API function # as imp.get_importer instead of reimplementing it in Python?
Example #12
Source File: runpy.py From canape with GNU General Public License v3.0 | 6 votes |
def run_module(mod_name, init_globals=None, run_name=None, alter_sys=False): """Execute a module's code without importing it Returns the resulting top level namespace dictionary """ mod_name, loader, code, fname = _get_module_details(mod_name) if run_name is None: run_name = mod_name pkg_name = mod_name.rpartition('.')[0] if alter_sys: return _run_module_code(code, init_globals, run_name, fname, loader, pkg_name) else: # Leave the sys module alone return _run_code(code, {}, init_globals, run_name, fname, loader, pkg_name) # XXX (ncoghlan): Perhaps expose the C API function # as imp.get_importer instead of reimplementing it in Python?
Example #13
Source File: runpy.py From CTFCrackTools with GNU General Public License v3.0 | 6 votes |
def run_module(mod_name, init_globals=None, run_name=None, alter_sys=False): """Execute a module's code without importing it Returns the resulting top level namespace dictionary """ mod_name, loader, code, fname = _get_module_details(mod_name) if run_name is None: run_name = mod_name pkg_name = mod_name.rpartition('.')[0] if alter_sys: return _run_module_code(code, init_globals, run_name, fname, loader, pkg_name) else: # Leave the sys module alone return _run_code(code, {}, init_globals, run_name, fname, loader, pkg_name) # XXX (ncoghlan): Perhaps expose the C API function # as imp.get_importer instead of reimplementing it in Python?
Example #14
Source File: runpy.py From CTFCrackTools with GNU General Public License v3.0 | 6 votes |
def run_module(mod_name, init_globals=None, run_name=None, alter_sys=False): """Execute a module's code without importing it Returns the resulting top level namespace dictionary """ mod_name, loader, code, fname = _get_module_details(mod_name) if run_name is None: run_name = mod_name pkg_name = mod_name.rpartition('.')[0] if alter_sys: return _run_module_code(code, init_globals, run_name, fname, loader, pkg_name) else: # Leave the sys module alone return _run_code(code, {}, init_globals, run_name, fname, loader, pkg_name) # XXX (ncoghlan): Perhaps expose the C API function # as imp.get_importer instead of reimplementing it in Python?