Biopython: Remove from __future__ import division, print_function

Created on 23 Dec 2019  路  8Comments  路  Source: biopython/biopython

We have recently dropped Python 2 support, so the following lines can be removed:

from __future__ import division
from __future__ import print_function

There is at least one division import, and lots of print_function examples.

This was suggested by @chris-rands, but might be a good first issue for a newcomer?

https://mailman.open-bio.org/pipermail/biopython/2019-December/016739.html

good first issue help wanted

All 8 comments

Thanks Peter, I agree this is a good first issue, if there are any volunteers

There are also 3 examples of from __future__ import with_statement which could have been removed sometime ago (mandatory since Python 2.6)

If you want to forbid these __future__ imports being added back into the codebase, there's a flake8 plugin that could be configured for this: https://github.com/xZise/flake8-future-import

That's the main code base done - still a couple in the Tests/ folder:

$ grep __future__ Tests/*.py
Tests/test_KGML_graphics.py:from __future__ import with_statement
Tests/test_KGML_graphics_online.py:from __future__ import with_statement
Tests/test_KGML_nographics.py:from __future__ import with_statement
Tests/test_Tutorial.py:            example = ">>> from __future__ import print_function\n" + example

If anyone wants to tackle the future imports under Tests, please comment here to avoid duplication of effort.

@peterjc Check the PR.
I have removed the remaining future imports in Test.

In some cases of docstring/comments like:
example = ">>> from __future__ import print_function\n" + example
They are untouched.

Can you fix the docstrings/comments too please?

Sure.

@peterjc Sorry, I mistook .tex example codes for docstrings/comments. My fork wasn't in sync. Seems like info about __future__ import was already handled in .tex.

Please review and I guess we could close this issue.

I was working on Tests/test_Tutorial.py anyway with e371d602d1c15453c4662985f4fe3bbec7bb188b, and with 87447725e60c62a250a9bf55c40355784db777c7 I think you are right, we can close this issue. Thank you for your first Biopython contributions :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wdecoster picture wdecoster  路  9Comments

saketkc picture saketkc  路  10Comments

Nelson-Gon picture Nelson-Gon  路  6Comments

JJTimmons picture JJTimmons  路  9Comments

MarkusPiotrowski picture MarkusPiotrowski  路  6Comments