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


Python Unpickler.find_class方法代码示例

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


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

示例1: find_class

# 需要导入模块: from pickle import Unpickler [as 别名]
# 或者: from pickle.Unpickler import find_class [as 别名]
 def find_class(self, module, name):
     ok = False
     for wm in _DjangoQueryUnpickler.white_modules:
         if module.startswith(wm):
             ok = True
             break
     if "%s.%s"%(module, name) in _DjangoQueryUnpickler.white_objects:
         ok = True
     if not ok:
         raise UnpicklingError("Unsafe class to unpickle %s.%s"%(module, name))
     return Unpickler.find_class(self, module, name)
开发者ID:EBNull,项目名称:django_qspickle,代码行数:13,代码来源:__init__.py

示例2: find_class

# 需要导入模块: from pickle import Unpickler [as 别名]
# 或者: from pickle.Unpickler import find_class [as 别名]
	def find_class(self, module, name):
		"""
		Helps Unpickler to find certain Numpy modules.
		"""

		try:
			numpy_version = StrictVersion(numpy.__version__)

			if numpy_version >= '1.5.0':
				if module == 'numpy.core.defmatrix':
					module = 'numpy.matrixlib.defmatrix'

		except ValueError:
			pass

		return Unpickler.find_class(self, module, name)
开发者ID:xuanhan863,项目名称:c2s,代码行数:18,代码来源:experiment.py

示例3: find_class

# 需要导入模块: from pickle import Unpickler [as 别名]
# 或者: from pickle.Unpickler import find_class [as 别名]
    def find_class(self, module, name):
        "Backwards-compatibility for changes in module paths"
        if module.startswith('eelbrain.'):
            if module == 'eelbrain.vessels.data':
                module = 'eelbrain._data_obj'
                class_names = {'var': 'Var', 'factor': 'Factor', 'ndvar': 'NDVar',
                               'datalist': 'Datalist', 'dataset': 'Dataset'}
                name = class_names[name]
            elif module.startswith('eelbrain.data.'):
                if module.startswith('eelbrain.data.load'):
                    module = module.replace('.data.load', '.load')
                elif module.startswith('eelbrain.data.stats'):
                    module = module.replace('.data.stats', '._stats')
                elif module.startswith('eelbrain.data.data_obj'):
                    module = module.replace('.data.data_obj', '._data_obj')
                else:
                    raise NotImplementedError("%r / %r" % (module, name))

        return Unpickler.find_class(self, module, name)
开发者ID:christianbrodbeck,项目名称:Eelbrain,代码行数:21,代码来源:pickle.py

示例4: find_class

# 需要导入模块: from pickle import Unpickler [as 别名]
# 或者: from pickle.Unpickler import find_class [as 别名]
 def find_class(self, module, name):
     try:
         return Unpickler.find_class(self, module, name)
     except (ImportError, AttributeError):
         return dummy
开发者ID:kriskielce88,项目名称:xn--ls8h,代码行数:7,代码来源:libraries.py

示例5: find_class

# 需要导入模块: from pickle import Unpickler [as 别名]
# 或者: from pickle.Unpickler import find_class [as 别名]
 def find_class(self, module, name):
     return Unpickler.find_class(self, module_subst.get(module, module), name)
开发者ID:Web5design,项目名称:twittermap,代码行数:4,代码来源:local_unpickle.py

示例6: find_class

# 需要导入模块: from pickle import Unpickler [as 别名]
# 或者: from pickle.Unpickler import find_class [as 别名]
 def find_class(self, module, name):
     if (module, name) == ('__builtin__', '__main__'):
         return self._main_module.__dict__
     return Unpickler.find_class(self, module, name)
开发者ID:alon,项目名称:burst,代码行数:6,代码来源:pshell.py

示例7: find_class

# 需要导入模块: from pickle import Unpickler [as 别名]
# 或者: from pickle.Unpickler import find_class [as 别名]
	def find_class(self,module,name):
		if module == "datetime":
			return Unpickler.find_class(self,module,name)
		return DummyClass(module,name)
开发者ID:smurfix,项目名称:pybble,代码行数:6,代码来源:cache.py

示例8: find_class

# 需要导入模块: from pickle import Unpickler [as 别名]
# 或者: from pickle.Unpickler import find_class [as 别名]
 def find_class(self, module, name):
     if (module, name) == ('__builtin__', '__main__'):
         return self._main_module.__dict__ #XXX: above set w/save_module_dict
     return StockUnpickler.find_class(self, module, name)
开发者ID:wraith1995,项目名称:PyBot,代码行数:6,代码来源:dill.py


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