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

Function get_masked_subclass

numpy/ma/core.py:644–668  ·  view source on GitHub ↗

Return the youngest subclass of MaskedArray from a list of (masked) arrays. In case of siblings, the first listed takes over.

(*arrays)

Source from the content-addressed store, hash-verified

642
643
644def get_masked_subclass(*arrays):
645 """
646 Return the youngest subclass of MaskedArray from a list of (masked) arrays.
647
648 In case of siblings, the first listed takes over.
649
650 """
651 if len(arrays) == 1:
652 arr = arrays[0]
653 if isinstance(arr, MaskedArray):
654 rcls = type(arr)
655 else:
656 rcls = MaskedArray
657 else:
658 arrcls = [type(a) for a in arrays]
659 rcls = arrcls[0]
660 if not issubclass(rcls, MaskedArray):
661 rcls = MaskedArray
662 for cls in arrcls[1:]:
663 if issubclass(cls, rcls):
664 rcls = cls
665 # Don't return MaskedConstant as result: revert to MaskedArray
666 if rcls.__name__ == 'MaskedConstant':
667 return MaskedArray
668 return rcls
669
670
671def getdata(a, subok=True):

Callers 9

__call__Method · 0.85
__call__Method · 0.85
reduceMethod · 0.85
outerMethod · 0.85
accumulateMethod · 0.85
__call__Method · 0.85
concatenateFunction · 0.85
resizeFunction · 0.85
dotFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected