parameters: (self, index)
return_statement: return index
docstring: Process indices with Ellipsis. Returns modified index.
docstring_summary: Process indices with Ellipsis. Returns modified index.
docstring_tokens: Process indices with Ellipsis . Returns modified index .
function: def _check_ellipsis(self, index):
          """Process indices with Ellipsis. Returns modified index."""
          if index is Ellipsis:
              return (slice(None), slice(None))
          elif isinstance(index, tuple):
              # Find first ellipsis
              for j, v in enumerate(index):
                  if v is Ellipsis:
                      first_ellipsis = j
                      break
              else:
                  first_ellipsis = None
  
              # Expand the first one
              if first_ellipsis is not None:
                  # Shortcuts
                  if len(index) == 1:
                      return (slice(None), slice(None))
                  elif len(index) == 2:
                      if first_ellipsis == 0:
                          if index[1] is Ellipsis:
                              return (slice(None), slice(None))
                          else:
                              return (slice(None), index[1])
                      else:
                          return (index[0], slice(None))
  
                  # General case
                  tail = ()
                  for v in index[first_ellipsis+1:]:
                      if v is not Ellipsis:
                          tail = tail + (v,)
                  nd = first_ellipsis + len(tail)
                  nslice = max(0, 2 - nd)
                  return index[:first_ellipsis] + (slice(None),)*nslice + tail
  
          return index
function_tokens: def _check_ellipsis ( self , index ) : if index is Ellipsis : return ( slice ( None ) , slice ( None ) ) elif isinstance ( index , tuple ) : # Find first ellipsis for j , v in enumerate ( index ) : if v is Ellipsis : first_ellipsis = j break else : first_ellipsis = None # Expand the first one if first_ellipsis is not None : # Shortcuts if len ( index ) == 1 : return ( slice ( None ) , slice ( None ) ) elif len ( index ) == 2 : if first_ellipsis == 0 : if index [ 1 ] is Ellipsis : return ( slice ( None ) , slice ( None ) ) else : return ( slice ( None ) , index [ 1 ] ) else : return ( index [ 0 ] , slice ( None ) ) # General case tail = ( ) for v in index [ first_ellipsis + 1 : ] : if v is not Ellipsis : tail = tail + ( v , ) nd = first_ellipsis + len ( tail ) nslice = max ( 0 , 2 - nd ) return index [ : first_ellipsis ] + ( slice ( None ) , ) * nslice + tail return index