Skip to content

Commit

Permalink
Make non_matching_params lines more idiomatic
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanbb committed Jun 12, 2024
1 parent 18544de commit 8acba23
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/filelock/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,12 @@ def __init__( # noqa: PLR0913
"blocking": (blocking, self.blocking),
}

non_matching_params = {name: vals for name, vals in params_to_check.items() if vals[0] != vals[1]}
if len(non_matching_params) == 0:
non_matching_params = {
name: (passed_param, set_param)
for name, (passed_param, set_param) in params_to_check.items()
if passed_param != set_param
}
if not non_matching_params:
return # bypass initialization because object is already initialized

# parameters do not match; raise error
Expand Down

0 comments on commit 8acba23

Please sign in to comment.