Skip to content

Commit

Permalink
Converts numpy numeric arguments to allow serialization (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
Charlles Abreu authored Apr 5, 2024
1 parent 6df7254 commit 2acd3ff
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cvpack/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ def preprocess_args(func: t.Callable) -> t.Callable:
signature = inspect.signature(func)

def convert(data: t.Any) -> t.Any: # pylint: disable=too-many-return-statements
if isinstance(data, np.integer):
return int(data)
if isinstance(data, np.floating):
return float(data)
if isinstance(data, mmunit.Quantity):
return Quantity(data)
if isinstance(data, mmunit.Unit):
Expand Down

0 comments on commit 2acd3ff

Please sign in to comment.