当前位置: 首页>>代码示例>>Python>>正文


Python ModuleType.__getattribute__方法代码示例

本文整理汇总了Python中types.ModuleType.__getattribute__方法的典型用法代码示例。如果您正苦于以下问题:Python ModuleType.__getattribute__方法的具体用法?Python ModuleType.__getattribute__怎么用?Python ModuleType.__getattribute__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在types.ModuleType的用法示例。


在下文中一共展示了ModuleType.__getattribute__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __getattribute__

# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import __getattribute__ [as 别名]
        def __getattribute__(self, name):
            modname = ModuleType.__getattribute__(self, 'modname')
            logging.info(".......... fetching attr %r of module %r" % (name, modname))

            if name == 'Request':
                return ReplacementRequest
            else:
                return ModuleType.__getattribute__(self, name)
开发者ID:xanalogica,项目名称:tau.metaservices,代码行数:10,代码来源:test_metaservices.py

示例2: __getattr__

# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import __getattribute__ [as 别名]
 def __getattr__(self, name):
     if name in compat_modules:
         if not self.__compat_installed__:
             self.__compat_installed__ = True
             from .__compat__ import install_compat_modules
             install_compat_modules(self)
     return ModuleType.__getattribute__(self, name)
开发者ID:yrik,项目名称:celery,代码行数:9,代码来源:__init__.py

示例3: __getattr__

# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import __getattribute__ [as 别名]
 def __getattr__(self, name):
     if name in object_origins:
         module = __import__(object_origins[name], None, None, [name])
         for extra_name in all_by_module[module.__name__]:
             setattr(self, extra_name, getattr(module, extra_name))
         return getattr(module, name)
     elif name in attribute_modules:
         __import__('{}.{}'.format(PACKAGE_NAME, name))
     return ModuleType.__getattribute__(self, name)
开发者ID:LighthouseUK,项目名称:koalacore,代码行数:11,代码来源:__init__.py

示例4: __getattr__

# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import __getattribute__ [as 别名]
 def __getattr__(self, name):
     if name in OBJECT_ORIGINS:
         sub_module = __import__(OBJECT_ORIGINS[name], None, None, [name])
         for extra_name in ALL_BY_MODULE[sub_module.__name__]:
             setattr(self, extra_name, getattr(sub_module, extra_name))
         return getattr(sub_module, name)
     elif name in ATTRIBUTE_MODULES:
         __import__('spyral.' + name)
     return ModuleType.__getattribute__(self, name)
开发者ID:DarkJediXP,项目名称:Captain_Mathematica,代码行数:11,代码来源:__init__.py

示例5: __getattr__

# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import __getattribute__ [as 别名]
 def __getattr__(self, name):
     if name in object_origins:
         module = __import__(object_origins[name], None, None, [name])
         for extra_name in objects[module.__name__]:
             setattr(self, extra_name, getattr(module, extra_name))
         return getattr(module, name)
     elif name in modules:
         __import__('.'.join((modulename, name)))
     return ModuleType.__getattribute__(self, name)
开发者ID:afajl,项目名称:sy,代码行数:11,代码来源:_internal.py

示例6: __getattr__

# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import __getattribute__ [as 别名]
 def __getattr__(self, name):
     if name in object_origins:
         # 这一步完成动态加载
         module = __import__(object_origins[name], None, None, [name])
         # module中成员比较多 把需要的成员拎出来
         for extra_name in all_by_module[module.__name__]:
             setattr(self, extra_name, getattr(module, extra_name))
         return getattr(module, name)
     elif name in attribute_modules:
         __import__('werkzeug.' + name)
     return ModuleType.__getattribute__(self, name)
开发者ID:xiabofei,项目名称:python_details,代码行数:13,代码来源:module_test.py

示例7: __getattr__

# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import __getattribute__ [as 别名]
 def __getattr__(self, name):
     if name in self._object_origins:
         module = __import__(self._object_origins[name], None, None, [name])
         for item in self._all_by_module[module.__name__]:
             setattr(self, item, getattr(module, item))
         return getattr(module, name)
     elif name in self._direct:  # pragma: no cover
         module = __import__(self._direct[name], None, None, [name])
         setattr(self, name, module)
         return module
     return ModuleType.__getattribute__(self, name)
开发者ID:EdwardBetts,项目名称:celery,代码行数:13,代码来源:five.py

示例8: __getattribute__

# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import __getattribute__ [as 别名]
 def __getattribute__(self, name):
     o = ModuleType.__getattribute__(self, name)
     if callable(o):
         @functools.wraps(o)
         def _localImportWrapper(*a, **kw):
             __builtin__.__import__ = redirectLocalImports
             try:
                 val = o(*a, **kw)
             finally:
                 __builtin__.__import__ = _originalImport
             return val
         return _localImportWrapper
     return o
开发者ID:MostAwesomeDude,项目名称:bravo.plugin,代码行数:15,代码来源:_exocet.py

示例9: __getattr__

# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import __getattribute__ [as 别名]
 def __getattr__(self, name):
     if name == 'NestedAdmin':
         warnings.warn(
             "NestedAdmin has been changed to NestedModelAdmin",
             NestedAdminPendingDeprecationWarning, stacklevel=2)
         name = 'NestedModelAdmin'
     if name in object_origins:
         module = __import__(object_origins[name], None, None, [name])
         for extra_name in all_by_module[module.__name__]:
             setattr(self, extra_name, getattr(module, extra_name))
         return getattr(module, name)
     elif name in attribute_modules:
         __import__('nested_admin.' + name)
     return ModuleType.__getattribute__(self, name)
开发者ID:ArabellaTech,项目名称:django-nested-admin,代码行数:16,代码来源:__init__.py

示例10: __getattr__

# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import __getattribute__ [as 别名]
 def __getattr__(self, name):
     origins = self._object_origins
     if name in origins:
         module = __import__(origins[name], None, None, [name])
         for extra_name in self._all_by_module[module.__name__]:
             setattr(self, extra_name, getattr(module, extra_name))
         return getattr(module, name)
     elif name in self._direct:
         module = __import__(self._direct[name], None, None, [name])
         setattr(self, name, module)
         return module
     elif name in self._compat_modules:
         setattr(self, name, get_compat(self.current_app, self, name))
     return ModuleType.__getattribute__(self, name)
开发者ID:ivirabyan,项目名称:celery,代码行数:16,代码来源:__compat__.py

示例11: __getattr__

# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import __getattribute__ [as 别名]
 def __getattr__(self, key):
     if key in self.__pushed_up:
         owner = self.__pushed_up[key]
         value = getattr(getattr(self, owner), key)
         setattr(self, key, value)
         return value
     elif key in self.__all__:
         module = __import__(
             self.__name__ + '.' + key, None, None, [self.__name__])
         setattr(self, key, module)
         return module
     else:
         try:
             return ModuleType.__getattribute__(self, key)
         except AttributeError:
             raise AttributeError(
                 'module %r has no attribute %r' % (self.__name__, key))
开发者ID:mbr,项目名称:flatland0,代码行数:19,代码来源:deferred.py

示例12: __getattribute__

# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import __getattribute__ [as 别名]
 def __getattribute__(self, name):
     modname = ModuleType.__getattribute__(self, 'modname')
     print ".......... fetching attr %r of module %r" % (name, modname)
     return ModuleType.__getattribute__(self, name)
开发者ID:xanalogica,项目名称:talk-Magic-of-Metaprogramming,代码行数:6,代码来源:import_prehook.py

示例13: __getattr__

# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import __getattribute__ [as 别名]
 def __getattr__(self, attr):
     setattr(self, attr, Mock())
     return ModuleType.__getattribute__(self, attr)
开发者ID:imcom,项目名称:celery,代码行数:5,代码来源:case.py

示例14: __getattr__

# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import __getattribute__ [as 别名]
 def __getattr__(self, name):
     if name in compat_modules:
         from .__compat__ import get_compat
         setattr(self, name, get_compat(self.current_app, self, name))
     return ModuleType.__getattribute__(self, name)
开发者ID:avinash011,项目名称:celery,代码行数:7,代码来源:__init__.py

示例15: __repr__

# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import __getattribute__ [as 别名]
 def __repr__(self):
     return "<lazy module %r>" % (ModuleType.__getattribute__(self, "__name__"),)
开发者ID:pombreda,项目名称:nimp,代码行数:4,代码来源:lazy2.py


注:本文中的types.ModuleType.__getattribute__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。