From 4db71ec2907a17a916101d743c0dcea66ffb4251 Mon Sep 17 00:00:00 2001 From: Louis Maddox Date: Thu, 23 Mar 2023 22:37:10 +0000 Subject: [PATCH 1/3] [BUGFIX] Alter Checker.handleNodeLoad() signature to accomodate pyflakes PR 745 (introduced a parent arg) --- src/mvdef/core/check.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mvdef/core/check.py b/src/mvdef/core/check.py index 2a81626..28ae50c 100644 --- a/src/mvdef/core/check.py +++ b/src/mvdef/core/check.py @@ -115,7 +115,7 @@ def unused_imports(self) -> list[UnusedImport]: imps = [m for m in self.messages if isinstance(m, UnusedImport)] return imps - def handleNodeLoad(self, node): + def handleNodeLoad(self, node, parent=None): used_set = [] # Note: not used, but would help if re-assignment is an issue # https://github.com/PyCQA/pyflakes/blob/ # 853cce91634cbddff01cc16313b5467be1e95c54/pyflakes/checker.py#L1073-L1094 @@ -134,7 +134,7 @@ def handleNodeLoad(self, node): continue binding = scope.get(name, None) if isinstance(binding, Annotation) and not self._in_postponed_annotation: - scope[name].used = True + scope[name].used = (self.scope, node) continue if name == "print" and isinstance(binding, Builtin): parent = self.getParent(node) From da1cc584fb82a77c87adeabb70faa3f936e7a111 Mon Sep 17 00:00:00 2001 From: Louis Maddox Date: Thu, 23 Mar 2023 22:52:40 +0000 Subject: [PATCH 2/3] Update the pre-commit hook to run correctly --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ec3b238..47da882 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,8 +13,8 @@ repos: - id: isort additional_dependencies: [toml] - - repo: https://gitlab.com/pycqa/flake8 - rev: 4.0.1 + - repo: https://github.com/pycqa/flake8 + rev: 6.0.0 hooks: - id: flake8 args: ["--max-line-length=88", "--extend-ignore=E203,E501"] From 0b8d4bd2884b67e1f90b5363f6c65588c5251794 Mon Sep 17 00:00:00 2001 From: Louis Maddox Date: Thu, 23 Mar 2023 23:00:13 +0000 Subject: [PATCH 3/3] Update isort version --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 47da882..96d65ed 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ repos: - id: black - repo: https://github.com/PyCQA/isort - rev: 5.9.2 + rev: 5.11.5 hooks: - id: isort additional_dependencies: [toml]