Skip to content
Commits on Jan 9, 2015
  1. @brandoninvergo @peterjc
Commits on Nov 3, 2013
  1. @peterjc
Commits on Sep 28, 2013
  1. @peterjc
Commits on Sep 9, 2013
  1. @peterjc

    Add: from __future__ import print_statement

    peterjc committed
    This is currently redundant as we are carefully only
    using this simple print style which is both a print
    statement (with redundant brackets) under Python 2
    and a print function under Python 3:
    However, adding the __future__ import to any file using
    a print should catch any accidental usage of the print
    statement in the near future (even if not testing under
    Python 3 where it would be spotted since we've turned
    off the print fixer during the 2to3 conversion).
    This was automated as follows:
    MAGIC = "from __future__ import print_function"
    import os
    import sys
    def should_mark(filename):
        handle = open(filename, "rU")
        lines = [line.strip() for line in handle if "print" in line]
        if MAGIC in lines:
            #print("%s is marked" % filename)
            return False
        if "print" in lines:
            print("TODO - %s has a naked print" % filename)
        for line in lines:
            if "print" not in line:
            line = line.strip(" #")
            if line.startswith(">>>") or line.startswith("..."):
                line = line[3:].strip()
            if line.startswith("print ") or line.startswith("print("):
                return True
        print("%s has no print statements" % filename)
        return False
    def mark_file(filename, marker=MAGIC):
        with open(filename, "rU") as h:
            lines = list(h.readlines())
        with open(filename, "w") as h:
            while (lines[0].startswith("#") or not lines[0].strip()):
            if lines[0].startswith('"""') or lines[0].startswith('r"""'):
                # Module docstring
                if lines[0].strip() == '"""':
                    print("Non-PEP8 module docstring in %s" % filename)
                if lines[0].rstrip().endswith('"""') and lines[0].strip() != '"""':
                    # One liner
                    print("One line module docstring in %s" % filename)
                    while not lines[0].strip().endswith('"""'):
            while (lines[0].startswith("#") or not lines[0].strip()):
            h.write(marker + "\n\n")
    for dirpath, dirnames, filenames in os.walk("."):
        if dirpath.startswith("./build/"):
        for f in filenames:
            if not f.endswith(".py"):
            f = os.path.join(dirpath, f)
            if should_mark(f):
                print("Marking %s" % f)
Commits on Aug 30, 2013
  1. @superbobry

    Partially migrated to print-function-like syntax

    superbobry committed
      For now we only handle the 'print' statement with a single argument,
      i. e.:
          print ... -> print(...)
      Migration was performed using a 2to3 fixer class:
          from lib2to3 import fixer_base, patcomp
          from lib2to3.fixer_util import Name, Call
          parend_expr = patcomp.compile_pattern(
              """atom< '(' [atom|term|testlist_gexp|STRING|NAME] ')' >""")
          class FixSinglePrint(fixer_base.BaseFix):
              PATTERN = "print_stmt"
              BM_compatible = True
              def transform(self, node, results):
                  assert results
                  assert node.children[0] == Name(u"print")
                  args = node.children[1:]
                  if len(args) != 1 or parend_expr.match(args[0]):
                      # We only fix 'print' statements which have _exactly_ one
                      # non-parenthesized argument.
                  l_args = [arg.clone() for arg in args]
                  l_args[0].prefix = u""
                  n_stmt = Call(Name(u"print"), l_args)
                  n_stmt.prefix = node.prefix
                  return n_stmt
Commits on Feb 12, 2013
  1. @brandoninvergo @peterjc

    add PAML 4.7 test results

    brandoninvergo committed with peterjc
  2. @brandoninvergo @peterjc
Commits on Dec 6, 2012
  1. @cbrueffer
Commits on Dec 5, 2012
  1. @cbrueffer @peterjc

    Distinguish continuation lines from the next logical line (PEP8 E125).

    cbrueffer committed with peterjc
    Peter: Merged four of Christian's commits into one as requested
Commits on Oct 14, 2012
  1. @brandoninvergo
  2. @brandoninvergo
  3. @brandoninvergo
  4. @brandoninvergo
  5. @brandoninvergo

    re-gen PAML 4.1 results

    brandoninvergo committed
  6. @brandoninvergo

    add new PAML test results

    brandoninvergo committed
  7. @brandoninvergo
  8. @brandoninvergo
  9. @brandoninvergo
Commits on May 23, 2012
  1. @brandoninvergo
Commits on May 22, 2012
  1. @brandoninvergo
Commits on Feb 22, 2012
  1. @brandoninvergo @peterjc
  2. @brandoninvergo @peterjc
  3. @brandoninvergo @peterjc
  4. @brandoninvergo @peterjc
  5. @brandoninvergo @peterjc
  6. @brandoninvergo @peterjc
  7. @brandoninvergo @peterjc
  8. @brandoninvergo @peterjc
  9. @brandoninvergo @peterjc
  10. @brandoninvergo @peterjc
  11. @brandoninvergo @peterjc
  12. @brandoninvergo @peterjc
Commits on Aug 17, 2011
  1. @brandoninvergo @peterjc
Commits on Feb 22, 2011
  1. @brandoninvergo
Something went wrong with that request. Please try again.