diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-12-20 15:36:02 +0100 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-12-20 15:42:42 +0100 |
commit | 484e0270e22de68abdc3b86eef5ca9bcae9fe81a (patch) | |
tree | 0aba34306ac2bdc457cbdb04feb7367b581f4e67 | |
parent | 794d7d2866a4dcc45453ab5bb12476c0817ab60c (diff) | |
download | pylint-git-484e0270e22de68abdc3b86eef5ca9bcae9fe81a.tar.gz |
Fix the typing for BroadTryClause.visit_tryexcept
We're calling it from visit_tryfinally it's not strictly the expected
for the visitor pattern
-rw-r--r-- | pylint/extensions/broad_try_clause.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pylint/extensions/broad_try_clause.py b/pylint/extensions/broad_try_clause.py index 4ccdf258d..b460850c2 100644 --- a/pylint/extensions/broad_try_clause.py +++ b/pylint/extensions/broad_try_clause.py @@ -10,6 +10,7 @@ # For details: https://github.com/PyCQA/pylint/blob/main/LICENSE """Looks for try/except statements with too much code in the try clause.""" +from typing import Union from astroid import nodes @@ -59,7 +60,7 @@ class BroadTryClauseChecker(checkers.BaseChecker): return statement_count - def visit_tryexcept(self, node: nodes.TryExcept) -> None: + def visit_tryexcept(self, node: Union[nodes.TryExcept, nodes.TryFinally]) -> None: try_clause_statements = self._count_statements(node) if try_clause_statements > self.config.max_try_statements: msg = f"try clause contains {try_clause_statements} statements, expected at most {self.config.max_try_statements}" |