當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。