Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#474)
Browse files Browse the repository at this point in the history
<!--pre-commit.ci start-->
updates:
- [github.com/pre-commit/mirrors-mypy: v1.10.1 →
v1.11.0](pre-commit/mirrors-mypy@v1.10.1...v1.11.0)
<!--pre-commit.ci end-->

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Adam Johnson <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and adamchainz authored Jul 23, 2024
1 parent 74b2c2e commit a2dc761
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ repos:
- flake8-logging
- flake8-tidy-imports
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.1
rev: v1.11.0
hooks:
- id: mypy
additional_dependencies:
Expand Down
2 changes: 1 addition & 1 deletion src/django_upgrade/fixers/admin_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def store_value_src(
tokens: list[Token],
i: int,
*,
node: ast.AST,
node: ast.expr,
name: str,
funcdetails: FunctionDetails,
) -> None:
Expand Down
2 changes: 1 addition & 1 deletion src/django_upgrade/fixers/admin_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def visit_Call(


def remove_register(
tokens: list[Token], i: int, *, name: str, state: State, node: ast.AST
tokens: list[Token], i: int, *, name: str, state: State, node: ast.Expr
) -> None:
admin_details = decorable_admins.get(state, {})[name]
if admin_details is None:
Expand Down
12 changes: 9 additions & 3 deletions src/django_upgrade/tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ def reverse_consume(
return i


def find_first_token(tokens: list[Token], i: int, *, node: ast.AST) -> int:
def find_first_token(
tokens: list[Token], i: int, *, node: ast.expr | ast.keyword | ast.stmt
) -> int:
"""
Find the first token corresponding to the given ast node.
"""
Expand All @@ -77,7 +79,9 @@ def find_first_token(tokens: list[Token], i: int, *, node: ast.AST) -> int:
return i


def find_last_token(tokens: list[Token], i: int, *, node: ast.AST) -> int:
def find_last_token(
tokens: list[Token], i: int, *, node: ast.expr | ast.keyword | ast.stmt
) -> int:
"""
Find the last token corresponding to the given ast node.
"""
Expand Down Expand Up @@ -327,7 +331,9 @@ def replace(tokens: list[Token], i: int, *, src: str) -> None:
tokens[i] = tokens[i]._replace(name=CODE, src=src)


def erase_node(tokens: list[Token], i: int, *, node: ast.AST) -> None:
def erase_node(
tokens: list[Token], i: int, *, node: ast.expr | ast.keyword | ast.stmt
) -> None:
"""
Erase all tokens corresponding to the given ast node.
"""
Expand Down

0 comments on commit a2dc761

Please sign in to comment.