本文整理匯總了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