diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2018-10-10 12:01:23 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2018-10-10 12:01:23 +0200 |
commit | 934f0ed0302b93044d67eb2e1ac9a3ae76d499a8 (patch) | |
tree | 06557b27b490341c19f7fbb134b750554a3ed38d /astroid/inference.py | |
parent | 8174c042e2639d704b86d2333a520e160ebe5058 (diff) | |
download | astroid-git-934f0ed0302b93044d67eb2e1ac9a3ae76d499a8.tar.gz |
Replace checks against None and Uninferable to boolean checks
Uninferable acts as None so that should be enough.
Diffstat (limited to 'astroid/inference.py')
-rw-r--r-- | astroid/inference.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/astroid/inference.py b/astroid/inference.py index 7352ff3a..221fb062 100644 --- a/astroid/inference.py +++ b/astroid/inference.py @@ -66,7 +66,7 @@ def _infer_sequence_helper(node, context=None): for elt in node.elts: if isinstance(elt, nodes.Starred): starred = helpers.safe_infer(elt.value, context) - if starred in (None, util.Uninferable): + if not starred: raise exceptions.InferenceError(node=node, context=context) if not hasattr(starred, "elts"): raise exceptions.InferenceError(node=node, context=context) @@ -135,7 +135,7 @@ def _infer_map(node, context): for name, value in node.items: if isinstance(name, nodes.DictUnpack): double_starred = helpers.safe_infer(value, context) - if double_starred in (None, util.Uninferable): + if not double_starred: raise exceptions.InferenceError if not isinstance(double_starred, nodes.Dict): raise exceptions.InferenceError(node=node, context=context) @@ -144,7 +144,7 @@ def _infer_map(node, context): else: key = helpers.safe_infer(name, context=context) value = helpers.safe_infer(value, context=context) - if any(elem in (None, util.Uninferable) for elem in (key, value)): + if any(not elem for elem in (key, value)): raise exceptions.InferenceError(node=node, context=context) values = _update_with_replacement(values, {key: value}) return values |