Esempio n. 1
0
    def __init__(self, file, protocol=None):
        Pickler.__init__(self, file, protocol)
        self.lazywrites = deque()
        self.realwrite = file.write

        # Pickler.__init__ overwrites self.write, we do not want that
        del self.write
Esempio n. 2
0
 def __init__(self, writer, reducers=None, protocol=HIGHEST_PROTOCOL):
     _Pickler.__init__(self, writer, protocol=protocol)
     # Make the dispatch registry an instance level attribute instead of a
     # reference to the class dictionary
     self.dispatch = _Pickler.dispatch.copy()
     for type, reduce_func in reducers.items():
         self.register(type, reduce_func)
Esempio n. 3
0
    def __init__(self, protocol):
        # You may want to replace this with a fake file object that just
        # discards writes.
        blackhole = open(os.devnull, 'w')

        Pickler.__init__(self, blackhole, protocol)
        self.depth = 0
Esempio n. 4
0
 def __init__(self, writer, reducers=None, protocol=HIGHEST_PROTOCOL):
     _Pickler.__init__(self, writer, protocol=protocol)
     # Make the dispatch registry an instance level attribute instead of a
     # reference to the class dictionary
     self.dispatch = _Pickler.dispatch.copy()
     for type, reduce_func in reducers.items():
         self.register(type, reduce_func)
Esempio n. 5
0
 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 = {}
Esempio n. 6
0
 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 = {}
Esempio n. 7
0
 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 = {}
Esempio n. 8
0
 def __init__(self, writer, reducers=None, protocol=HIGHEST_PROTOCOL):
     Pickler.__init__(self, writer, protocol=protocol)
     if reducers is None:
         reducers = {}
     if hasattr(Pickler, 'dispatch'):
         # Make the dispatch registry an instance level attribute instead of
         # a reference to the class dictionary under Python 2
         self.dispatch = Pickler.dispatch.copy()
     else:
         # Under Python 3 initialize the dispatch table with a copy of the
         # default registry
         self.dispatch_table = copyreg.dispatch_table.copy()
     for type, reduce_func in reducers.items():
         self.register(type, reduce_func)
Esempio n. 9
0
 def __init__(self, writer, reducers=None, protocol=HIGHEST_PROTOCOL):
     Pickler.__init__(self, writer, protocol=protocol)
     if reducers is None:
         reducers = {}
     if hasattr(Pickler, 'dispatch'):
         # Make the dispatch registry an instance level attribute instead of
         # a reference to the class dictionary under Python 2
         self.dispatch = Pickler.dispatch.copy()
     else:
         # Under Python 3 initialize the dispatch table with a copy of the
         # default registry
         self.dispatch_table = copyreg.dispatch_table.copy()
     for type, reduce_func in reducers.items():
         self.register(type, reduce_func)
Esempio n. 10
0
 def __init__(self, *args, **kargs):
     Pickler.__init__(self, *args, **kargs)
     self.stack = []
Esempio n. 11
0
 def __init__(self, writer, protocol=HIGHEST_PROTOCOL):
     Pickler.__init__(self, writer, protocol=protocol)
Esempio n. 12
0
 def __init__(self, file, protocol, bin=None):
     Pickler.__init__(self, file, protocol)
     self.bin = bin
Esempio n. 13
0
 def __init__(self, file, protocol, uneven):
     Pickler.__init__(self, file, protocol)
     self.uneven = uneven
 def __init__(self, file, protocol, bin=None):
     Pickler.__init__(self, file, protocol)
     self.bin = bin
Esempio n. 15
0
 def __init__(self, file, protocol, uneven):
     Pickler.__init__(self, file, protocol)
     self.uneven = uneven
Esempio n. 16
0
 def __init__(self, *args, **kwargs):
     Pickler.__init__(self, *args, **kwargs)
     self.dispatch_table = dispatch_table.copy()
     self.dispatch_table.update(self._extra_reducers)
Esempio n. 17
0
 def __init__(self, *args, **kwargs):
     Pickler.__init__(self, *args, **kwargs)
     self.dispatch_table = dispatch_table.copy()
     self.dispatch_table.update(self._extra_reducers)
Esempio n. 18
0
 def __init__(self, *args, **kargs):
     Pickler.__init__(self, *args, **kargs)
     self.stack = []