Skip to content

Commit

Permalink
add none condition
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewilyas committed Jul 11, 2020
1 parent 504bacf commit 148be00
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion robustness/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ def override_args(self, default_args, new_args):
if len(extra_args) > 0: raise ValueError(f"Invalid arguments: {extra_args}")
for k in kwargs:
req_type = type(default_args[k])
if (default_args[k] is not None) and (not isinstance(kwargs[k], req_type)):
no_nones = (default_args[k] is not None) and (kwargs[k] is not None)
if no_nones and (not isinstance(kwargs[k], req_type)):
raise ValueError(f"Argument {k} should have type {req_type}")
return {**default_args, **kwargs}

Expand Down

0 comments on commit 148be00

Please sign in to comment.