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

Function _check_order

numpy/core/code_generators/generate_umath.py:96–118  ·  view source on GitHub ↗
(types1, types2)

Source from the content-addressed store, hash-verified

94
95
96def _check_order(types1, types2):
97 dtype_order = allP + "O"
98 for t1, t2 in zip(types1, types2):
99 # We have no opinion on object or time ordering for now:
100 if t1 in "OP" or t2 in "OP":
101 return True
102 if t1 in "mM" or t2 in "mM":
103 return True
104
105 t1i = dtype_order.index(t1)
106 t2i = dtype_order.index(t2)
107 if t1i < t2i:
108 return
109 if t2i > t1i:
110 break
111
112 if types1 == "QQ?" and types2 == "qQ?":
113 # Explicitly allow this mixed case, rather than figure out what order
114 # is nicer or how to encode it.
115 return
116
117 raise TypeError(
118 f"Input dtypes are unsorted or duplicate: {types1} and {types2}")
119
120
121def check_td_order(tds):

Callers 1

check_td_orderFunction · 0.85

Calls 1

indexMethod · 0.45

Tested by

no test coverage detected