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 /pylint/checkers/async.py | |
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 'pylint/checkers/async.py')
-rw-r--r-- | pylint/checkers/async.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pylint/checkers/async.py b/pylint/checkers/async.py index a6831b394..939678d3e 100644 --- a/pylint/checkers/async.py +++ b/pylint/checkers/async.py @@ -46,7 +46,7 @@ class AsyncChecker(checkers.BaseChecker): self._async_generators = ["contextlib.asynccontextmanager"] @checker_utils.check_messages("yield-inside-async-function") - def visit_asyncfunctiondef(self, node): + def visit_asyncfunctiondef(self, node: nodes.AsyncFunctionDef) -> None: for child in node.nodes_of_class(nodes.Yield): if child.scope() is node and ( sys.version_info[:2] == (3, 5) or isinstance(child, nodes.YieldFrom) @@ -54,7 +54,7 @@ class AsyncChecker(checkers.BaseChecker): self.add_message("yield-inside-async-function", node=child) @checker_utils.check_messages("not-async-context-manager") - def visit_asyncwith(self, node): + def visit_asyncwith(self, node: nodes.AsyncWith) -> None: for ctx_mgr, _ in node.items: inferred = checker_utils.safe_infer(ctx_mgr) if inferred is None or inferred is astroid.Uninferable: |