diff options
author | Keewis <keewis@posteo.de> | 2020-03-22 02:24:52 +0100 |
---|---|---|
committer | Keewis <keewis@posteo.de> | 2020-04-01 22:42:09 +0200 |
commit | 6ec6a6aaa5c8e39acd03aab5d1de7c79a65eb8a7 (patch) | |
tree | 51c4cf7f7963a7cbfb74189c14dbd56095014a40 /pint/numpy_func.py | |
parent | c8c83bb2b44dff24febb8dddc01b5bc569d74ea1 (diff) | |
parent | 54c53e3635d272340b555ac0157dd640ead537e0 (diff) | |
download | pint-6ec6a6aaa5c8e39acd03aab5d1de7c79a65eb8a7.tar.gz |
Merge branch 'master' into fix-interp
Diffstat (limited to 'pint/numpy_func.py')
-rw-r--r-- | pint/numpy_func.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/pint/numpy_func.py b/pint/numpy_func.py index 380a4ed..8501a7e 100644 --- a/pint/numpy_func.py +++ b/pint/numpy_func.py @@ -263,7 +263,10 @@ def implement_func(func_type, func_str, input_units=None, output_unit=None): # Handle functions in submodules func_str_split = func_str.split(".") - func = getattr(np, func_str_split[0]) + func = getattr(np, func_str_split[0], None) + # If the function is not available, do not attempt to implement it + if func is None: + return for func_str_piece in func_str_split[1:]: func = getattr(func, func_str_piece) @@ -675,7 +678,10 @@ def implement_consistent_units_by_argument(func_str, unit_arguments, wrap_output if np is None: return - func = getattr(np, func_str) + func = getattr(np, func_str, None) + # if NumPy does not implement it, do not implement it either + if func is None: + return @implements(func_str, "function") def implementation(*args, **kwargs): @@ -729,6 +735,8 @@ for func_str, unit_arguments, wrap_output in [ ("nanmax", "a", True), ("percentile", "a", True), ("nanpercentile", "a", True), + ("quantile", "a", True), + ("nanquantile", "a", True), ("flip", "m", True), ("fix", "x", True), ("trim_zeros", ["filt"], True), |