diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-12-21 23:44:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-21 23:44:51 +0100 |
commit | c0fbbb7adbc39cbd67bbd0e0b1ca4e9421c12643 (patch) | |
tree | 45cc2ffa41daec92ecd13bbd4edc5c0bd9872bd5 /pylint/extensions/_check_docs_utils.py | |
parent | 29bf25c1e4e93477cc4cf7e1250b007e4a8b07e6 (diff) | |
download | pylint-git-c0fbbb7adbc39cbd67bbd0e0b1ca4e9421c12643.tar.gz |
Fix typos accross the whole codebase (#5575)
Co-authored-by: Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>
Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
Diffstat (limited to 'pylint/extensions/_check_docs_utils.py')
-rw-r--r-- | pylint/extensions/_check_docs_utils.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/pylint/extensions/_check_docs_utils.py b/pylint/extensions/_check_docs_utils.py index ad4a5bb32..611a04aa2 100644 --- a/pylint/extensions/_check_docs_utils.py +++ b/pylint/extensions/_check_docs_utils.py @@ -122,7 +122,7 @@ def _split_multiple_exc_types(target: str) -> List[str]: def possible_exc_types(node: nodes.NodeNG) -> Set[nodes.ClassDef]: """ - Gets all of the possible raised exception types for the given raise node. + Gets all the possible raised exception types for the given raise node. .. note:: @@ -133,11 +133,11 @@ def possible_exc_types(node: nodes.NodeNG) -> Set[nodes.ClassDef]: :returns: A list of exception types possibly raised by :param:`node`. """ - excs = [] + exceptions = [] if isinstance(node.exc, nodes.Name): inferred = utils.safe_infer(node.exc) if inferred: - excs = [inferred] + exceptions = [inferred] elif node.exc is None: handler = node.parent while handler and not isinstance(handler, nodes.ExceptHandler): @@ -145,15 +145,15 @@ def possible_exc_types(node: nodes.NodeNG) -> Set[nodes.ClassDef]: if handler and handler.type: try: - for exc in astroid.unpack_infer(handler.type): - if exc is not astroid.Uninferable: - excs.append(exc) + for exception in astroid.unpack_infer(handler.type): + if exception is not astroid.Uninferable: + exceptions.append(exception) except astroid.InferenceError: pass else: target = _get_raise_target(node) if isinstance(target, nodes.ClassDef): - excs = [target] + exceptions = [target] elif isinstance(target, nodes.FunctionDef): for ret in target.nodes_of_class(nodes.Return): if ret.frame() != target: @@ -163,12 +163,16 @@ def possible_exc_types(node: nodes.NodeNG) -> Set[nodes.ClassDef]: val = utils.safe_infer(ret.value) if val and utils.inherit_from_std_ex(val): if isinstance(val, nodes.ClassDef): - excs.append(val) + exceptions.append(val) elif isinstance(val, astroid.Instance): - excs.append(val.getattr("__class__")[0]) + exceptions.append(val.getattr("__class__")[0]) try: - return {exc for exc in excs if not utils.node_ignores_exception(node, exc.name)} + return { + exc + for exc in exceptions + if not utils.node_ignores_exception(node, exc.name) + } except astroid.InferenceError: return set() |