Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [low-code] $options shouldn't overwrite values that are already defined #18060

Merged
merged 9 commits into from
Oct 17, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename
  • Loading branch information
girarda committed Oct 17, 2022
commit 19687bf8783d7f48cfa0da05eb98de3f1f1eeeba
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ def _get_kwargs_to_pass_to_func(func, options, keywords):
kwargs_to_pass_down = set(argspec.kwonlyargs)
args_to_pass_down = set(argspec.args)
all_args = args_to_pass_down.union(kwargs_to_pass_down)
kwargs_to_pass_down = {k: v for k, v in options.items() if k in all_args and _key_is_not_already_set(k, v, keywords)}
kwargs_to_pass_down = {k: v for k, v in options.items() if k in all_args and _key_is_unset_or_identical(k, v, keywords)}
if "options" in all_args:
kwargs_to_pass_down["options"] = options
return kwargs_to_pass_down


def _key_is_not_already_set(key: str, value: Any, mapping: Mapping[str, Any]):
def _key_is_unset_or_identical(key: str, value: Any, mapping: Mapping[str, Any]):
return key not in mapping or mapping[key] == value


Expand Down