Python imp 模块,is_builtin() 实例源码

我们从Python开源项目中,提取了以下26个代码示例,用于说明如何使用imp.is_builtin()

项目:mitogen    作者:dw    | 项目源码 | 文件源码
def is_stdlib_name(self, modname):
        """Return ``True`` if `modname` appears to come from the standard
        library."""
        if imp.is_builtin(modname) != 0:
            return True

        module = sys.modules.get(modname)
        if module is None:
            return False

        # six installs crap with no __file__
        modpath = getattr(module, '__file__', '')
        if 'site-packages' in modpath:
            return False

        for dirname in self.STDLIB_DIRS:
            if os.path.commonprefix((dirname, modpath)) == dirname:
                return True

        return False
项目:kinect-2-libras    作者:inessadl    | 项目源码 | 文件源码
def find_builtin_module(self, name):
        # XXX frozen packages?
        if imp.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if imp.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None
项目:kinect-2-libras    作者:inessadl    | 项目源码 | 文件源码
def is_builtin(self, name): return imp.is_builtin(name)
项目:kinect-2-libras    作者:inessadl    | 项目源码 | 文件源码
def find_builtin_module(self, name):
        # XXX frozen packages?
        if self.hooks.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if self.hooks.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def find_builtin_module(self, name):
        # XXX frozen packages?
        if imp.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if imp.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def is_builtin(self, name): return imp.is_builtin(name)
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def find_builtin_module(self, name):
        # XXX frozen packages?
        if self.hooks.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if self.hooks.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def find_builtin_module(self, name):
        # XXX frozen packages?
        if imp.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if imp.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def is_builtin(self, name): return imp.is_builtin(name)
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def find_builtin_module(self, name):
        # XXX frozen packages?
        if self.hooks.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if self.hooks.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def find_builtin_module(self, name):
        # XXX frozen packages?
        if imp.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if imp.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def is_builtin(self, name): return imp.is_builtin(name)
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def find_builtin_module(self, name):
        # XXX frozen packages?
        if self.hooks.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if self.hooks.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def find_builtin_module(self, name):
        # XXX frozen packages?
        if imp.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if imp.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def is_builtin(self, name): return imp.is_builtin(name)
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def find_builtin_module(self, name):
        # XXX frozen packages?
        if self.hooks.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if self.hooks.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
def find_builtin_module(self, name):
        # XXX frozen packages?
        if imp.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if imp.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
def is_builtin(self, name): return imp.is_builtin(name)
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
def find_builtin_module(self, name):
        # XXX frozen packages?
        if self.hooks.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if self.hooks.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def find_builtin_module(self, name):
        # XXX frozen packages?
        if imp.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if imp.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def is_builtin(self, name): return imp.is_builtin(name)
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def find_builtin_module(self, name):
        # XXX frozen packages?
        if self.hooks.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if self.hooks.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None
项目:empyrion-python-api    作者:huhlig    | 项目源码 | 文件源码
def find_builtin_module(self, name):
        # XXX frozen packages?
        if imp.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if imp.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None
项目:empyrion-python-api    作者:huhlig    | 项目源码 | 文件源码
def is_builtin(self, name): return imp.is_builtin(name)
项目:empyrion-python-api    作者:huhlig    | 项目源码 | 文件源码
def find_builtin_module(self, name):
        # XXX frozen packages?
        if self.hooks.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if self.hooks.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None
项目:chopsticks    作者:lordmauve    | 项目源码 | 文件源码
def get(self, fullname):
        if isinstance(fullname, str) and is_builtin(fullname) != 0:
            raise ImportError()
        imp = self._raw_get(fullname)
        if not imp.exists:
            raise ImportError()
        return imp