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

Function _maybe_view_as_subclass

numpy/lib/stride_tricks.py:25–35  ·  view source on GitHub ↗
(original_array, new_array)

Source from the content-addressed store, hash-verified

23
24
25def _maybe_view_as_subclass(original_array, new_array):
26 if type(original_array) is not type(new_array):
27 # if input was an ndarray subclass and subclasses were OK,
28 # then view the result as that subclass.
29 new_array = new_array.view(type=type(original_array))
30 # Since we have done something akin to a view from original_array, we
31 # should let the subclass finalize (if it has it implemented, i.e., is
32 # not None).
33 if new_array.__array_finalize__:
34 new_array.__array_finalize__(original_array)
35 return new_array
36
37
38def as_strided(x, shape=None, strides=None, subok=False, writeable=True):

Callers 2

as_stridedFunction · 0.85
_broadcast_toFunction · 0.85

Calls 2

viewMethod · 0.45
__array_finalize__Method · 0.45

Tested by

no test coverage detected