Skip to content

Commit

Permalink
Treat None passed into autopara_info same as not passing anything at …
Browse files Browse the repository at this point in the history
…all, i.e. empty object
  • Loading branch information
bernstei committed Oct 9, 2024
1 parent 2d600ae commit 8f4c1ff
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions wfl/autoparallelize/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,11 @@ def autoparallelized_op(*args, **kwargs):
# outputs is also positional, remote it from func args as well
outputs = args.pop(0)

# create autopara_info from explicitly passed AutoparaInfo object, otherwise an empty object
autopara_info = kwargs.pop("autopara_info", AutoparaInfo())
if isinstance(autopara_info, dict):
# create autopara_info from explicitly passed AutoparaInfo object or dict, otherwise an empty object
autopara_info = kwargs.pop("autopara_info", None)
if autopara_info is None:
autopara_info = AutoparaInfo()
elif isinstance(autopara_info, dict):
autopara_info = AutoparaInfo(**autopara_info)
# update values, if any are not set, with defaults that were set by decorating code
autopara_info.update_defaults(default_autopara_info)
Expand Down

0 comments on commit 8f4c1ff

Please sign in to comment.