MCPcopy
hub / github.com/pandas-dev/pandas / load_newobj

Method load_newobj

pandas/compat/pickle_compat.py:97–112  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

95 dispatch[pickle.REDUCE[0]] = load_reduce # type: ignore[assignment]
96
97 def load_newobj(self) -> None:
98 args = self.stack.pop() # type: ignore[attr-defined]
99 cls = self.stack.pop() # type: ignore[attr-defined]
100
101 # compat
102 if issubclass(cls, DatetimeArray) and not args:
103 arr = np.array([], dtype="M8[ns]")
104 obj = cls.__new__(cls, arr, arr.dtype)
105 elif issubclass(cls, TimedeltaArray) and not args:
106 arr = np.array([], dtype="m8[ns]")
107 obj = cls.__new__(cls, arr, arr.dtype)
108 elif cls is BlockManager and not args:
109 obj = cls.__new__(cls, (), [], False)
110 else:
111 obj = cls.__new__(cls, *args)
112 self.append(obj) # type: ignore[attr-defined]
113
114 dispatch[pickle.NEWOBJ[0]] = load_newobj # type: ignore[assignment]
115

Callers

nothing calls this directly

Calls 4

popMethod · 0.45
arrayMethod · 0.45
__new__Method · 0.45
appendMethod · 0.45

Tested by

no test coverage detected