Commit Graph

105 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
57056bbfc4 ruff format v0.3.1, black v24.2.0
Reverted unwanted changes (mostly arrays in tests, but also
some whitespace in doctests).

Remaining changes are standardising spacing between module
docstring and imports, and lower-case \x<hex> in strings.
2024-03-14 11:05:43 +00:00
e4903bbb60 Fix E721 spotted with latest flake8/ruff 2023-11-01 13:42:28 +00:00
a24bec98da Do not use assert outside of testing code
Replaced asserts in BioSQL with if statements

[Issue: 3600]
2022-05-10 15:31:27 +01:00
509b78e8ad f-strings on BioSQL 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
51fb8f9abd Assorted spelling corrections from codespell
See https://github.com/codespell-project/codespell

We have lots of false positives, so currently this
needs manual review and/or a list of biological
terms to ignore like "Ser" and "OTU".
2021-08-29 00:24:41 +01:00
8d63ac418f remove deprecated code (#3429)
* remove deprecated code

* draw_graphviz is gone

* travis
2020-12-14 07:25:39 +09:00
5d838b967e BioSQL doesn't need to subclass Seq (#3428)
* so far so good

* use index

* rename the class

* travis
2020-12-07 08:49:10 +09:00
7990b5986e remove remaining unicode stuff (#3248) 2020-09-02 15:34:49 +01:00
85e8956832 BioSQL updates for python3 (#2654) 2020-02-09 16:54:58 +00:00
bf75689561 Removing version check for python 2 from files (#2520) 2020-01-09 19:09:23 +00:00
66f2c18ec0 Python 3 only needs super() with no args 2019-12-29 11:09:50 +00:00
481d3f079b remove explicit class inheritance of object 2019-12-28 19:21:54 +00:00
ee5e422cc8 Removed py3k calls in BioSQL/
Moved bytearray_to_str into MysqlConnectorAdaptor

Peter: Made the new method into a staticmethod with a
leading underscore (private) as part of rebasing this.
2019-12-27 19:04:11 +00:00
c4bac6067e Fix implicit string concatenation; pointless r-prefixes
Found while testing new flake8 plugin,
https://github.com/keisheiled/flake8-implicit-str-concat/
2019-11-29 12:59:47 +00:00
ad0bd24e41 Ran black version 19.3b0 on BioSQL 2019-11-29 12:59:47 +00:00
6ba1aa7cb7 Using tool unify to convert BioSQL/ to use double quotes
Using https://github.com/myint/unify for this:

$ unify --quote \" --in-place BioSQL/*.py
2019-08-02 14:10:22 +01:00
89b2663dde Follow numpy section naming, fixes sphinx numpydoc warning
.../numpydoc/docscrape.py:424: UserWarning: Unknown section Examples: in the docstring
2019-07-16 08:05:20 +01:00
568b429174 Fix BioSQL doctest (#2170)
* Remove doctest from the module
* Remove module from doctest excluding list, since it has no doctests
* Add myself to contrib
2019-07-09 13:01:46 +01:00
0f46ddad8c MySQL 8 support 2019-03-15 17:06:51 +00:00
d3e7b6f47c BioSQL support for mysqlclient package (#1931)
* Fix bytestring seq

* Improve error message, add test in travisCI

* Add pypy, remove python3.4

* Update news and readme

* Doc style fix


Closes issue #1928, see also #821
2019-02-14 08:47:27 +00:00
01fc23127d enable flake8 testing of doctests in Bio, BioSQL; fix tests (#1900)
* enable flake8 testing of doctests in Bio, BioSQL; fix tests
* use literal blocks for examples which won't work
* fix passing mutable object as default arguments
2019-01-21 10:12:45 +00:00
cb8c45ef4e Dual license BioSQL/*.py [ci skip]
The original author Andrew Dalke (@adalke), named copyright
holders and contributors according to the git log have all
agreed, see #898.

 - Andrew Dalke (@adalke)
 - Cymon Cox (@cymon)
 - Aaron Kitzmiller (@aaronk)
 - Brad Chapman (@chapmanb)
 - Brian Osborne <briano@bioteam.net>
 - Christian Brueffer (@cbrueffer)
 - Connor T. Skennerton (@ctSkennerton)
 - Evan Parker (@eparker05)
 - Iddo Friedberg (@idoerg)
 - Jeroen Van Goey (@BioGeek)
 - Markus Piotrowski (@MarkusPiotrowski)
 - Michiel de Hoon (@mdehoon)
 - Nick Semenkovich (@semenko)
 - Peter Cock (@peterhc)
 - Suresh Panneerselvam <sureshcbt@gmail.com>
 - Tiago Antao (@tiagoantao)
 - Travis Wrightsman (@twrightsman)
 - Wibowo Arindrarto (@bow)
 - @morrme
2018-04-13 12:07:24 +01:00
9d880bbb50 Add (PRIVATE) to summary line of private BioSQL docstrings
Squashed commit of #1578 to partly address issue #1466
2018-03-23 09:23:04 +00:00
4916f2f951 Fix typo: arround -> around 2017-11-06 19:02:07 +00:00
6a9bfee89b Fix or make indentation consistent for RST bullet points 2017-06-22 16:33:48 +01:00
d06d23a37f Fix RST validation in BioSQL docstrings.
Spotted during development and testing of a new flake8 plugin,
https://github.com/peterjc/flake8-rst-docstrings
2017-06-15 14:58:34 +01:00
6082eb0369 Adding + updating docstrings in BioSQL
Squashed commit of pull request #1228, cross reference issue #1203
2017-05-16 11:57:26 +01:00
10e5798b15 Tweak BioSQL docstrings for pydocstyle/flake8-docstrings 2017-05-04 17:23:20 +01:00
948ba4bc2e Fix PEP8 E123 (not enforced by default)
$ flake8 BioSQL/ --select E123 --config /dev/null --ignore
BioSQL/BioSeqDatabase.py:555:5: E123 closing bracket does not match indentation of opening bracket's line
2017-05-04 17:23:20 +01:00
49cc6d7524 One-line docstring should fit on one line with quotes
Fix a lot but not all of these PEP257 docstring style
violations, reported by pydocstyle as D200.
2017-04-19 16:50:01 +01:00
1a011e729b PEP8 whitespace in BioSQL, esp long lines 2016-06-13 14:38:42 +01:00
a29bb1418e Update warning with current URL 2016-06-03 14:42:51 +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
6348a037dc Set the left/right taxonomy tree values in BioSQL
Squashed commit from Pull Request #809.

Set the left and right values of the taxon table

Set the left value to the max in case there are multiple top levels

provide an executemany method to _CursorWrapper and Adaptor

(Peter: I also fixed minor white space complaints from PEP8 checking)
2016-04-16 09:56:40 +01:00
6e06969048 Enforce BioSQL namespace (biodatabase) in __getitem__ and __delitem__
Squashed commit from GitHub pull request #767.
2016-03-25 15:59:55 +00:00
9f7eed8a1f Updated BioSQL sqlite3 schema to include foreign keys
Fix for GitHub issue #741 by changing the sqlite3 database schema
to use foreign keys. A new test has been added in that explicitly
tests to make sure associated data with a bioentry is removed.

To accommodate the use of foreign keys the connection to an sqlite
database must set the PRAGMA, which is now done automatically when
opening the database.

The upstream BioSQL schema for sqlite3 has also been updated, see
https://github.com/biosql/biosql/pull/3
2016-01-05 19:25:16 +09:00
bef61fdebe Avoid dict .get with redundant argument default None
According to QualifiedCode.com this is an anti-pattern and
best avoided. Certainly this is shorter.
2016-01-04 20:06:12 +09:00
a4e3082dbd Add docformat statements to *py files in BioSql and Scripts/ 2015-12-16 22:08:28 +00:00
f24245bb7f Use new-style classes consistently.
Quick of python history that unless you subclass object
then on Python 2 you get an 'old-style' class which as
some subtle differences from a 'new-style' class.
2015-01-07 08:15:29 +00:00
838a8e1984 Selective use of autopep8 to remove whitespace after commas
Numerous examples still present where the white space is used
to make a data-structure much easier to read (arrays etc).

Part of tackling GitHub issue #406
2015-01-07 04:43:14 +00:00
3c84345576 Interface specific adapter class for mysql.connector in BioSQL
BioSQL will use a specific MySQL adapter class when
necessary but in other cases it will default to the
general Adapter class. This closes issue #370.

Additionally, Adapter now inherits from object and
some docstrings were added to existing classes and
methods.
2014-11-11 15:15:10 +09:00
47c1005a94 PEP8 tweaks to BioSQL, mostly using autopep8 2014-10-27 14:43:03 +00:00
82272b1f36 autopep8 E265 - Format block comments.
$ autopep8 --version
autopep8 1.0.4
$ autopep8 -r -i --select E265 ...
2014-10-27 14:27:12 +00:00
3be98b9a5f Remove hack for old psycopg 2014-05-25 13:56:05 +01:00
3912288d52 Revert tweak written for psycopg 2014-05-25 13:52:01 +01:00
471d69c7b4 pure python mysql driver for BioSQL using Oracle's mysql-connector
Note VARCHAR BINARY problem under Python 3 (bytes vs unicode), thus
includes a Cursor wrapper for mysql.connector under python3 to
convert bytes to strings.
2014-05-25 13:03:58 +01:00
e9fab64592 Move code from deprecated method into replacement.
This should have been done when adding the deprecation warning.
As it was, even using the new style delete the warning was still
being triggered.
2014-05-08 10:55:19 +01:00
e998c62f10 Avoid deprecated universal read lines mode under Python 3 2014-04-30 17:52:18 +01:00