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

Method _generate_pickle_copiers

Lib/test/test_descr.py:5506–5528  ·  view source on GitHub ↗

Utility method to generate the many possible pickle configurations.

()

Source from the content-addressed store, hash-verified

5504
5505 @staticmethod
5506 def _generate_pickle_copiers():
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},
5528 {pickle.loads, pickle._loads}))
5529
5530 @support.thread_unsafe
5531 def test_pickle_slots(self):

Callers 2

test_pickle_slotsMethod · 0.95
test_reduce_copyingMethod · 0.95

Calls 1

PickleCopierClass · 0.85

Tested by

no test coverage detected