MCPcopy Create free account
hub / github.com/numpy/numpy / __setstate__

Method __setstate__

numpy/ma/core.py:6293–6308  ·  view source on GitHub ↗

Restore the internal state of the masked array, for pickling purposes. ``state`` is typically the output of the ``__getstate__`` output, and is a 5-tuple: - class name - a tuple giving the shape of the data - a typecode for the data - a binary string

(self, state)

Source from the content-addressed store, hash-verified

6291 return data_state + (getmaskarray(self).tobytes(cf), self._fill_value)
6292
6293 def __setstate__(self, state):
6294 """Restore the internal state of the masked array, for
6295 pickling purposes. ``state`` is typically the output of the
6296 ``__getstate__`` output, and is a 5-tuple:
6297
6298 - class name
6299 - a tuple giving the shape of the data
6300 - a typecode for the data
6301 - a binary string for the data
6302 - a binary string for the mask.
6303
6304 """
6305 (_, shp, typ, isf, raw, msk, flv) = state
6306 super().__setstate__((shp, typ, isf, raw))
6307 self._mask.__setstate__((shp, make_mask_descr(typ), isf, msk))
6308 self.fill_value = flv
6309
6310 def __reduce__(self):
6311 """Return a 3-tuple for pickling a MaskedArray.

Callers 3

test_state_settingMethod · 0.45
test_mutateMethod · 0.45
random.pyFile · 0.45

Calls 1

make_mask_descrFunction · 0.85

Tested by 2

test_state_settingMethod · 0.36
test_mutateMethod · 0.36