From 2eba0bdafe0c2b642545338606a5381b87e66405 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 28 Jan 2025 09:57:51 +0100 Subject: [PATCH] [style] Fix typo detected after pre-commit autoupdate (#10202) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.9.2 → v0.9.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.2...v0.9.3) - [github.com/PyCQA/isort: 5.13.2 → 6.0.0](https://github.com/PyCQA/isort/compare/5.13.2...6.0.0) - [github.com/codespell-project/codespell: v2.3.0 → v2.4.0](https://github.com/codespell-project/codespell/compare/v2.3.0...v2.4.0) Co-authored-by: Pierre Sassoulas --- .pre-commit-config.yaml | 6 +++--- pylint/checkers/exceptions.py | 6 +++--- pylint/checkers/variables.py | 6 ++---- pylint/extensions/overlapping_exceptions.py | 8 ++++---- tests/functional/ext/no_self_use/no_self_use.py | 2 +- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bc061d2efa..ea55108ad9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,7 +20,7 @@ repos: doc/data/messages/m/missing-final-newline/bad/crlf.py )$ - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.9.2" + rev: "v0.9.3" hooks: - id: ruff args: ["--fix"] @@ -36,7 +36,7 @@ repos: exclude: tests(/\w*)*/functional/|tests/input|doc/data/messages|examples/|setup.py|tests(/\w*)*data/ types: [python] - repo: https://github.com/PyCQA/isort - rev: 5.13.2 + rev: 6.0.0 hooks: - id: isort exclude: doc/data/messages/ @@ -177,7 +177,7 @@ repos: args: ["-r", "-lll"] exclude: *fixtures - repo: https://github.com/codespell-project/codespell - rev: v2.3.0 + rev: v2.4.0 hooks: - id: codespell args: ["--toml=pyproject.toml"] diff --git a/pylint/checkers/exceptions.py b/pylint/checkers/exceptions.py index 746d9d0c1f..1669e6e5b5 100644 --- a/pylint/checkers/exceptions.py +++ b/pylint/checkers/exceptions.py @@ -612,9 +612,9 @@ def visit_try(self, node: nodes.Try) -> None: continue exc_ancestors = [ - anc - for anc in exception.ancestors() - if isinstance(anc, nodes.ClassDef) + a + for a in exception.ancestors() + if isinstance(a, nodes.ClassDef) ] for previous_exc in exceptions_classes: diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py index 9064bd120c..da357a66d1 100644 --- a/pylint/checkers/variables.py +++ b/pylint/checkers/variables.py @@ -2339,7 +2339,7 @@ def _is_variable_violation( # Otherwise, safe if used after assignment: # (b := 2) and b maybe_before_assign = defnode.value is node or any( - anc is defnode.value for anc in node.node_ancestors() + a is defnode.value for a in node.node_ancestors() ) elif ( isinstance(defframe, nodes.ClassDef) @@ -2463,9 +2463,7 @@ def _is_only_type_assignment( # var: int # if (var := var * var) <-- "var" still undefined isinstance(ref_node.parent, nodes.NamedExpr) - and any( - anc is ref_node.parent.value for anc in node.node_ancestors() - ) + and any(a is ref_node.parent.value for a in node.node_ancestors()) ): return False parent = parent_scope.parent diff --git a/pylint/extensions/overlapping_exceptions.py b/pylint/extensions/overlapping_exceptions.py index 8d35e4ce32..0bb616f315 100644 --- a/pylint/extensions/overlapping_exceptions.py +++ b/pylint/extensions/overlapping_exceptions.py @@ -60,14 +60,14 @@ def visit_try(self, node: nodes.Try) -> None: continue exc_ancestors = [ - anc for anc in exc.ancestors() if isinstance(anc, astroid.ClassDef) + a for a in exc.ancestors() if isinstance(a, astroid.ClassDef) ] for prev_part, prev_exc in handled_in_clause: prev_exc_ancestors = [ - anc - for anc in prev_exc.ancestors() - if isinstance(anc, astroid.ClassDef) + a + for a in prev_exc.ancestors() + if isinstance(a, astroid.ClassDef) ] if exc == prev_exc: self.add_message( diff --git a/tests/functional/ext/no_self_use/no_self_use.py b/tests/functional/ext/no_self_use/no_self_use.py index d362a1d3e7..246feaff20 100644 --- a/tests/functional/ext/no_self_use/no_self_use.py +++ b/tests/functional/ext/no_self_use/no_self_use.py @@ -5,7 +5,7 @@ class Toto: - """bla bal abl""" + """Something inconsequential for the test.""" def __init__(self): self.aaa = 2