diff --git a/pylint/checkers/typecheck.py b/pylint/checkers/typecheck.py index 49abc4a3220..dd1dfd4927b 100644 --- a/pylint/checkers/typecheck.py +++ b/pylint/checkers/typecheck.py @@ -2197,7 +2197,9 @@ def _check_await_outside_coroutine(self, node: nodes.Await) -> None: while not isinstance(node_scope, nodes.Module): if isinstance(node_scope, nodes.AsyncFunctionDef): return - if isinstance(node_scope, nodes.FunctionDef) or isinstance(node_scope, nodes.Lambda): + if isinstance(node_scope, nodes.FunctionDef) or isinstance( + node_scope, nodes.Lambda + ): break node_scope = node_scope.parent.scope() self.add_message("await-outside-async", node=node)