You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
numeric_scalars in type hint disables our typechecking #2528
The inclusion of numeric_scalars in the type hint seems to make methods not do any type checking. We should also take a look at similar places where we do type hints with groups that aren't classes and see how we want to handle them
In [5]: arctan2(np.uint32(2), ak.array([1,2,3]))
---------------------------------------------------------------------------TypeCheckErrorTraceback (mostrecentcalllast)
CellIn[5], line1---->1arctan2(np.uint32(2), ak.array([1,2,3]))
File~/git/arkouda/arkouda/numpy/numeric.py:1146, inarctan2(num, denom, where)
1120""" 1121 Return the element-wise inverse tangent of the array. The result is between -pi/2 and pi/2. 1122 (...) 1140 Raised if the parameter is not a pdarray 1141 """1142return_trig_helper(pda, "arctan", where)
1145 @typechecked->1146defarctan2(
1147num: Union[pdarray, numeric_scalars],
1148denom: Union[pdarray, numeric_scalars],
1149where: Union[bool, pdarray] =True,
1150 ) ->pdarray:
1151""" 1152 Return the element-wise inverse tangent of the array pair. The result chosen is the 1153 signed angle in radians between the ray ending at the origin and passing through the (...) 1181 | Raised if where is neither boolean nor a pdarray of boolean 1182 """1183ifnotall(isSupportedNumber(arg) orisinstance(arg, pdarray) forargin [num, denom]):
File~/anaconda3/envs/arkouda-dev/lib/python3.13/site-packages/typeguard/_functions.py:137, incheck_argument_types(func_name, arguments, memo)
134raiseexc136try:
-->137check_type_internal(value, annotation, memo)
138exceptTypeCheckErrorasexc:
139qualname=qualified_name(value, add_class_prefix=True)
File~/anaconda3/envs/arkouda-dev/lib/python3.13/site-packages/typeguard/_checkers.py:951, incheck_type_internal(value, annotation, memo)
949checker=lookup_func(origin_type, args, extras)
950ifchecker:
-->951checker(value, origin_type, args, memo)
952return954ifisclass(origin_type):
File~/anaconda3/envs/arkouda-dev/lib/python3.13/site-packages/typeguard/_checkers.py:427, incheck_union(value, origin_type, args, memo)
424finally:
425delerrors# avoid creating ref cycle-->427raiseTypeCheckError(f"did not match any element in the union:\n{formatted_errors}")
TypeCheckError: argument"num" (numpy.uint32) didnotmatchanyelementintheunion:
arkouda.numpy.pdarrayclass.pdarray: isnotaninstanceofarkouda.numpy.pdarrayclass.pdarrayfloat: isneitherfloatorintnumpy.float64: isnotaninstanceofnumpy.float64numpy.float32: isnotaninstanceofnumpy.float32int: isnotaninstanceofintnumpy.int8: isnotaninstanceofnumpy.int8numpy.int16: isnotaninstanceofnumpy.int16numpy.int32: isnotaninstanceofnumpy.int32numpy.int64: isnotaninstanceofnumpy.int64numpy.uint8: isnotaninstanceofnumpy.uint8numpy.uint16: isnotaninstanceofnumpy.uint16numpy.uint64: isnotaninstanceofnumpy.uint64In [6]: arctan2(np.int32(2), ak.array([1,2,3]))
Out[6]: array([1.10714871779409040.785398163397448280.5880026035475675])
Activity
ajpotts commentedon May 23, 2025
I was able to verify that upgrading to
typeguard==4.4.2fixes the problem. To test this, I temporarily alteredint_scalars:And then:
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Part 1 of #2528 numeric_scalars in type hint disables our typechecking (
Part 1 of Bears-R-Us#2528 numeric_scalars in type hint disables our t…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…
Closes Bears-R-Us#2528 numeric_scalars in type hint disables our type…