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