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

Method __array_wrap__

numpy/core/memmap.py:319–332  ·  view source on GitHub ↗
(self, arr, context=None)

Source from the content-addressed store, hash-verified

317 self.base.flush()
318
319 def __array_wrap__(self, arr, context=None):
320 arr = super().__array_wrap__(arr, context)
321
322 # Return a memmap if a memmap was given as the output of the
323 # ufunc. Leave the arr class unchanged if self is not a memmap
324 # to keep original memmap subclasses behavior
325 if self is arr or type(self) is not memmap:
326 return arr
327 # Return scalar instead of 0d memmap, e.g. for np.sum with
328 # axis=None
329 if arr.shape == ():
330 return arr[()]
331 # Return ndarray otherwise
332 return arr.view(np.ndarray)
333
334 def __getitem__(self, index):
335 res = super().__getitem__(index)

Callers

nothing calls this directly

Calls 1

viewMethod · 0.45

Tested by

no test coverage detected