original_docstring: Return an index or slice of the History list,
  
          :param span: string containing an index or a slice
          :return: a list of HistoryItems
  
          This method can accommodate input in any of these forms:
  
              a
              -a
              a..b or a:b
              a.. or a:
              ..a or :a
              -a.. or -a:
              ..-a or :-a
  
          Different from native python indexing and slicing of arrays, this method
          uses 1-based array numbering. Users who are not programmers can't grok
          0 based numbering. Programmers can usually grok either. Which reminds me,
          there are only two hard problems in programming:
  
          - naming
          - cache invalidation
          - off by one errors
  
          
docstring: Return an index or slice of the History list.
docstring_tokens: Return an index or slice of the History list .
code: def span(self, span: str) -> List[HistoryItem]:
          """Return an index or slice of the History list,
  
          :param span: string containing an index or a slice
          :return: a list of HistoryItems
  
          This method can accommodate input in any of these forms:
  
              a
              -a
              a..b or a:b
              a.. or a:
              ..a or :a
              -a.. or -a:
              ..-a or :-a
  
          Different from native python indexing and slicing of arrays, this method
          uses 1-based array numbering. Users who are not programmers can't grok
          0 based numbering. Programmers can usually grok either. Which reminds me,
          there are only two hard problems in programming:
  
          - naming
          - cache invalidation
          - off by one errors
  
          """
          if span.lower() in ('*', '-', 'all'):
              span = ':'
          results = self.spanpattern.search(span)
          if not results:
              # our regex doesn't match the input, bail out
              raise ValueError('History indices must be positive or negative integers, and may not be zero.')
  
          sep = results.group('separator')
          start = results.group('start')
          if start:
              start = self._zero_based_index(start)
          end = results.group('end')
          if end:
              end = int(end)
              # modify end so it's inclusive of the last element
              if end == -1:
                  # -1 as the end means include the last command in the array, which in pythonic
                  # terms means to not provide an ending index. If you put -1 as the ending index
                  # python excludes the last item in the list.
                  end = None
              elif end < -1:
                  # if the ending is smaller than -1, make it one larger so it includes
                  # the element (python native indices exclude the last referenced element)
                  end += 1
  
          if start is not None and end is not None:
              # we have both start and end, return a slice of history
              result = self[start:end]
          elif start is not None and sep is not None:
              # take a slice of the array
              result = self[start:]
          elif end is not None and sep is not None:
              result = self[:end]
          elif start is not None:
              # there was no separator so it's either a posative or negative integer
              result = [self[start]]
          else:
              # we just have a separator, return the whole list
              result = self[:]
          return result
code_tokens: def span ( self , span : str ) -> List [ HistoryItem ] : if span . lower ( ) in ( '*' , '-' , 'all' ) : span = ':' results = self . spanpattern . search ( span ) if not results : raise ValueError ( 'History indices must be positive or negative integers, and may not be zero.' ) sep = results . group ( 'separator' ) start = results . group ( 'start' ) if start : start = self . _zero_based_index ( start ) end = results . group ( 'end' ) if end : end = int ( end ) if end == - 1 : end = None elif end < - 1 : end += 1 if start is not None and end is not None : result = self [ start : end ] elif start is not None and sep is not None : result = self [ start : ] elif end is not None and sep is not None : result = self [ : end ] elif start is not None : result = [ self [ start ] ] else : result = self [ : ] return result
short_docstring: Return an index or slice of the History list,
short_docstring_tokens: Return an index or slice of the History list
comment: """Return an index or slice of the History list,
  
          :param span: string containing an index or a slice
          :return: a list of HistoryItems
  
          This method can accommodate input in any of these forms:
  
              a
              -a
              a..b or a:b
              a.. or a:
              ..a or :a
              -a.. or -a:
              ..-a or :-a
  
          Different from native python indexing and slicing of arrays, this method
          uses 1-based array numbering. Users who are not programmers can't grok
          0 based numbering. Programmers can usually grok either. Which reminds me,
          there are only two hard problems in programming:
  
          - naming
          - cache invalidation
          - off by one errors
  
          """$SEP$# our regex doesn't match the input, bail out$SEP$# modify end so it's inclusive of the last element$SEP$# -1 as the end means include the last command in the array, which in pythonic$SEP$# terms means to not provide an ending index. If you put -1 as the ending index$SEP$# python excludes the last item in the list.$SEP$# if the ending is smaller than -1, make it one larger so it includes$SEP$# the element (python native indices exclude the last referenced element)$SEP$# we have both start and end, return a slice of history$SEP$# take a slice of the array$SEP$# there was no separator so it's either a posative or negative integer$SEP$# we just have a separator, return the whole list