Skip to content

Commit

Permalink
Fix arbitrary kwargs (fixes #171)
Browse files Browse the repository at this point in the history
  • Loading branch information
hameerabbasi committed Jun 26, 2019
1 parent 619e120 commit d179d70
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion uarray/_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ def inner(*args, **kwargs):

a, kw = res

kw = {k: kw[k] for k in kw if k in opts}
for k, v in kw_defaults.items():
if k in kw and kw[k] is v:
del kw[k]
Expand Down
12 changes: 8 additions & 4 deletions unumpy/multimethods.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ def ureduce(self, a, axis=0, dtype=None, out=None, keepdims=False):

def _reduce_argreplacer(args, kwargs, arrays):
def reduce(a, axis=None, dtype=None, out=None, keepdims=False):
return (
(arrays[0],),
dict(axis=axis, dtype=dtype, out=arrays[1], keepdims=keepdims),
)
kwargs = {}
if dtype is not None:
kwargs["dtype"] = dtype

if keepdims is not False:
kwargs["keepdims"] = keepdims

return ((arrays[0],), dict(axis=axis, out=arrays[1], **kwargs))

return reduce(*args, **kwargs)

Expand Down

0 comments on commit d179d70

Please sign in to comment.