MCPcopy Index your code
hub / github.com/python/cpython / __reduce__

Method __reduce__

Lib/collections/__init__.py:285–302  ·  view source on GitHub ↗

Return state information for pickling

(self)

Source from the content-addressed store, hash-verified

283 return '%s(%r)' % (self.__class__.__name__, dict(self.items()))
284
285 def __reduce__(self):
286 'Return state information for pickling'
287 state = self.__getstate__()
288 if state:
289 if isinstance(state, tuple):
290 state, slots = state
291 else:
292 slots = {}
293 state = state.copy()
294 slots = slots.copy()
295 for k in vars(OrderedDict()):
296 state.pop(k, None)
297 slots.pop(k, None)
298 if slots:
299 state = state, slots
300 else:
301 state = state or None
302 return self.__class__, (), state, None, iter(self.items())
303
304 def copy(self):
305 'od.copy() -> a shallow copy of od'

Callers 2

test_yaml_linkageMethod · 0.95

Calls 5

itemsMethod · 0.95
OrderedDictClass · 0.70
__getstate__Method · 0.45
copyMethod · 0.45
popMethod · 0.45

Tested by 2

test_yaml_linkageMethod · 0.76