Skip to content

Commit

Permalink
Merge pull request #1741 from keewis/fix-full_like
Browse files Browse the repository at this point in the history
use `**kwargs` to pass along additional arguments to `ones_like`
  • Loading branch information
hgrecco authored Apr 24, 2023
2 parents ae19c11 + 5f20e39 commit cd68b87
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions pint/facets/numpy/numpy_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,22 +527,16 @@ def _meshgrid(*xi, **kwargs):


@implements("full_like", "function")
def _full_like(a, fill_value, dtype=None, order="K", subok=True, shape=None):
def _full_like(a, fill_value, **kwargs):
# Make full_like by multiplying with array from ones_like in a
# non-multiplicative-unit-safe way
if hasattr(fill_value, "_REGISTRY"):
return fill_value._REGISTRY.Quantity(
(
np.ones_like(a, dtype=dtype, order=order, subok=subok, shape=shape)
* fill_value.m
),
np.ones_like(a, **kwargs) * fill_value.m,
fill_value.units,
)
else:
return (
np.ones_like(a, dtype=dtype, order=order, subok=subok, shape=shape)
* fill_value
)
return np.ones_like(a, **kwargs) * fill_value


@implements("interp", "function")
Expand Down

0 comments on commit cd68b87

Please sign in to comment.