本文整理汇总了Python中pickle.Pickler.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Pickler.__init__方法的具体用法?Python Pickler.__init__怎么用?Python Pickler.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pickle.Pickler
的用法示例。
在下文中一共展示了Pickler.__init__方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save_attrgetter
# 需要导入模块: from pickle import Pickler [as 别名]
# 或者: from pickle.Pickler import __init__ [as 别名]
def save_attrgetter(self, obj):
"""attrgetter serializer"""
class Dummy(object):
def __init__(self, attrs, index=None):
self.attrs = attrs
self.index = index
def __getattribute__(self, item):
attrs = object.__getattribute__(self, "attrs")
index = object.__getattribute__(self, "index")
if index is None:
index = len(attrs)
attrs.append(item)
else:
attrs[index] = ".".join([attrs[index], item])
return type(self)(attrs, index)
attrs = []
obj(Dummy(attrs))
return self.save_reduce(operator.attrgetter, tuple(attrs))
示例2: save_attrgetter
# 需要导入模块: from pickle import Pickler [as 别名]
# 或者: from pickle.Pickler import __init__ [as 别名]
def save_attrgetter(self, obj):
"""attrgetter serializer"""
class Dummy(object):
def __init__(self, attrs, index=None):
self.attrs = attrs
self.index = index
def __getattribute__(self, item):
attrs = object.__getattribute__(self, "attrs")
index = object.__getattribute__(self, "index")
if index is None:
index = len(attrs)
attrs.append(item)
else:
attrs[index] = ".".join([attrs[index], item])
return type(self)(attrs, index)
attrs = []
obj(Dummy(attrs))
return self.save_reduce(operator.attrgetter, tuple(attrs))
示例3: save_attrgetter
# 需要导入模块: from pickle import Pickler [as 别名]
# 或者: from pickle.Pickler import __init__ [as 别名]
def save_attrgetter(self, obj):
"""attrgetter serializer"""
class Dummy(object):
def __init__(self, attrs, index=None):
self.attrs = attrs
self.index = index
def __getattribute__(self, item):
attrs = object.__getattribute__(self, "attrs")
index = object.__getattribute__(self, "index")
if index is None:
index = len(attrs)
attrs.append(item)
else:
attrs[index] = ".".join([attrs[index], item])
return type(self)(attrs, index)
attrs = []
obj(Dummy(attrs))
return self.save_reduce(operator.attrgetter, tuple(attrs))
示例4: __init__
# 需要导入模块: from pickle import Pickler [as 别名]
# 或者: from pickle.Pickler import __init__ [as 别名]
def __init__(self, file, protocol=None):
if protocol is None:
protocol = DEFAULT_PROTOCOL
Pickler.__init__(self, file, protocol=protocol)
# set of modules to unpickle
self.modules = set()
# map ids to dictionary. used to ensure that functions can share global env
self.globals_ref = {}
示例5: __init__
# 需要导入模块: from pickle import Pickler [as 别名]
# 或者: from pickle.Pickler import __init__ [as 别名]
def __init__(self, max_nbytes, temp_folder, mmap_mode, verbose=0,
context_id=None, prewarm=True):
self._max_nbytes = max_nbytes
self._temp_folder = temp_folder
self._mmap_mode = mmap_mode
self.verbose = int(verbose)
self._prewarm = prewarm
if context_id is not None:
warnings.warn('context_id is deprecated and ignored in joblib'
' 0.9.4 and will be removed in 0.11',
DeprecationWarning)
示例6: __init__
# 需要导入模块: from pickle import Pickler [as 别名]
# 或者: from pickle.Pickler import __init__ [as 别名]
def __init__(self, file, protocol=None):
Pickler.__init__(self, file, protocol)
# set of modules to unpickle
self.modules = set()
# map ids to dictionary. used to ensure that functions can share global env
self.globals_ref = {}
示例7: __init__
# 需要导入模块: from pickle import Pickler [as 别名]
# 或者: from pickle.Pickler import __init__ [as 别名]
def __init__(self, file, protocol=None):
if protocol is None:
protocol = DEFAULT_PROTOCOL
Pickler.__init__(self, file, protocol=protocol)
# map ids to dictionary. used to ensure that functions can share global env
self.globals_ref = {}
示例8: __init__
# 需要导入模块: from pickle import Pickler [as 别名]
# 或者: from pickle.Pickler import __init__ [as 别名]
def __init__(self, *args, **kwds):
_byref = kwds.pop('byref', Pickler._byref)
#_strictio = kwds.pop('strictio', Pickler._strictio)
_fmode = kwds.pop('fmode', Pickler._fmode)
_recurse = kwds.pop('recurse', Pickler._recurse)
StockPickler.__init__(self, *args, **kwds)
self._main = _main_module
self._diff_cache = {}
self._byref = _byref
#self._strictio = _strictio
self._fmode = _fmode
self._recurse = _recurse