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


Python Pickler.__init__方法代码示例

本文整理汇总了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)) 
开发者ID:pywren,项目名称:pywren-ibm-cloud,代码行数:20,代码来源:cloudpickle.py

示例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)) 
开发者ID:FederatedAI,项目名称:FATE,代码行数:23,代码来源:cloudpickle.py

示例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)) 
开发者ID:WeBankFinTech,项目名称:eggroll,代码行数:23,代码来源:cloudpickle.py

示例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 = {} 
开发者ID:pywren,项目名称:pywren-ibm-cloud,代码行数:10,代码来源:cloudpickle.py

示例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) 
开发者ID:flennerhag,项目名称:mlens,代码行数:13,代码来源:pool.py

示例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 = {} 
开发者ID:runawayhorse001,项目名称:LearningApacheSpark,代码行数:8,代码来源:cloudpickle.py

示例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 = {} 
开发者ID:bentoml,项目名称:BentoML,代码行数:8,代码来源:cloudpickle.py

示例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 
开发者ID:dagbldr,项目名称:dagbldr,代码行数:14,代码来源:dill.py


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