Commit Graph

120 Commits

Author SHA1 Message Date
de0bb21fb3 Apply isort (forcing single lines, not sorting by type) via ruff
$ ruff check --fix --select=I \
  --config=lint.isort.force-single-line=true \
  --config=lint.isort.order-by-type=false \
  BioSQL/ Bio/ Tests/ Scripts/ Doc/ setup.py

Using ruff version 0.4.10
2024-06-26 15:31:39 +09:00
a47460e59a Misc spellings flagged by codespell (#4716)
Note the childs to children changes in Bio/Phylo/Consensus.py
included fixing internal variable names only.

Not applying all the catergories ==> categories fixes
to the (deprecated) EMBOSS wrappers as some would be
functional changes.

Also no more LaTeX files (for spell checking)
2024-05-01 14:21:12 +01:00
42ca9f27b8 Basic type hints: QualityIO, SeqRecords, ...
Co-authored-by: Thomas Holder <thomas@thomas-holder.de>
2023-08-08 10:51:44 +01:00
d0e5efee04 Fixes for flake8 E741 ambiguous variable name 'l'
Mostly used for line or length.
2022-11-15 14:49:30 +00:00
1e4acd3cc6 Cache last accessed record in index class (#3715) 2021-09-30 10:25:40 +01:00
2ee477e496 f-strings on Bio/*.py using flynt 0.69 2021-09-13 16:14:16 +01:00
e5c9cabf8c pyupgrade: f-strings (easy cases)
Ran this:

$ pyupgrade --py37-plus Bio/*.py Bio/*/*.py Bio/*/*/*.py BioSQL/*.py
$ black Bio/ BioSQL/

Then reverted any changes adding a .format method, spotted with:

$ git diff | grep "^+" | grep -E "(\.format|\+\+\+)"
2021-09-11 12:30:38 +01:00
817dc60d0a removed deprecated cose 2021-05-25 19:14:11 +01:00
5af9e11f40 Remove obsolete comments 2020-08-03 09:40:15 +01:00
74a43437e9 Abstract Base Class for Bio/File.py (#2731)
Recommended to raise still: https://docs.python.org/3/library/exceptions.html#NotImplementedError
2020-08-02 17:01:54 +01:00
e1091157ce black, version 19.10b, does tuple assignment 2020-01-24 11:26:56 +00:00
f09b169a4a updating Bio.File for python3 (#2557)
* updating Bio.File for python3

* travis
2020-01-16 23:27:32 +09:00
6a425121a8 moving UndoHandle, second attempt (#2514)
* moving UndoHandle, second attempt

* travis
2020-01-16 13:02:14 +09:00
2812869ea8 Assume dict is ordered (#2518)
This is a language feature in Python 3.7 onwards.

This is also the behaviour in CPython 3.6 and the PyPy
implementation of Python 3.6.

We are not currently aware of any other Python 3.6 implementation
(where dictionaries might not be sorted), so this is simpler now
that we require at least Python 3.6 for Biopython.

Update docstrings on ordered dicts (thanks Chris Rands,
spotted in review).
2020-01-10 10:30:28 +00:00
bf75689561 Removing version check for python 2 from files (#2520) 2020-01-09 19:09:23 +00:00
2748e0e943 post-black string concatenation fixes 2020-01-06 13:04:28 +00:00
fc25aa037e black, version 19.3b0, on Bio/*.py
Excluding Bio/pairwise2.py
2020-01-06 13:04:28 +00:00
0327ce5e42 Remove all usages that were skipped 2019-12-28 22:27:53 +00:00
481d3f079b remove explicit class inheritance of object 2019-12-28 19:21:54 +00:00
22e4cee78a Remove legacy python 2 next methods 2019-12-27 19:03:54 +00:00
5a7dbd0844 Remove string aliases for python2 (#2441)
Removed use of unicode and basestring via Bio._py3k

See issue #2420.
2019-12-26 21:58:22 +00:00
73e9444d2c Update doctest, python 3 write returns length 2019-12-26 11:34:24 +00:00
0c25556525 Removed print_function and division future imports 2019-12-25 14:41:32 +00:00
6d092444cf Added support for check_same_thread (#2233) 2019-09-27 16:17:00 +01:00
abc7304279 Removes files created during run of run_tests.py 2019-08-05 10:05:43 +01:00
b58c4b613b Using tool unify to convert Bio/ to use double quotes
Using https://github.com/myint/unify for this:

$ unify --quote \" --in-place Bio/*.py Bio/*/*.py Bio/*/*/*.py
$ git checkout Bio/Restriction/Restriction_Dictionary.py

Note excluded automatically generated file
Bio/Restriction/Restriction_Dictionary.py
2019-08-02 14:10:22 +01:00
d4e2800b8b Avoid backticks in comment line
Was a false positive when looking for RST markup wrongly
using one back-tick instead of two.
2019-07-16 16:22:47 +01:00
a492eef804 Speed up index loading from SQLite for SeqIO, SearchIO, etc (#2137) 2019-06-18 09:31:07 +01:00
6e24348ff4 Fixed doctest for Bio.File 2019-04-30 15:32:11 +01:00
0403908cdf Make OrderedDict vs dict check more rigerous.
This should handle the corner cases of Jython or IronPython too.
Based on suggestion from Wibowo Arindrarto.
2018-11-23 10:28:48 +00:00
b3c69ed9c4 Preserve order in SeqIO and SearchIO index, index_db
This is simpler to think about, and also means looping over the
index to iterate over a file (or files) will be done in the
disk-order, which will be faster.

(Previously iteration over the index would happen in the sorted
order of the index key hashes, essentially random, thus there
would be a lot of disk random access jumping back and forth
through the file to parse the records in arbitrary order.)

Internally the SeqIO/SearchIO index_db function will now use
explicit sorting via the file number and offset so that the
keys and iteration order reflect that on disk.

Internally the SeqIO/SearchIO index function will now use an
OrderedDict on Python 3.5 or older.

Python 3.6 has an ordered dict, but this was declared an
implementation detail only, rather than a language standard.

PyPy has always had an ordered dict.

Python 3.7 onwards has an ordered dict as part of the
language definition, see:

https://mail.python.org/pipermail/python-dev/2017-December/151283.html

We do not in general want to use OrderedDict which is designed
for different use cases (making lots of changes to the dictionary
content), see:

https://mail.python.org/pipermail/python-dev/2017-December/151266.html
2018-11-23 10:28:48 +00:00
c098f8d77f ValueError if _open_for_random_access given gzipped file
Still accepts BGZF, but will now error on other gzipped
files (previously would just open them in rb mode).

This is intended to close #1666
2018-09-04 10:41:31 +01:00
ffb9818cf4 Dual license Bio/File.py [ci skip]
Original author Jeff Chang (@jefftc), other named copyright
holders (me), and the other contributors since from the git
log have all agreed, see GitHub issue #898.

 - Andrew Dalke (@adalke)
 - Brad Chapman (@chapmanb)
 - Carlos Peña (@carlosp420)
 - Chris Mitchell (@chrismit aka @Chris7)
 - Christian Brueffer (@cbrueffer)
 - Connor McCoy (@cmccoy)
 - Francesco Gastaldello (@gasta88)
 - Matt Ruffalo (@mruffalo)
 - Michiel de Hoon (@mdehoon)
 - Travis Wrightsman (@twrightsman)
 - Wayne Decatur (@fomightez)
 - Wibowo Arindrarto (@bow)
2018-04-17 10:24:36 +01:00
7204c81b60 File.as_handle: fix incorrect error propagation (#1544) 2018-03-12 14:05:40 +01:00
cba895d669 Bio.File.as_handle: support pathlib.Path objects and more (PEP 519)
The logic changes for this are quite small: instead of checking whether
we think `handleish` should be passed to `open`, just try that first. If
that succeeds, yield the new file handle; otherwise yield the object
as-is.

With this change in behavior, it is no longer BioPython's responsibility
to know whether a certain object can be passed to `open`. This allows a
user to use a `pathlib.Path` object (or `os.DirEntry` returned from
`os.scandir`) under Python >= 3.6. Behavior in previous versions of
Python is unchanged.
2017-12-27 23:53:47 +00:00
50a89702eb flake8 docstring D412 and D413
D413 Missing blank line after last section
D412 No blank lines allowed between a section header and its content

(Seems adopting numpydoc naming means the flake8 plugin now
is stricter about section formatting and/or the machine I
did the previous commits on had an out of date flake plugin?)
2017-10-30 09:46:15 +00:00
f0790ebaf7 Moving to numpydoc section name Examples
Also moving examples below argument lists.
2017-10-30 09:46:15 +00:00
6a9bfee89b Fix or make indentation consistent for RST bullet points 2017-06-22 16:33:48 +01:00
f3bf2f3fc5 Update docstrings in File.py
Squashed commit of  pull request #1212.

Cross reference #1203 for adding missing public docstrings.
2017-05-05 14:22:09 +01:00
35de4092ef PEP8 whitespace (indentation and some very long lines) 2016-06-13 14:43:02 +01:00
1119425f45 PEP8 E402 module level imports vs __docformat__ placement
This was mostly due to the latest version of the pep8
tool being stricter and wanting the __docformat__ line
after the module level imports.

Rather than moving them all, I removed them - and we'll
switch to using reStructuredText as the default when
converting the docstrings into API HTML pages for the
website.

This commit also includes assorted other PEP8 fixes which
our recommend git pre-commit hook spotted, and I fixed by
hand.
2016-05-10 17:13:46 +01:00
7ac5279e47 Be explicit in docstrings that get_raw returns bytes
No code changes, see issue #713.
2015-12-22 19:06:53 +00:00
561d506db4 fix misspellings as spotted by codespell.py 2015-12-09 21:06:25 +00:00
ea80efdbb6 Preserve .url in UndoHandle; fixed typo 2015-04-17 11:36:15 +01:00
ab7ac2968b Resolve slash-n in RST docstrings.
Solves temporarily disabling RST markup as of commit
3cfb6334a17ce8b783c93f8e00baf214cdcb8668 by the simple
trick of putting the docstrings in raw string mode.
2014-11-14 16:08:47 +09:00
9feade64b9 PEP8 tidying for SeqIO index work 2014-11-12 10:05:46 +09:00
0b4a2eebd3 Use Unix slashes when storing relative paths 2014-11-12 09:59:53 +09:00
5e41e75bd9 Spot child-paths automatically for indexes 2014-11-12 09:58:34 +09:00
a46da3f10d Record indexed filenames relative to the index - issue #267 2014-11-12 09:57:24 +09:00
3cfb6334a1 epydoc RST does not like the slash-n in the docstring/doctest 2014-11-11 17:16:33 +09:00