Replaced print with warn/stderrs in NCBIXML.py#5030
Replaced print with warn/stderrs in NCBIXML.py#5030head-ease08 wants to merge 11 commits intobiopython:masterfrom
Conversation
Replacing print with warn/stderrs
|
The warnings ought to have a class like If the current tests do not hit these warnings, then ideally we'd need another test added... |
|
Sure, I will check it out and hopefully finish next week. Will look into Biopython-specified warnings.
Need more elaboration, please. |
|
If you run the test suite, do the new warnings appear in the terminal output? Note the online BLAST test is troublesome - I think there is an open issue on that. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5030 +/- ##
==========================================
+ Coverage 85.45% 86.31% +0.86%
==========================================
Files 286 286
Lines 59851 59853 +2
==========================================
+ Hits 51144 51665 +521
+ Misses 8707 8188 -519 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Replaced regular warnings with BiopythonParserWarning
|
|
Yes, |
Added test for BLAST tool BiopythonParserWarning output
|
Nearly there - an indentation issue and a duplication: |
|
XML parser probably stops iteration when encounters unsupported tag, hence XML file appears to be empty for parser. Will look into it. |
|
Unfortunately I dont have time recently for working on this issue, hopefully will return later. |
|
Hey @head-ease08 and @peterjc, anything I can do to help? |
|
@harisj739 Hey! You might look into the issue, afaik there is some underlying problem with XML parser |
| print("NCBIXML: Added Blast record to results") | ||
| warnings.warn( | ||
| "Added Blast record to results", BiopythonParserWarning, stacklevel=2 | ||
| ) |
There was a problem hiding this comment.
This isn't a bad thing to be shown as a warning, but a progress message to show on stderr.
|
I guess that by adding this test, @head-ease08 found that the parser doesn't handle unepected tags nicely. It gives a warning (good), but then breaks? If that is correct, then the simplest course of action is to raise an exception on the unexpected tag, and halt. And that should be an improvement on the current unclear failure. |
|
@peterjc I can add that functionality building upon @head-ease08's code. If I do, should I create a sub-PR within this PR or an entirely separate PR? |
|
I would suggest a new PR, using a new branch starting from and including (and thus crediting) Mark's initial work. |
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 runpre-commitlocally, and understand that continuous integration checks 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.)
Closes #4262 Replaced print statements with warnings.warn or sys.stderr.write in NCBIXML.py for better logging and error handling