Exemple #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
Exemple #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)
    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
Exemple #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)
Exemple #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 = {}
Exemple #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 = {}
 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 = {}
Exemple #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)
Exemple #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)
Exemple #10
0
 def __init__(self, *args, **kargs):
     Pickler.__init__(self, *args, **kargs)
     self.stack = []
Exemple #11
0
 def __init__(self, writer, protocol=HIGHEST_PROTOCOL):
     Pickler.__init__(self, writer, protocol=protocol)
Exemple #12
0
 def __init__(self, file, protocol, bin=None):
     Pickler.__init__(self, file, protocol)
     self.bin = bin
Exemple #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
Exemple #15
0
 def __init__(self, file, protocol, uneven):
     Pickler.__init__(self, file, protocol)
     self.uneven = uneven
Exemple #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)
Exemple #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)
Exemple #18
0
 def __init__(self, *args, **kargs):
     Pickler.__init__(self, *args, **kargs)
     self.stack = []