Skip to content

Commit fa1f728

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent afa3f79 commit fa1f728

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

flake8_async/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# several different ones are used for the same code. Used in e.g. Visitor103
1414
def strip_error_subidentifier(s: str) -> str:
1515
"""Turn e.g. ASYNC103_anyio_trio => ASYNC103."""
16-
return s.split("_")[0]
16+
return s.split("_", maxsplit=1)[0]
1717

1818

1919
def error_has_subidentifier(s: str) -> bool:

flake8_async/visitors/flake8asyncvisitor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def walk(self, *body: ast.AST) -> Iterable[ast.AST]:
144144

145145
@property
146146
def library(self) -> tuple[str, ...]:
147-
return self.__state.library if self.__state.library else ("trio",)
147+
return self.__state.library or ("trio",)
148148

149149
@property
150150
def library_str(self) -> str:
@@ -253,7 +253,7 @@ def should_autofix(self, node: cst.CSTNode, code: str | None = None) -> bool:
253253

254254
@property
255255
def library(self) -> tuple[str, ...]:
256-
return self.__state.library if self.__state.library else ("trio",)
256+
return self.__state.library or ("trio",)
257257

258258
# library_str not used in cst yet
259259

flake8_async/visitors/visitor91x.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ def __init__(
344344

345345
@property
346346
def library(self) -> tuple[str, ...]:
347-
return self.__library if self.__library else ("trio",)
347+
return self.__library or ("trio",)
348348

349349
def should_autofix(self, node: cst.CSTNode, code: str | None = None) -> bool:
350350
return not self.noautofix

tests/test_flake8_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def _parse_eval_file(
395395
) -> tuple[list[Error], list[str], str]:
396396
# version check
397397
check_version(test)
398-
test = test.split("_")[0]
398+
test = test.split("_", maxsplit=1)[0]
399399

400400
parsed_args = []
401401

0 commit comments

Comments
 (0)