MCPcopy Index your code
hub / github.com/numpy/numpy / __array_finalize__

Method __array_finalize__

numpy/ma/mrecords.py:134–151  ·  view source on GitHub ↗
(self, obj)

Source from the content-addressed store, hash-verified

132 return self
133
134 def __array_finalize__(self, obj):
135 # Make sure we have a _fieldmask by default
136 _mask = getattr(obj, '_mask', None)
137 if _mask is None:
138 objmask = getattr(obj, '_mask', ma.nomask)
139 _dtype = np.ndarray.__getattribute__(self, 'dtype')
140 if objmask is ma.nomask:
141 _mask = ma.make_mask_none(self.shape, dtype=_dtype)
142 else:
143 mdescr = ma.make_mask_descr(_dtype)
144 _mask = np.array([tuple([m] * len(mdescr)) for m in objmask],
145 dtype=mdescr).view(np.recarray)
146 # Update some of the attributes
147 _dict = self.__dict__
148 _dict.update(_mask=_mask)
149 self._update_from(obj)
150 if _dict['_baseclass'] == np.ndarray:
151 _dict['_baseclass'] = np.recarray
152
153 @property
154 def _data(self):

Callers

nothing calls this directly

Calls 4

updateMethod · 0.80
_update_fromMethod · 0.80
__getattribute__Method · 0.45
viewMethod · 0.45

Tested by

no test coverage detected