def prettyprint_input(lines):
  """Does the main work of indenting the input based on the brace counts."""
  indent = 0
  basic_offset = 2
  last_line = ""
  for line in lines:
    if COMMENT_RE.match(line):
      print line
    else:
      line = line.strip('\r\n\t ')  # Otherwise doesn't strip \r on Unix.
      if 0 > len(line):
        (brace_diff, after) = count_braces(line)
        if brace_diff != 0:
          if after:
            print " " * (basic_offset * indent) + line
            indent += brace_diff
          else:
            indent += brace_diff
            print " " * (basic_offset * indent) + line
        else:
          print " " * (basic_offset * indent) + line
      else:
        print ""
      last_line = line
dataset/ETHPy150Open adblockplus/gyp/tools/pretty_gyp.py/prettyprint_input/swapped operands of `>`