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

Method _update_from

numpy/ma/core.py:2952–2976  ·  view source on GitHub ↗

Copies some attributes of obj to self.

(self, obj)

Source from the content-addressed store, hash-verified

2950
2951
2952 def _update_from(self, obj):
2953 """
2954 Copies some attributes of obj to self.
2955
2956 """
2957 if isinstance(obj, ndarray):
2958 _baseclass = type(obj)
2959 else:
2960 _baseclass = ndarray
2961 # We need to copy the _basedict to avoid backward propagation
2962 _optinfo = {}
2963 _optinfo.update(getattr(obj, '_optinfo', {}))
2964 _optinfo.update(getattr(obj, '_basedict', {}))
2965 if not isinstance(obj, MaskedArray):
2966 _optinfo.update(getattr(obj, '__dict__', {}))
2967 _dict = dict(_fill_value=getattr(obj, '_fill_value', None),
2968 _hardmask=getattr(obj, '_hardmask', False),
2969 _sharedmask=getattr(obj, '_sharedmask', False),
2970 _isfield=getattr(obj, '_isfield', False),
2971 _baseclass=getattr(obj, '_baseclass', _baseclass),
2972 _optinfo=_optinfo,
2973 _basedict=_optinfo)
2974 self.__dict__.update(_dict)
2975 self.__dict__.update(_optinfo)
2976 return
2977
2978 def __array_finalize__(self, obj):
2979 """

Callers 15

__array_finalize__Method · 0.95
__call__Method · 0.80
__call__Method · 0.80
__call__Method · 0.80
wrapped_methodFunction · 0.80
__array_wrap__Method · 0.80
__getitem__Method · 0.80
compressMethod · 0.80
_comparisonMethod · 0.80
ravelMethod · 0.80
reshapeMethod · 0.80
varMethod · 0.80

Calls 1

updateMethod · 0.80

Tested by

no test coverage detected