From b413fcd188c327928039ec65483946fb01ff891d Mon Sep 17 00:00:00 2001 From: petechd <53475968+petechd@users.noreply.github.com> Date: Mon, 25 Nov 2024 08:22:07 +0000 Subject: [PATCH] Remove Ruff ignore rule UP034 (pyupgrade) (#1553) --- app/questionnaire/questionnaire_schema.py | 2 +- app/questionnaire/questionnaire_store_updater.py | 8 +++----- app/utilities/make_immutable.py | 2 +- pyproject.toml | 1 - 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/questionnaire/questionnaire_schema.py b/app/questionnaire/questionnaire_schema.py index 1eccc383e1..281bb3f33d 100644 --- a/app/questionnaire/questionnaire_schema.py +++ b/app/questionnaire/questionnaire_schema.py @@ -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) diff --git a/app/questionnaire/questionnaire_store_updater.py b/app/questionnaire/questionnaire_store_updater.py index b0c18fe887..8ee6591c31 100644 --- a/app/questionnaire/questionnaire_store_updater.py +++ b/app/questionnaire/questionnaire_store_updater.py @@ -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( diff --git a/app/utilities/make_immutable.py b/app/utilities/make_immutable.py index b48cb20b83..522f6ec324 100644 --- a/app/utilities/make_immutable.py +++ b/app/utilities/make_immutable.py @@ -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) diff --git a/pyproject.toml b/pyproject.toml index 986a5f54e8..be9a61f862 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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