diff options
author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2021-09-03 13:47:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-03 13:47:23 +0200 |
commit | baaa81a2994cdd517fbde8693b0a4b0a67f5a4e3 (patch) | |
tree | c8b26e345fb3c7377a6c8e3a2b7afca28e1806e5 /tests/functional | |
parent | 0981d8bec52f0917168e0e89947fe164f58be683 (diff) | |
download | pylint-git-baaa81a2994cdd517fbde8693b0a4b0a67f5a4e3.tar.gz |
Refactor various typing related issues (#4940)
* Add type annotations to ``visit`` & ``leave`` calls
This adds typing to most calls that visit nodes. All other changes are
due to mypy errors resulting from introduction of typing.
* Fix outstanding mypy issues
This removes some of the `type: ignore` comments in favour of
solving the mypy issues these comments were surpressing.
* Fix remaining references to node_classes
Except for two references to node_classes in the changelog this should be the last of them
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Diffstat (limited to 'tests/functional')
-rw-r--r-- | tests/functional/g/generated_members.py | 4 | ||||
-rw-r--r-- | tests/functional/g/generated_members.rc | 2 | ||||
-rw-r--r-- | tests/functional/u/unused/unused_variable.py | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/tests/functional/g/generated_members.py b/tests/functional/g/generated_members.py index b79c008dd..2b3a2b07d 100644 --- a/tests/functional/g/generated_members.py +++ b/tests/functional/g/generated_members.py @@ -1,7 +1,7 @@ """Test the generated-members config option.""" # pylint: disable=pointless-statement, invalid-name, useless-object-inheritance from __future__ import print_function -from astroid import node_classes +from astroid import nodes from pylint import checkers class Klass(object): @@ -11,7 +11,7 @@ print(Klass().DoesNotExist) print(Klass().aBC_set1) print(Klass().ham.does.not_.exist) print(Klass().spam.does.not_.exist) # [no-member] -node_classes.Tuple.does.not_.exist +nodes.Tuple.does.not_.exist checkers.base.doesnotexist() session = Klass() diff --git a/tests/functional/g/generated_members.rc b/tests/functional/g/generated_members.rc index 31b87ffd0..5f8f9cd0f 100644 --- a/tests/functional/g/generated_members.rc +++ b/tests/functional/g/generated_members.rc @@ -6,6 +6,6 @@ generated-members= \Afunctional\.g\.generated_members\.Klass\.ham\Z, DoesNotExist, "[a-zA-Z]+_set{1,2}", - node_classes.Tuple.*, + nodes.Tuple.*, checkers.*?base, (session|SESSION).rollback diff --git a/tests/functional/u/unused/unused_variable.py b/tests/functional/u/unused/unused_variable.py index 8e164acd1..84ca8c50f 100644 --- a/tests/functional/u/unused/unused_variable.py +++ b/tests/functional/u/unused/unused_variable.py @@ -79,8 +79,8 @@ def function(matches): index += 1 print(match) - -def visit_if(self, node): +from astroid import nodes +def visit_if(self, node: nodes.If) -> None: """increments the branches counter""" branches = 1 # don't double count If nodes coming from some 'elif' |