diff --git a/push_action/cache.py b/push_action/cache.py index b769c39..a7e4e80 100644 --- a/push_action/cache.py +++ b/push_action/cache.py @@ -7,7 +7,8 @@ from typing import TYPE_CHECKING if TYPE_CHECKING: # pragma: no cover - from typing import Any, Iterator + from typing import Any + from collections.abc import Iterator class InMemoryCache: diff --git a/push_action/run.py b/push_action/run.py index d4c52b4..594862d 100644 --- a/push_action/run.py +++ b/push_action/run.py @@ -186,7 +186,7 @@ def unprotect_reviews() -> None: def protect_reviews() -> None: """Re-add pull request review protection for target branch""" # Retrieve data - with open("tmp_protection_rules.json", "r", encoding="utf8") as handle: + with open("tmp_protection_rules.json", encoding="utf8") as handle: data = json.load(handle) # Add protection diff --git a/push_action/utils.py b/push_action/utils.py index bc4e1e7..49e3427 100644 --- a/push_action/utils.py +++ b/push_action/utils.py @@ -21,7 +21,8 @@ from push_action.validate import validate_rest_api_base_url if TYPE_CHECKING: # pragma: no cover - from typing import Callable, List, Union + from typing import List, Union + from collections.abc import Callable LOGGER = logging.getLogger("push_action.utils") diff --git a/push_action/validate.py b/push_action/validate.py index 00acbc9..a2be3fc 100644 --- a/push_action/validate.py +++ b/push_action/validate.py @@ -40,7 +40,7 @@ def validate_conclusions(conclusions: list[str]) -> list[str]: ) # Remove redundant entries and conform to lowercase - conclusions = list(set(conclusion.lower() for conclusion in conclusions)) + conclusions = list({conclusion.lower() for conclusion in conclusions}) for conclusion in conclusions: invalid_conclusions: list[str] = [] diff --git a/setup.py b/setup.py index b5fe942..747404d 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ TOP_DIR = Path(__file__).parent.resolve() -with open(TOP_DIR / "push_action" / "__init__.py", "r", encoding="utf8") as handle: +with open(TOP_DIR / "push_action" / "__init__.py", encoding="utf8") as handle: for line in handle.readlines(): version = re.findall(r'__version__ = "(.*)"', line) if version: