Skip to content

Remove from __future__ import division, print_function #2429

Closed

Description

@peterjc

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

Activity

  1. added
    good first issue
    on Dec 23, 2019
  2. chris-rands commented on Dec 23, 2019

    @chris-rands
    Contributor

    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

  3. peterjc commented on Dec 25, 2019

    @peterjc
    MemberAuthor

    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
    
  4. peterjc commented on Dec 25, 2019

    @peterjc
    MemberAuthor

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

  5. Dsujan commented on Dec 26, 2019

    @Dsujan
    Contributor

    @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.

  6. peterjc commented on Dec 26, 2019

    @peterjc
    MemberAuthor

    Can you fix the docstrings/comments too please?

  7. Dsujan commented on Dec 26, 2019

    @Dsujan
    Contributor

    Sure.

  8. Dsujan commented on Dec 26, 2019

    @Dsujan
    Contributor

    @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.

  9. peterjc commented on Dec 26, 2019

    @peterjc
    MemberAuthor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions