Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Jan 4, 2015
  1. @peterjc
  2. @peterjc

    PEP8 white space in Tests

    peterjc authored
    autopep8 --select E225,E226,E261,E302 -i Tests/*.py
Commits on Nov 12, 2014
  1. @carlosp420 @peterjc

    PEP8 fixes, various test files

    carlosp420 authored peterjc committed
Commits on Nov 11, 2014
  1. @peterjc
Commits on Oct 27, 2014
  1. @peterjc

    autopep8 E203 - Remove extraneous whitespace (colon related)

    peterjc authored
    $ autopep8 -r -i --select E203 ...
    
    Note did not apply changes to e.g. Tests/test_Crystal.py and
    Bio/SCOP/Raf.py where colon used for numpy array access, nor
    auto-generated files like Bio/SubsMat/MatrixInfo.py
  2. @peterjc

    autopep8 E265 - Format block comments.

    peterjc authored
    $ autopep8 --version
    autopep8 1.0.4
    $ autopep8 -r -i --select E265 ...
  3. @peterjc

    autopep8 E261 - Fix spacing after comment hash

    peterjc authored
    $ autopep8 --version
    autopep8 1.0.4
    $ autopep8 -r -i --select E261 ...
Commits on Sep 9, 2013
  1. @peterjc

    Add: from __future__ import print_statement

    peterjc authored
    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:
    
    print(variable)
    
    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:
    
    <python>
    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]
        handle.close()
        if MAGIC in lines:
            #print("%s is marked" % filename)
            return False
        if "print" in lines:
            print("TODO - %s has a naked print" % filename)
            sys.exit(1)
        for line in lines:
            if "print" not in line:
                continue
            #print(line)
            line = line.strip(" #")
            if line.startswith(">>>") or line.startswith("..."):
                #doctest
                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()):
                h.write(lines.pop(0))
            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)
                    h.write(lines.pop(0))
                else:
                    h.write(lines.pop(0))
                    while not lines[0].strip().endswith('"""'):
                        h.write(lines.pop(0))
                    h.write(lines.pop(0))
            while (lines[0].startswith("#") or not lines[0].strip()):
                h.write(lines.pop(0))
            h.write(marker + "\n\n")
            h.write("".join(lines))
    
    for dirpath, dirnames, filenames in os.walk("."):
        if dirpath.startswith("./build/"):
            continue
        for f in filenames:
            if not f.endswith(".py"):
                continue
            f = os.path.join(dirpath, f)
            if should_mark(f):
                print("Marking %s" % f)
                mark_file(f)
    </python>
Commits on Sep 8, 2013
  1. @peterjc

    Convert commented out print statements into print functions

    peterjc authored
    This isn't really important, but it cuts down on the
    false-positives when searching with grep.
Commits on Sep 7, 2013
  1. @peterjc
Commits on Sep 5, 2013
  1. @peterjc

    Use built in next() function in misc test_*.py

    peterjc authored
    Under Python 3 need to use next(iterator) rather than
    iterator.next(), and this built in function is new in
    Python 2.6 (so we couldn't use it until we dropped
    support for Python 2.5).
Commits on Aug 28, 2013
  1. @peterjc

    Remove with_statement imports required under Python 2.5

    fomightez authored peterjc committed
    Removed all the with statement imports
    (and any comment lines associated with them);
    
    from __future__ import with_statement
Commits on Apr 8, 2013
  1. @peterjc

    Fix some more handle leaks

    peterjc authored
Commits on Dec 24, 2012
  1. @cbrueffer @peterjc

    More typo and duplicate word fixes.

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

    Add a blank line before and after functions (PEP8 E301).

    cbrueffer authored peterjc committed
    E301: expected 1 blank line, found 0
  2. @cbrueffer @peterjc

    Avoid multiple statements on one line (PEP8 E701).

    cbrueffer authored peterjc committed
Commits on Oct 27, 2011
  1. @peterjc
Commits on Nov 11, 2009
  1. @peterjc

    No code changes. Removing white space before ':' character to match P…

    peterjc authored
    …EP8. Added a few missing license statements too.
Commits on Oct 30, 2009
  1. @peterjc
  2. @peterjc
Commits on Aug 6, 2009
  1. @peterjc
  2. @peterjc

    Renaming the old test_Fasta2.py to test_SeqIO_FastaIO.py to reflect t…

    peterjc authored
    …he fact it now tests Bio.SeqIO.FastaIO instead of the deprecated Bio.Fasta module
Something went wrong with that request. Please try again.