@decorators.raise_if_nothing_inferred<EOL>def infer_subscript(self, context=None):
found_one = False<EOL>for value in self.value.infer(context):<EOL><INDENT>if value is util.Uninferable:<EOL><INDENT>yield util.Uninferable<EOL>return None<EOL><DEDENT>for index in self.slice.infer(context):<EOL><INDENT>if index is util.Uninferable:<EOL><INDENT>yield util.Uninferable<EOL>return None<EOL><DEDENT>index_value = _SUBSCRIPT_SENTINEL<EOL>if value.__class__ == bases.Instance:<EOL><INDENT>index_value = index<EOL><DEDENT>else:<EOL><INDENT>if index.__class__ == bases.Instance:<EOL><INDENT>instance_as_index = helpers.class_instance_as_index(index)<EOL>if instance_as_index:<EOL><INDENT>index_value = instance_as_index<EOL><DEDENT><DEDENT>else:<EOL><INDENT>index_value = index<EOL><DEDENT><DEDENT>if index_value is _SUBSCRIPT_SENTINEL:<EOL><INDENT>raise exceptions.InferenceError(node=self, context=context)<EOL><DEDENT>try:<EOL><INDENT>assigned = value.getitem(index_value, context)<EOL><DEDENT>except (<EOL>exceptions.AstroidTypeError,<EOL>exceptions.AstroidIndexError,<EOL>exceptions.AttributeInferenceError,<EOL>AttributeError,<EOL>) as exc:<EOL><INDENT>raise exceptions.InferenceError(node=self, context=context) from exc<EOL><DEDENT>if self is assigned or assigned is util.Uninferable:<EOL><INDENT>yield util.Uninferable<EOL>return None<EOL><DEDENT>yield from assigned.infer(context)<EOL>found_one = True<EOL><DEDENT><DEDENT>if found_one:<EOL><INDENT>return dict(node=self, context=context)<EOL><DEDENT>return None<EOL>
Inference for subscripts

    We're understanding if the index is a Const
    or a slice, passing the result of inference
    to the value's `getitem` method, which should
    handle each supported index type accordingly.