parameters: (self)
docstring: Generate key-to-(start, stop) table of contents.
docstring_summary: Generate key-to-(start, stop) table of contents.
docstring_tokens: Generate key - to - ( start stop ) table of contents .
function: def _generate_toc(self):
          """Generate key-to-(start, stop) table of contents."""
          starts, stops = [], []
          last_was_empty = False
          self._file.seek(0)
          while True:
              line_pos = self._file.tell()
              line = self._file.readline()
              if line.startswith(b'From '):
                  if len(stops) < len(starts):
                      if last_was_empty:
                          stops.append(line_pos - len(linesep))
                      else:
                          # The last line before the "From " line wasn't
                          # blank, but we consider it a start of a
                          # message anyway.
                          stops.append(line_pos)
                  starts.append(line_pos)
                  last_was_empty = False
              elif not line:
                  if last_was_empty:
                      stops.append(line_pos - len(linesep))
                  else:
                      stops.append(line_pos)
                  break
              elif line == linesep:
                  last_was_empty = True
              else:
                  last_was_empty = False
          self._toc = dict(enumerate(zip(starts, stops)))
          self._next_key = len(self._toc)
          self._file_length = self._file.tell()
function_tokens: def _generate_toc ( self ) : starts , stops = [ ] , [ ] last_was_empty = False self . _file . seek ( 0 ) while True : line_pos = self . _file . tell ( ) line = self . _file . readline ( ) if line . startswith ( b'From ' ) : if len ( stops ) < len ( starts ) : if last_was_empty : stops . append ( line_pos - len ( linesep ) ) else : # The last line before the "From " line wasn't # blank, but we consider it a start of a # message anyway. stops . append ( line_pos ) starts . append ( line_pos ) last_was_empty = False elif not line : if last_was_empty : stops . append ( line_pos - len ( linesep ) ) else : stops . append ( line_pos ) break elif line == linesep : last_was_empty = True else : last_was_empty = False self . _toc = dict ( enumerate ( zip ( starts , stops ) ) ) self . _next_key = len ( self . _toc ) self . _file_length = self . _file . tell ( )