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

Method __array_finalize__

numpy/ma/core.py:6769–6781  ·  view source on GitHub ↗
(self, obj)

Source from the content-addressed store, hash-verified

6767 return cls.__singleton
6768
6769 def __array_finalize__(self, obj):
6770 if not self.__has_singleton():
6771 # this handles the `.view` in __new__, which we want to copy across
6772 # properties normally
6773 return super().__array_finalize__(obj)
6774 elif self is self.__singleton:
6775 # not clear how this can happen, play it safe
6776 pass
6777 else:
6778 # everywhere else, we want to downcast to MaskedArray, to prevent a
6779 # duplicate maskedconstant.
6780 self.__class__ = MaskedArray
6781 MaskedArray.__array_finalize__(self, obj)
6782
6783 def __array_wrap__(self, obj, context=None, return_scalar=False):
6784 return self.view(MaskedArray).__array_wrap__(obj, context)

Callers

nothing calls this directly

Calls 2

__has_singletonMethod · 0.95
__array_finalize__Method · 0.45

Tested by

no test coverage detected