parameters: (delta, which)
docstring: r"""
      Generate one of the two sequences that generated a delta.
  
      Given a `delta` produced by `Differ.compare()` or `ndiff()`, extract
      lines originating from file 1 or 2 (parameter `which`), stripping off line
      prefixes.
  
      Examples:
  
      >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1),
      ...              'ore\ntree\nemu\n'.splitlines(1))
      >>> diff = list(diff)
      >>> print ''.join(restore(diff, 1)),
      one
      two
      three
      >>> print ''.join(restore(diff, 2)),
      ore
      tree
      emu
docstring_summary: r"""
      Generate one of the two sequences that generated a delta.
docstring_tokens: r Generate one of the two sequences that generated a delta .
function: def restore(delta, which):
      r"""
      Generate one of the two sequences that generated a delta.
  
      Given a `delta` produced by `Differ.compare()` or `ndiff()`, extract
      lines originating from file 1 or 2 (parameter `which`), stripping off line
      prefixes.
  
      Examples:
  
      >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1),
      ...              'ore\ntree\nemu\n'.splitlines(1))
      >>> diff = list(diff)
      >>> print ''.join(restore(diff, 1)),
      one
      two
      three
      >>> print ''.join(restore(diff, 2)),
      ore
      tree
      emu
      """
      try:
          tag = {1: "- ", 2: "+ "}[int(which)]
      except KeyError:
          raise ValueError, ('unknown delta choice (must be 1 or 2): %r'
                             % which)
      prefixes = ("  ", tag)
      for line in delta:
          if line[:2] in prefixes:
              yield line[2:]
function_tokens: def restore ( delta , which ) : try : tag = { 1 : "- " , 2 : "+ " } [ int ( which ) ] except KeyError : raise ValueError , ( 'unknown delta choice (must be 1 or 2): %r' % which ) prefixes = ( "  " , tag ) for line in delta : if line [ : 2 ] in prefixes : yield line [ 2 : ]