Python imp.init_builtin() Examples
The following are 30
code examples of imp.init_builtin().
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: ihooks.py From meddle with MIT License | 6 votes |
def load_module(self, name, stuff): file, filename, info = stuff (suff, mode, type) = info try: if type == BUILTIN_MODULE: return self.hooks.init_builtin(name) if type == FROZEN_MODULE: return self.hooks.init_frozen(name) if type == C_EXTENSION: m = self.hooks.load_dynamic(name, filename, file) elif type == PY_SOURCE: m = self.hooks.load_source(name, filename, file) elif type == PY_COMPILED: m = self.hooks.load_compiled(name, filename, file) elif type == PKG_DIRECTORY: m = self.hooks.load_package(name, filename, file) else: raise ImportError, "Unrecognized module type (%r) for %s" % \ (type, name) finally: if file: file.close() m.__file__ = filename return m
Example #2
Source File: ihooks.py From CTFCrackTools with GNU General Public License v3.0 | 6 votes |
def load_module(self, name, stuff): file, filename, info = stuff (suff, mode, type) = info try: if type == BUILTIN_MODULE: return self.hooks.init_builtin(name) if type == FROZEN_MODULE: return self.hooks.init_frozen(name) if type == C_EXTENSION: m = self.hooks.load_dynamic(name, filename, file) elif type == PY_SOURCE: m = self.hooks.load_source(name, filename, file) elif type == PY_COMPILED: m = self.hooks.load_compiled(name, filename, file) elif type == PKG_DIRECTORY: m = self.hooks.load_package(name, filename, file) else: raise ImportError, "Unrecognized module type (%r) for %s" % \ (type, name) finally: if file: file.close() m.__file__ = filename return m
Example #3
Source File: ihooks.py From CTFCrackTools with GNU General Public License v3.0 | 6 votes |
def load_module(self, name, stuff): file, filename, info = stuff (suff, mode, type) = info try: if type == BUILTIN_MODULE: return self.hooks.init_builtin(name) if type == FROZEN_MODULE: return self.hooks.init_frozen(name) if type == C_EXTENSION: m = self.hooks.load_dynamic(name, filename, file) elif type == PY_SOURCE: m = self.hooks.load_source(name, filename, file) elif type == PY_COMPILED: m = self.hooks.load_compiled(name, filename, file) elif type == PKG_DIRECTORY: m = self.hooks.load_package(name, filename, file) else: raise ImportError, "Unrecognized module type (%r) for %s" % \ (type, name) finally: if file: file.close() m.__file__ = filename return m
Example #4
Source File: ihooks.py From canape with GNU General Public License v3.0 | 6 votes |
def load_module(self, name, stuff): file, filename, info = stuff (suff, mode, type) = info try: if type == BUILTIN_MODULE: return self.hooks.init_builtin(name) if type == FROZEN_MODULE: return self.hooks.init_frozen(name) if type == C_EXTENSION: m = self.hooks.load_dynamic(name, filename, file) elif type == PY_SOURCE: m = self.hooks.load_source(name, filename, file) elif type == PY_COMPILED: m = self.hooks.load_compiled(name, filename, file) elif type == PKG_DIRECTORY: m = self.hooks.load_package(name, filename, file) else: raise ImportError, "Unrecognized module type (%r) for %s" % \ (type, name) finally: if file: file.close() m.__file__ = filename return m
Example #5
Source File: ihooks.py From unity-python with MIT License | 6 votes |
def load_module(self, name, stuff): file, filename, info = stuff (suff, mode, type) = info try: if type == BUILTIN_MODULE: return self.hooks.init_builtin(name) if type == FROZEN_MODULE: return self.hooks.init_frozen(name) if type == C_EXTENSION: m = self.hooks.load_dynamic(name, filename, file) elif type == PY_SOURCE: m = self.hooks.load_source(name, filename, file) elif type == PY_COMPILED: m = self.hooks.load_compiled(name, filename, file) elif type == PKG_DIRECTORY: m = self.hooks.load_package(name, filename, file) else: raise ImportError, "Unrecognized module type (%r) for %s" % \ (type, name) finally: if file: file.close() m.__file__ = filename return m
Example #6
Source File: ihooks.py From PokemonGo-DesktopMap with MIT License | 6 votes |
def load_module(self, name, stuff): file, filename, info = stuff (suff, mode, type) = info try: if type == BUILTIN_MODULE: return self.hooks.init_builtin(name) if type == FROZEN_MODULE: return self.hooks.init_frozen(name) if type == C_EXTENSION: m = self.hooks.load_dynamic(name, filename, file) elif type == PY_SOURCE: m = self.hooks.load_source(name, filename, file) elif type == PY_COMPILED: m = self.hooks.load_compiled(name, filename, file) elif type == PKG_DIRECTORY: m = self.hooks.load_package(name, filename, file) else: raise ImportError, "Unrecognized module type (%r) for %s" % \ (type, name) finally: if file: file.close() m.__file__ = filename return m
Example #7
Source File: ihooks.py From RevitBatchProcessor with GNU General Public License v3.0 | 6 votes |
def load_module(self, name, stuff): file, filename, info = stuff (suff, mode, type) = info try: if type == BUILTIN_MODULE: return self.hooks.init_builtin(name) if type == FROZEN_MODULE: return self.hooks.init_frozen(name) if type == C_EXTENSION: m = self.hooks.load_dynamic(name, filename, file) elif type == PY_SOURCE: m = self.hooks.load_source(name, filename, file) elif type == PY_COMPILED: m = self.hooks.load_compiled(name, filename, file) elif type == PKG_DIRECTORY: m = self.hooks.load_package(name, filename, file) else: raise ImportError, "Unrecognized module type (%r) for %s" % \ (type, name) finally: if file: file.close() m.__file__ = filename return m
Example #8
Source File: ihooks.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def load_module(self, name, stuff): file, filename, info = stuff (suff, mode, type) = info try: if type == BUILTIN_MODULE: return self.hooks.init_builtin(name) if type == FROZEN_MODULE: return self.hooks.init_frozen(name) if type == C_EXTENSION: m = self.hooks.load_dynamic(name, filename, file) elif type == PY_SOURCE: m = self.hooks.load_source(name, filename, file) elif type == PY_COMPILED: m = self.hooks.load_compiled(name, filename, file) elif type == PKG_DIRECTORY: m = self.hooks.load_package(name, filename, file) else: raise ImportError, "Unrecognized module type (%r) for %s" % \ (type, name) finally: if file: file.close() m.__file__ = filename return m
Example #9
Source File: ihooks.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def load_module(self, name, stuff): file, filename, info = stuff (suff, mode, type) = info try: if type == BUILTIN_MODULE: return self.hooks.init_builtin(name) if type == FROZEN_MODULE: return self.hooks.init_frozen(name) if type == C_EXTENSION: m = self.hooks.load_dynamic(name, filename, file) elif type == PY_SOURCE: m = self.hooks.load_source(name, filename, file) elif type == PY_COMPILED: m = self.hooks.load_compiled(name, filename, file) elif type == PKG_DIRECTORY: m = self.hooks.load_package(name, filename, file) else: raise ImportError, "Unrecognized module type (%r) for %s" % \ (type, name) finally: if file: file.close() m.__file__ = filename return m
Example #10
Source File: ihooks.py From medicare-demo with Apache License 2.0 | 6 votes |
def load_module(self, name, stuff): file, filename, info = stuff (suff, mode, type) = info try: if type == BUILTIN_MODULE: return self.hooks.init_builtin(name) if type == FROZEN_MODULE: return self.hooks.init_frozen(name) if type == C_EXTENSION: m = self.hooks.load_dynamic(name, filename, file) elif type == PY_SOURCE: m = self.hooks.load_source(name, filename, file) elif type == PY_COMPILED: m = self.hooks.load_compiled(name, filename, file) elif type == PKG_DIRECTORY: m = self.hooks.load_package(name, filename, file) else: raise ImportError, "Unrecognized module type (%r) for %s" % \ (type, name) finally: if file: file.close() m.__file__ = filename return m
Example #11
Source File: ihooks.py From Splunking-Crime with GNU Affero General Public License v3.0 | 6 votes |
def load_module(self, name, stuff): file, filename, info = stuff (suff, mode, type) = info try: if type == BUILTIN_MODULE: return self.hooks.init_builtin(name) if type == FROZEN_MODULE: return self.hooks.init_frozen(name) if type == C_EXTENSION: m = self.hooks.load_dynamic(name, filename, file) elif type == PY_SOURCE: m = self.hooks.load_source(name, filename, file) elif type == PY_COMPILED: m = self.hooks.load_compiled(name, filename, file) elif type == PKG_DIRECTORY: m = self.hooks.load_package(name, filename, file) else: raise ImportError, "Unrecognized module type (%r) for %s" % \ (type, name) finally: if file: file.close() m.__file__ = filename return m
Example #12
Source File: ihooks.py From oss-ftp with MIT License | 6 votes |
def load_module(self, name, stuff): file, filename, info = stuff (suff, mode, type) = info try: if type == BUILTIN_MODULE: return self.hooks.init_builtin(name) if type == FROZEN_MODULE: return self.hooks.init_frozen(name) if type == C_EXTENSION: m = self.hooks.load_dynamic(name, filename, file) elif type == PY_SOURCE: m = self.hooks.load_source(name, filename, file) elif type == PY_COMPILED: m = self.hooks.load_compiled(name, filename, file) elif type == PKG_DIRECTORY: m = self.hooks.load_package(name, filename, file) else: raise ImportError, "Unrecognized module type (%r) for %s" % \ (type, name) finally: if file: file.close() m.__file__ = filename return m
Example #13
Source File: ihooks.py From BinderFilter with MIT License | 6 votes |
def load_module(self, name, stuff): file, filename, info = stuff (suff, mode, type) = info try: if type == BUILTIN_MODULE: return self.hooks.init_builtin(name) if type == FROZEN_MODULE: return self.hooks.init_frozen(name) if type == C_EXTENSION: m = self.hooks.load_dynamic(name, filename, file) elif type == PY_SOURCE: m = self.hooks.load_source(name, filename, file) elif type == PY_COMPILED: m = self.hooks.load_compiled(name, filename, file) elif type == PKG_DIRECTORY: m = self.hooks.load_package(name, filename, file) else: raise ImportError, "Unrecognized module type (%r) for %s" % \ (type, name) finally: if file: file.close() m.__file__ = filename return m
Example #14
Source File: ihooks.py From BinderFilter with MIT License | 5 votes |
def init_builtin(self, name): return imp.init_builtin(name)
Example #15
Source File: ihooks.py From meddle with MIT License | 5 votes |
def init_builtin(self, name): return imp.init_builtin(name)
Example #16
Source File: ihooks.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def init_builtin(self, name): return imp.init_builtin(name)
Example #17
Source File: ihooks.py From ironpython2 with Apache License 2.0 | 5 votes |
def init_builtin(self, name): return imp.init_builtin(name)
Example #18
Source File: ihooks.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def init_builtin(self, name): return imp.init_builtin(name)
Example #19
Source File: ihooks.py From ironpython2 with Apache License 2.0 | 5 votes |
def load_module(self, name, stuff): file, filename, info = stuff (suff, mode, type) = info try: if type == BUILTIN_MODULE: return self.hooks.init_builtin(name) if type == FROZEN_MODULE: return self.hooks.init_frozen(name) if type == C_EXTENSION: m = self.hooks.load_dynamic(name, filename, file) elif type == PY_SOURCE: m = self.hooks.load_source(name, filename, file) elif type == PY_COMPILED: m = self.hooks.load_compiled(name, filename, file) elif type == PKG_DIRECTORY: m = self.hooks.load_package(name, filename, file) else: raise ImportError, "Unrecognized module type (%r) for %s" % \ (type, name) finally: if file: file.close() m.__file__ = filename return m
Example #20
Source File: ihooks.py From canape with GNU General Public License v3.0 | 5 votes |
def init_builtin(self, name): return imp.init_builtin(name)
Example #21
Source File: test_imp.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_is_builtin(self): self.assertEqual(imp.is_builtin("xxx"),0) self.assertEqual(imp.is_builtin("12324"),0) self.assertEqual(imp.is_builtin("&*^^"),0) self.assertEqual(imp.is_builtin("dir"),0) self.assertEqual(imp.is_builtin("__doc__"),0) self.assertEqual(imp.is_builtin("__name__"),0) self.assertEqual(imp.is_builtin("_locle"),0) self.assertEqual(imp.is_builtin("cPickle"),1) self.assertEqual(imp.is_builtin("_random"),1) if is_posix: self.assertEqual(imp.is_builtin("posix"),1) else: self.assertEqual(imp.is_builtin("nt"),1) self.assertEqual(imp.is_builtin("thread"),1) # there are a several differences between ironpython and cpython if is_cli: self.assertEqual(imp.is_builtin("copy_reg"),1) else: self.assertEqual(imp.is_builtin("copy_reg"),0) # supposedly you can't re-init these self.assertEqual(imp.is_builtin("sys"), -1) self.assertEqual(imp.is_builtin("__builtin__"), -1) self.assertEqual(imp.is_builtin("exceptions"), -1) imp.init_builtin("sys") imp.init_builtin("__builtin__") imp.init_builtin("exceptions")
Example #22
Source File: ihooks.py From unity-python with MIT License | 5 votes |
def init_builtin(self, name): return imp.init_builtin(name)
Example #23
Source File: test_imp.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_init_builtin(self): r = imp.init_builtin("c_Pickle") self.assertEqual(r,None) r = imp.init_builtin("2345") self.assertEqual(r,None) r = imp.init_builtin("xxxx") self.assertEqual(r,None) r = imp.init_builtin("^$%$#@") self.assertEqual(r,None) r = imp.init_builtin("_locale") self.assertTrue(r!=None)
Example #24
Source File: ihooks.py From PokemonGo-DesktopMap with MIT License | 5 votes |
def init_builtin(self, name): return imp.init_builtin(name)
Example #25
Source File: test_imp.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_init_builtin(self): r = imp.init_builtin("c_Pickle") self.assertEqual(r,None) r = imp.init_builtin("2345") self.assertEqual(r,None) r = imp.init_builtin("xxxx") self.assertEqual(r,None) r = imp.init_builtin("^$%$#@") self.assertEqual(r,None) r = imp.init_builtin("_locale") self.assertTrue(r!=None)
Example #26
Source File: ihooks.py From RevitBatchProcessor with GNU General Public License v3.0 | 5 votes |
def init_builtin(self, name): return imp.init_builtin(name)
Example #27
Source File: ihooks.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def init_builtin(self, name): return imp.init_builtin(name)
Example #28
Source File: ihooks.py From oss-ftp with MIT License | 5 votes |
def init_builtin(self, name): return imp.init_builtin(name)
Example #29
Source File: ihooks.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def init_builtin(self, name): return imp.init_builtin(name)
Example #30
Source File: iu.py From ConTroll_Remote_Access_Trojan with Apache License 2.0 | 5 votes |
def getmod(self, nm, isbuiltin=imp.is_builtin): # Return initialized built-in module object or None # if there is no built-in module with that name. return imp.init_builtin(nm)