def py__simple_getitem__(self, index): if isinstance(index, slice): return ValueSet([self]) with reraise_getitem_errors(IndexError, TypeError): lazy_value = self._lazy_value_list[index] return lazy_value.infer()
def py__simple_getitem__(self, index): with reraise_getitem_errors(IndexError, KeyError, TypeError): access = self.access_handle.py__simple_getitem__(index) if access is None: return NO_VALUES return ValueSet([create_from_access_path(self.inference_state, access)])
def py__simple_getitem__(self, index): """Here the index is an int/str. Raises IndexError/KeyError.""" if isinstance(index, slice): return ValueSet([self]) else: with reraise_getitem_errors(TypeError, KeyError, IndexError): node = self.get_tree_entries()[index] return self._defining_context.infer_node(node)
def py__simple_getitem__(self, index): if isinstance(index, slice): return ValueSet([self]) all_types = list(self.py__iter__()) with reraise_getitem_errors(IndexError, TypeError): lazy_value = all_types[index] return lazy_value.infer()
def py__simple_getitem__(self, index): with reraise_getitem_errors(IndexError, KeyError, TypeError): try: access = self.access_handle.py__simple_getitem__(index) except AttributeError: return super(CompiledValue, self).py__simple_getitem__(index) if access is None: return NO_VALUES return ValueSet([create_from_access_path(self.inference_state, access)])
def py__simple_getitem__(self, index): if is_py3 and self.inference_state.environment.version_info.major == 2: # In Python 2 bytes and unicode compare. if isinstance(index, bytes): index_unicode = force_unicode(index) try: return self._dct[index_unicode].infer() except KeyError: pass elif isinstance(index, str): index_bytes = index.encode('utf-8') try: return self._dct[index_bytes].infer() except KeyError: pass with reraise_getitem_errors(KeyError, TypeError): lazy_value = self._dct[index] return lazy_value.infer()
def py__simple_getitem__(self, index): with reraise_getitem_errors(KeyError, TypeError): lazy_value = self._dct[index] return lazy_value.infer()