Skip to content

Commit 0f024b6

Browse files
committed
result_type
1 parent 4bc41b5 commit 0f024b6

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/pint_array/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,15 @@ def manip_fun(x, *args, **kwargs):
292292
setattr(mod, name, get_manip_fun(name))
293293

294294
## Data Type Functions and Data Types ##
295-
dtype_fun_names = ["can_cast", "finfo", "iinfo", "isdtype"]
295+
dtype_fun_names = ["can_cast", "finfo", "iinfo", "result_type"]
296+
for func_str in dtype_fun_names:
297+
298+
def fun(*args, func_str=func_str, **kwargs):
299+
args = [(arg.magnitude if hasattr(arg, "units") else arg) for arg in args]
300+
return getattr(xp, func_str)(*args, **kwargs)
301+
302+
setattr(mod, func_str, fun)
303+
296304
dtype_names = [
297305
"bool",
298306
"int8",
@@ -307,6 +315,7 @@ def manip_fun(x, *args, **kwargs):
307315
"float64",
308316
"complex64",
309317
"complex128",
318+
"isdtype", # function, but can treat as dtype here
310319
]
311320
inspection_fun_names = ["__array_namespace_info__"]
312321
version_attribute_names = ["__array_api_version__"]

0 commit comments

Comments
 (0)