diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0f8b760e..a88d9c1e 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 diff --git a/specfile/macro_definitions.py b/specfile/macro_definitions.py index 448c1906..68a43167 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 d5c33ff4..a6d7d8cd 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 0bca3e3f..79cdffa0 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 70c8b4da..203231aa 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 5f20ad63..b2fada26 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: ...