From 4cee096e7a2be53d7478d30bd8591e0ae173633e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 13 Feb 2024 00:13:19 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 23.12.1 → 24.2.0](https://github.com/psf/black/compare/23.12.1...24.2.0) - [github.com/teemtee/tmt.git: 1.30.0 → 1.31.0](https://github.com/teemtee/tmt.git/compare/1.30.0...1.31.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0f8b760..a88d9c1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ repos: hooks: - id: pyupgrade - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.2.0 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-prettier @@ -51,7 +51,7 @@ repos: additional_dependencies: [types-pkg_resources, types-requests, types-python-dateutil] - repo: https://github.com/teemtee/tmt.git - rev: 1.30.0 + rev: 1.31.0 hooks: - id: tmt-lint # linting of the reverse-dependency tests requires internet access From 0e30b5eb5c00ea17aecdddf7fe8739d8de873a25 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 13 Feb 2024 00:15:51 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- specfile/macro_definitions.py | 14 +++++++++----- specfile/options.py | 24 +++++++++++++++--------- specfile/sources.py | 3 +-- specfile/specfile.py | 16 ++++++++++------ specfile/types.py | 3 +-- 5 files changed, 36 insertions(+), 24 deletions(-) diff --git a/specfile/macro_definitions.py b/specfile/macro_definitions.py index 448c190..68a4316 100644 --- a/specfile/macro_definitions.py +++ b/specfile/macro_definitions.py @@ -395,11 +395,15 @@ def count_brackets(s): body, macro == "global", bool(dnl or sc.startswith("#")), - CommentOutStyle.HASH - if sc == "#" - else CommentOutStyle.OTHER - if sc.startswith("#") - else CommentOutStyle.DNL, + ( + CommentOutStyle.HASH + if sc == "#" + else ( + CommentOutStyle.OTHER + if sc.startswith("#") + else CommentOutStyle.DNL + ) + ), (ws0, ws1, ws2, ws3), dnl[4:] if dnl else " ", sc[:-1] if len(sc) > 1 else "", diff --git a/specfile/options.py b/specfile/options.py index d5c33ff..a6d7d8c 100644 --- a/specfile/options.py +++ b/specfile/options.py @@ -195,9 +195,11 @@ def insert(self, i: int, value: Union[int, str]) -> None: self._options._tokens.insert( index, Token( - TokenType.DOUBLE_QUOTED - if self._options._needs_quoting(value) - else TokenType.DEFAULT, + ( + TokenType.DOUBLE_QUOTED + if self._options._needs_quoting(value) + else TokenType.DEFAULT + ), str(value), ), ) @@ -359,9 +361,11 @@ def __setattr__(self, name: str, value: Union[bool, int, str]) -> None: self._tokens.append(Token(TokenType.WHITESPACE, " ")) self._tokens.append( Token( - TokenType.DOUBLE_QUOTED - if self._needs_quoting(value) - else TokenType.DEFAULT, + ( + TokenType.DOUBLE_QUOTED + if self._needs_quoting(value) + else TokenType.DEFAULT + ), value, ) ) @@ -484,9 +488,11 @@ def tokenize(option_string: str) -> List[Token]: if token: result.append( Token( - TokenType.QUOTED - if quote == "'" - else TokenType.DOUBLE_QUOTED, + ( + TokenType.QUOTED + if quote == "'" + else TokenType.DOUBLE_QUOTED + ), token, ) ) diff --git a/specfile/sources.py b/specfile/sources.py index 0bca3e3..79cdffa 100644 --- a/specfile/sources.py +++ b/specfile/sources.py @@ -33,8 +33,7 @@ def location(self) -> str: ... @location.setter - def location(self, value: str) -> None: - ... + def location(self, value: str) -> None: ... @property @abstractmethod diff --git a/specfile/specfile.py b/specfile/specfile.py index 70c8b4d..203231a 100644 --- a/specfile/specfile.py +++ b/specfile/specfile.py @@ -351,9 +351,11 @@ def sources( try: yield Sources( tags, - cast(List[Sourcelist], list(zip(*sourcelists))[1]) - if sourcelists - else [], + ( + cast(List[Sourcelist], list(zip(*sourcelists))[1]) + if sourcelists + else [] + ), allow_duplicates, default_to_implicit_numbering, default_source_number_digits, @@ -390,9 +392,11 @@ def patches( try: yield Patches( tags, - cast(List[Sourcelist], list(zip(*patchlists))[1]) - if patchlists - else [], + ( + cast(List[Sourcelist], list(zip(*patchlists))[1]) + if patchlists + else [] + ), allow_duplicates, default_to_implicit_numbering, default_source_number_digits, diff --git a/specfile/types.py b/specfile/types.py index 5f20ad6..b2fada2 100644 --- a/specfile/types.py +++ b/specfile/types.py @@ -9,5 +9,4 @@ # define our own SupportsIndex type for older version of typing_extensions (EL 8) class SupportsIndex(Protocol, metaclass=abc.ABCMeta): @abc.abstractmethod - def __index__(self) -> int: - ... + def __index__(self) -> int: ...