Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 13, 2024
1 parent 4cee096 commit 0e30b5e
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 24 deletions.
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: ...

0 comments on commit 0e30b5e

Please sign in to comment.