diff options
author | Daniel van Noord <13665637+DanielNoord@users.noreply.github.com> | 2023-03-06 08:56:07 +0100 |
---|---|---|
committer | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2023-03-07 21:53:22 +0100 |
commit | b4fe93a9f8059efb0b462d879da3c3d8ef9e7010 (patch) | |
tree | 0d9d14d714a00b961ebebc29fa95d42fb1b1af4a /pylint/checkers/refactoring/refactoring_checker.py | |
parent | 9c4fbedb368d87c383f86ece309a2473e6b1e68a (diff) | |
download | pylint-git-b4fe93a9f8059efb0b462d879da3c3d8ef9e7010.tar.gz |
Use UninferableBase instead of Uninferable
Diffstat (limited to 'pylint/checkers/refactoring/refactoring_checker.py')
-rw-r--r-- | pylint/checkers/refactoring/refactoring_checker.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/pylint/checkers/refactoring/refactoring_checker.py b/pylint/checkers/refactoring/refactoring_checker.py index b3e48f31e..26877ccdb 100644 --- a/pylint/checkers/refactoring/refactoring_checker.py +++ b/pylint/checkers/refactoring/refactoring_checker.py @@ -16,7 +16,7 @@ from typing import TYPE_CHECKING, Any, NamedTuple, Union, cast import astroid from astroid import bases, nodes -from astroid.util import Uninferable +from astroid.util import UninferableBase from pylint import checkers from pylint.checkers import utils @@ -1542,7 +1542,9 @@ class RefactoringChecker(checkers.BaseTokenChecker): return inferred_truth_value = utils.safe_infer(truth_value, compare_constants=True) - if inferred_truth_value is None or inferred_truth_value == astroid.Uninferable: + if inferred_truth_value is None or isinstance( + inferred_truth_value, UninferableBase + ): return truth_boolean_value = inferred_truth_value.bool_value() @@ -1569,7 +1571,7 @@ class RefactoringChecker(checkers.BaseTokenChecker): else: assignees = [node.targets[0]] values = [node.value] - if Uninferable in (assignees, values): + if any(isinstance(n, UninferableBase) for n in (assignees, values)): return for assignee, value in zip(assignees, values): if not isinstance(value, nodes.Call): @@ -1921,7 +1923,11 @@ class RefactoringChecker(checkers.BaseTokenChecker): # to infer it. return True exc = utils.safe_infer(node.exc) - if exc is None or exc is astroid.Uninferable or not hasattr(exc, "pytype"): + if ( + exc is None + or isinstance(exc, UninferableBase) + or not hasattr(exc, "pytype") + ): return False exc_name = exc.pytype().split(".")[-1] handlers = utils.get_exception_handlers(node, exc_name) |