MCPcopy Index your code
hub / github.com/RustPython/RustPython / PickleCopier

Class PickleCopier

Lib/test/test_descr.py:5509–5524  ·  view source on GitHub ↗

This class copies object using pickle.

Source from the content-addressed store, hash-verified

5507 """Utility method to generate the many possible pickle configurations.
5508 """
5509 class PickleCopier:
5510 "This class copies object using pickle."
5511 def __init__(self, proto, dumps, loads):
5512 self.proto = proto
5513 self.dumps = dumps
5514 self.loads = loads
5515 def copy(self, obj):
5516 return self.loads(self.dumps(obj, self.proto))
5517 def __repr__(self):
5518 # We try to be as descriptive as possible here since this is
5519 # the string which we will allow us to tell the pickle
5520 # configuration we are using during debugging.
5521 return ("PickleCopier(proto={}, dumps={}.{}, loads={}.{})"
5522 .format(self.proto,
5523 self.dumps.__module__, self.dumps.__qualname__,
5524 self.loads.__module__, self.loads.__qualname__))
5525 return (PickleCopier(*args) for args in
5526 itertools.product(range(pickle.HIGHEST_PROTOCOL + 1),
5527 {pickle.dumps, pickle._dumps},

Callers 1

Calls

no outgoing calls

Tested by 1