diff options
| -rw-r--r-- | astroid/inference.py | 12 | ||||
| -rw-r--r-- | astroid/scoped_nodes.py | 19 | ||||
| -rw-r--r-- | pylintrc | 1 |
3 files changed, 16 insertions, 16 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) diff --git a/astroid/scoped_nodes.py b/astroid/scoped_nodes.py index 440984e4..ad727b13 100644 --- a/astroid/scoped_nodes.py +++ b/astroid/scoped_nodes.py @@ -2486,17 +2486,16 @@ class ClassDef(mixins.FilterStmtsMixin, LocalsDictNodeNG, node_classes.Statement yield from function.infer_call_result( caller=self, context=context ) + # If we have a metaclass, we're accessing this attribute through + # the class itself, which means we can solve the property + elif metaclass: + # Resolve a property as long as it is not accessed through + # the class itself. + yield from function.infer_call_result( + caller=self, context=context + ) else: - # If we have a metaclass, we're accessing this attribute through - # the class itself, which means we can solve the property - if metaclass: - # Resolve a property as long as it is not accessed through - # the class itself. - yield from function.infer_call_result( - caller=self, context=context - ) - else: - yield inferred + yield inferred else: yield function_to_method(inferred, self) except exceptions.AttributeInferenceError as error: @@ -23,6 +23,7 @@ persistent=yes # usually to register additional checkers. load-plugins= + pylint.extensions.check_elif, # Use multiple processes to speed up Pylint. jobs=1 |
