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

Method __array_finalize__

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

Source from the content-addressed store, hash-verified

142 return self
143
144 def __array_finalize__(self, obj):
145 # Make sure we have a _fieldmask by default
146 _mask = getattr(obj, '_mask', None)
147 if _mask is None:
148 objmask = getattr(obj, '_mask', nomask)
149 _dtype = ndarray.__getattribute__(self, 'dtype')
150 if objmask is nomask:
151 _mask = ma.make_mask_none(self.shape, dtype=_dtype)
152 else:
153 mdescr = ma.make_mask_descr(_dtype)
154 _mask = narray([tuple([m] * len(mdescr)) for m in objmask],
155 dtype=mdescr).view(recarray)
156 # Update some of the attributes
157 _dict = self.__dict__
158 _dict.update(_mask=_mask)
159 self._update_from(obj)
160 if _dict['_baseclass'] == ndarray:
161 _dict['_baseclass'] = recarray
162 return
163
164 @property
165 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