Skip to content
Commits on Aug 1, 2014
Commits on Apr 3, 2014
  1. bump version

    committed Apr 3, 2014
Commits on Oct 30, 2013
  1. Merge pull request #18 from mruffalo/master

    committed Oct 29, 2013
    Fix #17 in both Python 2 and 3
Commits on Oct 29, 2013
  1. @mruffalo

    info function: don't rely on dict order in doctest

    mruffalo committed Oct 29, 2013
    As in a96f60f, the hash() of a str object is randomized every time
    the Python >= 3.3 interpreter is started. It's no longer possible to
    depend on the order of str keys in a dict, so sort the data by length
    and then by sequence name before printing it.
  2. @mruffalo

    Fix Fasta doctests for Python 2 and 3

    mruffalo committed Oct 29, 2013
    The pyfasta code uses text strings (str in Python 3, unicode in Python 2)
    internally in most places, and it's difficult to directly check the __repr__
    of these objects against known values in a way that works in both versions.
    unicode.__repr__ has a 'u' prefix in Python 2, but this is not present in
    str.__repr__ in Python 3.
    
    To get around this, explicitly call print() on everything that we're
    checking.
  3. @mruffalo

    Fix nucleotide complementing for Python 3, for #17

    mruffalo committed Oct 29, 2013
    Don't try to call .decode('latin-1') on a dict.
Commits on Oct 24, 2013
  1. translation table. force to latin-1. see #17. @mruffalo : care to che…

    committed Oct 24, 2013
    …ck on python3?
Commits on Oct 3, 2013
Commits on Aug 29, 2013
  1. Merge pull request #15 from mruffalo/master

    committed Aug 28, 2013
    Fix the last failing test in Python 3
  2. @mruffalo

    test_all.check_array_copy: fix NumPy type in Python 3

    mruffalo committed Aug 28, 2013
    With the MemoryRecord subclass of FastaRecord, the sequence data is stored
    internally as a str ('unicode' in Python 2). Making a NumPy array from this
    data type defaults to encoding this str as UTF-32, which won't correctly
    decode as ASCII or UTF-8.
    
    Fix check_array_copy by explicitly telling np.array to use one byte per
    character so that we can decode this with the system default
    (ASCII-compatible) encoding.
  3. bump version for pypi

    committed Aug 28, 2013
  4. Merge pull request #14 from mruffalo/master

    committed Aug 28, 2013
    ez_setup.py: fix str/bytes mismatch
  5. Merge pull request #13 from smilefreak/master

    committed Aug 28, 2013
    Fixed mistakes in my bug fix
Commits on Aug 28, 2013
  1. @mruffalo

    ez_setup.py: fix str/bytes mismatch

    mruffalo committed Aug 27, 2013
    This file reads itself in the update_md5 function in order to to update
    the md5_data dict. The file contents are then matched against a text
    regex, so the file has to be opened in text mode to match. Otherwise
    this mismatch will manifest as
    
        TypeError: can't use a string pattern on a bytes-like object
    
    Since this file is entirely ASCII, it's safe to read it in text mode
    without specifying an encoding.
    
    While I was looking at it, also do some other cleanups/style tweaks:
    drop unused imports and use open() calls as context managers.
  2. @theboocock

    Fixed mistakes in my bug fix

    theboocock committed Aug 28, 2013
Commits on Aug 27, 2013
  1. Merge pull request #12 from smilefreak/master

    committed Aug 27, 2013
    fixed TypeError: 'str' does not support the buffer interfacein python 3
  2. @theboocock

    Fixed buffer interface

    theboocock committed Aug 27, 2013
  3. @theboocock
Commits on Aug 13, 2013
  1. Merge pull request #11 from mruffalo/master

    committed Aug 13, 2013
    Minor tweaks/updates
  2. @mruffalo

    Use __future__.print_function import

    mruffalo committed May 1, 2013
    This is valid in Python 2.6, and reduces some of the code churn that occurs
    with 2to3 conversion.
    
    Also replace the old "except Exception, e" syntax.
  3. @mruffalo

    fasta.py: change seen_headers into a set

    mruffalo committed May 13, 2013
    It was previously a dict that mapped each header to None, and was only used
    for membership testing. This is what sets are for.
  4. @mruffalo
Commits on May 25, 2013
  1. @mruffalo

    Replace three more dict.keys/items occurrences

    mruffalo committed May 1, 2013
    It's easy to forget that these calls produce lists in Python 2, but 2to3 makes
    it very clear by converting e.g. dict.keys() to list(dict.keys()). If we don't
    need an actual list (and we rarely do), may as well just use iterators.
    
    In tests/bench.py, we can obtain the first 10 keys with itertools.islice.
Commits on May 1, 2013
  1. @mruffalo

    ez_setup.py: remove fallback md5 import

    mruffalo committed May 1, 2013
    hashlib ships with Python 2.6.
Commits on Apr 30, 2013
  1. Merge pull request #10 from mruffalo/master

    committed Apr 30, 2013
    Support Python 2.6 - 3.3 thanks to @mruffalo
  2. @mruffalo

    split_fasta.py: open files in text mode

    mruffalo committed Apr 30, 2013
    Also make sure that file handles are closed, either by using the open() call
    as a context manager or by explicitly calling file_obj.close().
  3. @mruffalo

    split_fasta.py: use iterkeys instead of keys

    mruffalo committed Apr 30, 2013
    2to3 converts dict.keys() to list(dict.keys()), which isn't necessary for
    this usage.
  4. @mruffalo

    records.py: use context managers for open() calls

    mruffalo committed Apr 30, 2013
    It's an extra indentation level, but avoiding an explicit
    file_obj.close() is nice.
  5. @mruffalo

    fasta.Fasta: extend collections.Mapping instead of dict

    mruffalo committed Apr 30, 2013
    Extending dict isn't necessary to behave like a mapping object, and in fact
    has some overhead since the Fasta object needlessly stores data that's set up
    by the superclass. It was also necessary to override as many methods as
    possible to avoid accidentally referring to the superclass's data.
    
    Now, extend Mapping and fill in the important methods:
    
    * __len__
    * __iter__
    * __getitem__
    
    Everything else will be provided by the Mapping abstract base class, including
    e.g. keys/iterkeys/viewkeys (Python 2) -> keys (Python 3).
    
    Because of this, pyfasta now requires Python 2.6+.
  6. @mruffalo
  7. @mruffalo

    fasta.Fasta: override items() method for Python 3

    mruffalo committed Apr 30, 2013
    In Python 2, items() essentially loops over the keys() of the dict and adds
    a (key, value) tuple to a list.
    
    In Python 3, the items() method returns a view of the underlying dict's data
    and isn't affected by the overridden keys(), iterkeys() and __getitem__.
    
    This can probably be removed in the future by subclassing
    collections.abc.Mapping instead of dict, but this requires Python 2.6+.
  8. @mruffalo

    fasta.py: fix doctest for hash randomization

    mruffalo committed Apr 30, 2013
    Python 2.7 adds an option to randomize hash seeds, and this is enabled by
    default in 3.3. The natural ordering of a dict now changes every time the
    interpreter is started, so don't depend on this in a doctest.
    
    Explicitly sort the items of a dict in order to compare against expected
    values.
  9. @mruffalo

    Open text files in text mode

    mruffalo committed Apr 30, 2013
    The implicit decoding of UTF-8 should be fine for FASTA files, and this allows
    using string literals everywhere instead of bytes literals (which aren't
    available in Python 2.5).
  10. @mruffalo
  11. @mruffalo
Something went wrong with that request. Please try again.