Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #347

Merged
merged 2 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 9 additions & 5 deletions specfile/macro_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "",
Expand Down
24 changes: 15 additions & 9 deletions specfile/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
)
Expand Down Expand Up @@ -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,
)
)
Expand Down Expand Up @@ -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,
)
)
Expand Down
3 changes: 1 addition & 2 deletions specfile/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def location(self) -> str:
...

@location.setter
def location(self, value: str) -> None:
...
def location(self, value: str) -> None: ...

@property
@abstractmethod
Expand Down
16 changes: 10 additions & 6 deletions specfile/specfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions specfile/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...