(self, key)
return new_key
Convert a (possibly named) indexing expression to a valid numpy index.
Convert a (possibly named) indexing expression to a valid numpy index.
Convert a ( possibly named ) indexing expression to a valid numpy index .
def _convert_key(self, key):
    """Convert a (possibly named) indexing expression to a valid numpy index."""
    return_tuple = isinstance(key, tuple)
    if not return_tuple:
      key = (key,)
    if len(key) > self._field.ndim:
      raise IndexError('Index tuple has {} elements, but array has only {} '
                       'dimensions.'.format(len(key), self._field.ndim))
    new_key = tuple(axis.convert_key_item(key_item)
                    for axis, key_item in zip(self._axes, key))
    if not return_tuple:
      new_key = new_key[0]
    return new_key
def _convert_key ( self , key ) : return_tuple = isinstance ( key , tuple ) if not return_tuple : key = ( key , ) if len ( key ) > self . _field . ndim : raise IndexError ( 'Index tuple has {} elements, but array has only {} ' 'dimensions.' . format ( len ( key ) , self . _field . ndim ) ) new_key = tuple ( axis . convert_key_item ( key_item ) for axis , key_item in zip ( self . _axes , key ) ) if not return_tuple : new_key = new_key [ 0 ] return new_key