Repository navigation
Apply Black to Doc/examples/ & start checking in CI - #2373
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2373 +/- ##
=========================================
+ Coverage 84.93% 85% +0.07%
=========================================
Files 323 323
Lines 52884 53152 +268
=========================================
+ Hits 44918 45184 +266
- Misses 7966 7968 +2
Continue to review full report at Codecov.
|
2b83015 to
9029193
Compare
|
I had a silly typo in the tox configuration, but also some of the other files need black run on them... |
|
Looks like I didn't have black version 19.10b0 installed locally, but the previous release. This introduces a couple of further changes - something to beware of in future. |
92d055d to
97e9b05
Compare
| return None | ||
| assert len(seqs) == 1 | ||
| given_length, = seqs[0] | ||
| (given_length,) = seqs[0] |
There was a problem hiding this comment.
Why using a one-element tuple here? (If I understand this correctly).
Can't we use just return int(seqs[0])?
There was a problem hiding this comment.
I don't recall why the code was written that way in the first place, but it was me: 877a5f2
There must be something unintuitive about the DB results object, the obvious fix fails:
TypeError: int() argument must be a string, a bytes-like object or a number, not 'tuple'
There was a problem hiding this comment.
There are more of these in Bio/File.py, see e.g.
It seems to be an (anti) pattern with DB access.
There was a problem hiding this comment.
OK, now I got it, the contents of seqs[0] is a one-element tuple.
There was a problem hiding this comment.
Actually, I was irritated in the first place that tuple unpacking now also requires parenthesis. I don't like it, but OK.
There was a problem hiding this comment.
Ah - I was more bothered on why there was tuple unpacking (I wrote the code years ago, but this was non-obvious). I'm on the fence about the recent black style change - adding the brackets makes it difficult to overlook the tuple unpacking - previously that trailing comma was easy to miss.
| + [grey, blue] | ||
| + [lightblue] * 2 | ||
| + [grey] * 8 | ||
| ) |
There was a problem hiding this comment.
Personally, I would use the parentheses to get rid of the line continuation backshlashes, but would turn black off here. On my 17'' laptop, these three lists fill the whole screen.
There was a problem hiding this comment.
I agree on parentheses over slash line continuation, but actually don't mind black taking a screen's worth of vertical space for defining these lists - they are a key part of the graphical example.
| sys.stderr.write(USAGE) | ||
| sys.exit(-1) | ||
| TESTFILE, = args | ||
| (TESTFILE,) = args |
There was a problem hiding this comment.
TESTFILE = args[0]?
There was a problem hiding this comment.
This dates back to the original check in, bbe8f5c - but I agree with the suggestion.
There was a problem hiding this comment.
However, the script no longer works - Bio.ParserSupport was removed in Release 1.72, while Bio.Blast.NCBIStandalone was moved away to Bio.SearchIO._legacy as an interim measure. We can just remove the entire script.
The modules this used were removed in Biopython 1.72, and we should have removed this script then too. There is no need to update/replace this example, since we deprecated the plain text BLAST parsing.
|
Thanks Markus. |
This pull request addresses issue #2008 in part.
I hereby agree to dual licence this and any previous contributions under both
the Biopython License Agreement AND the BSD 3-Clause License.
I have read the
CONTRIBUTING.rstfile, have runflake8locally, andunderstand that AppVeyor and TravisCI will be used to confirm the Biopython unit
tests and style checks pass with these changes.
I have added my name to the alphabetical contributors listings in the files
NEWS.rstandCONTRIB.rstas part of this pull request, am listedalready, or do not wish to be listed. (This acknowledgement is optional.)