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

Method __new__

numpy/ma/core.py:6350–6368  ·  view source on GitHub ↗
(self, data, mask=nomask, dtype=None, fill_value=None,
                hardmask=False, copy=False, subok=True)

Source from the content-addressed store, hash-verified

6348 """
6349
6350 def __new__(self, data, mask=nomask, dtype=None, fill_value=None,
6351 hardmask=False, copy=False, subok=True):
6352 _data = np.array(data, copy=copy, subok=subok, dtype=dtype)
6353 _data = _data.view(self)
6354 _data._hardmask = hardmask
6355 if mask is not nomask:
6356 if isinstance(mask, np.void):
6357 _data._mask = mask
6358 else:
6359 try:
6360 # Mask is already a 0D array
6361 _data._mask = np.void(mask)
6362 except TypeError:
6363 # Transform the mask to a void
6364 mdtype = make_mask_descr(dtype)
6365 _data._mask = np.array(mask, dtype=mdtype)[()]
6366 if fill_value is not None:
6367 _data.fill_value = fill_value
6368 return _data
6369
6370 @property
6371 def _data(self):

Callers 6

emptyFunction · 0.45
onesFunction · 0.45
zerosFunction · 0.45
__deepcopy__Method · 0.45
_mareconstructFunction · 0.45
__copy__Method · 0.45

Calls 2

make_mask_descrFunction · 0.85
viewMethod · 0.45

Tested by

no test coverage detected