Skip to content

Commit

Permalink
Remove Ruff ignore rule UP034 (pyupgrade) (#1553)
Browse files Browse the repository at this point in the history
  • Loading branch information
petechd authored Nov 25, 2024
1 parent f37859c commit b413fcd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/questionnaire/questionnaire_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def serialize(cls, data: Any) -> Any:
@classmethod
def get_mutable_deepcopy(cls, data: Any) -> Any:
if isinstance(data, tuple):
return list((cls.get_mutable_deepcopy(item) for item in data))
return [cls.get_mutable_deepcopy(item) for item in data]
if isinstance(data, ImmutableDict):
key_value_tuples = {k: cls.get_mutable_deepcopy(v) for k, v in data.items()}
return dict(key_value_tuples)
Expand Down
8 changes: 3 additions & 5 deletions app/questionnaire/questionnaire_store_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ def save(self) -> None:

def is_dirty(self) -> bool:
return bool(
(
self._answer_store.is_dirty
or self._list_store.is_dirty
or self._progress_store.is_dirty
)
self._answer_store.is_dirty
or self._list_store.is_dirty
or self._progress_store.is_dirty
)

def update_relationships_answer(
Expand Down
2 changes: 1 addition & 1 deletion app/utilities/make_immutable.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def make_immutable(data: Any) -> Any:
if isinstance(data, abc.Hashable):
return data
if isinstance(data, list):
return tuple((make_immutable(item) for item in data))
return tuple(make_immutable(item) for item in data)
if isinstance(data, dict):
key_value_tuples = {k: make_immutable(v) for k, v in data.items()}
return ImmutableDict(key_value_tuples)
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ extend-ignore = [
"EM102", # EM102 Exception must not use an f-string literal, assign to variable first
"UP032", # Use f-string instead of `format` call
"UP018", # Unnecessary {literal_type} call (rewrite as a literal)
"UP034", # Avoid extraneous parentheses
"UP015", # Unnecessary open mode parameters
"UP007", # Use `X | Y` for type annotations
"UP006", # Use `type` instead of `Type` for type annotation
Expand Down

0 comments on commit b413fcd

Please sign in to comment.