diff options
author | Nick Drozd <nicholasdrozd@gmail.com> | 2019-12-23 12:28:52 -0600 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2019-12-24 10:08:53 +0100 |
commit | bc4dd3db4065007fc3e1ca3fb64349a61f584005 (patch) | |
tree | 4267f4d5cbda3a38ceea393b603567af5580e62f /astroid/inference.py | |
parent | 3d74305efdbc6aa58784a0222e4a1eef6a33e2fa (diff) | |
download | astroid-git-bc4dd3db4065007fc3e1ca3fb64349a61f584005.tar.gz |
Enable else-if-used extension
Diffstat (limited to 'astroid/inference.py')
-rw-r--r-- | astroid/inference.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/astroid/inference.py b/astroid/inference.py index bfd94b92..a563287d 100644 --- a/astroid/inference.py +++ b/astroid/inference.py @@ -372,13 +372,13 @@ def infer_subscript(self, context=None): index_value = _SUBSCRIPT_SENTINEL if value.__class__ == bases.Instance: index_value = index + elif index.__class__ == bases.Instance: + instance_as_index = helpers.class_instance_as_index(index) + if instance_as_index: + index_value = instance_as_index else: - if index.__class__ == bases.Instance: - instance_as_index = helpers.class_instance_as_index(index) - if instance_as_index: - index_value = instance_as_index - else: - index_value = index + index_value = index + if index_value is _SUBSCRIPT_SENTINEL: raise exceptions.InferenceError(node=self, context=context) |