MCPcopy Index your code
hub / github.com/pydata/xarray / _updated_key

Method _updated_key

xarray/core/indexing.py:741–754  ·  view source on GitHub ↗
(self, new_key: ExplicitIndexer)

Source from the content-addressed store, hash-verified

739 self._shape = shape
740
741 def _updated_key(self, new_key: ExplicitIndexer) -> BasicIndexer | OuterIndexer:
742 iter_new_key = iter(expanded_indexer(new_key.tuple, self.ndim))
743
744 full_key: list[OuterIndexerType] = []
745 for size, k in zip(self.array.shape, self.key.tuple, strict=True):
746 if isinstance(k, integer_types):
747 full_key.append(k)
748 else:
749 full_key.append(_index_indexer_1d(k, next(iter_new_key), size))
750 full_key_tuple = tuple(full_key)
751
752 if all(isinstance(k, integer_types + (slice,)) for k in full_key_tuple):
753 return BasicIndexer(cast(tuple[BasicIndexerType, ...], full_key_tuple))
754 return OuterIndexer(full_key_tuple)
755
756 @property
757 def shape(self) -> _Shape:

Callers 4

_oindex_getMethod · 0.95
__getitem__Method · 0.95
_oindex_setMethod · 0.95
__setitem__Method · 0.95

Calls 4

expanded_indexerFunction · 0.85
_index_indexer_1dFunction · 0.85
BasicIndexerClass · 0.85
OuterIndexerClass · 0.85

Tested by

no test coverage detected