Skip to content

Fix #2207 - make feature position instances pickable - #2209

Merged
peterjc merged 6 commits into
biopython:masterfrom
macraild:fix2207
Aug 16, 2019
Merged

peterjc merged 6 commits into
biopython:masterfrom
macraild:fix2207

Conversation

@macraild

@macraild macraild commented Aug 14, 2019 •

Copy link
Copy Markdown
Contributor

This adds __getnewargs__ to SeqFeatures.*Positions classes where required, so that instances are (un)picklable

This pull request addresses issue #2207

  • [X ] I hereby agree to dual licence this and any previous contributions under both
    the Biopython License Agreement AND the BSD 3-Clause License.

  • [X ] I have read the CONTRIBUTING.rst file, have run flake8 locally, and
    understand 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.rst and CONTRIB.rst as part of this pull request, am listed
    already, or do not wish to be listed. (This acknowledgement is optional.)

@macraild
macraild requested a review from peterjc as a code owner August 14, 2019 01:06
@codecov

codecov Bot commented Aug 14, 2019 •

Copy link
Copy Markdown

Codecov Report

Merging #2209 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2209      +/-   ##
==========================================
+ Coverage   84.68%   84.69%   +0.01%     
==========================================
  Files         317      317              
  Lines       51448    51454       +6     
==========================================
+ Hits        43570    43581      +11     
+ Misses       7878     7873       -5
Impacted Files Coverage Δ
Bio/SeqFeature.py 87.06% <100%> (+0.14%) ⬆️
Bio/_py3k/__init__.py 75% <0%> (-1.2%) ⬇️
Bio/HMM/Trainer.py 96.63% <0%> (ø) ⬆️
Bio/HMM/Utilities.py 15.78% <0%> (ø) ⬆️
Bio/HMM/MarkovModel.py 89.12% <0%> (ø) ⬆️
Bio/HMM/DynamicProgramming.py 93.47% <0%> (ø) ⬆️
Bio/UniGene/__init__.py 95.8% <0%> (+4.19%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2f0ea3f...572623c. Read the comment docs.

Comment thread Bio/SeqFeature.py Outdated
>>> p2 == 13
True


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this to the __getnewargs__ docstring instead?

Comment thread Bio/SeqFeature.py

i.e. For equality (and sorting) the position objects behave like
integers.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, could you move this to the __getnewargs__ docstring please.

Comment thread Bio/SeqFeature.py Outdated
>>> p2 == 1901
True

To allow pickling and unpickling of class instances, the arguments

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment, this isn't of general interest but __getnewargs__ lacks any docstring at all - this would work better there I think.

@peterjc

peterjc commented Aug 14, 2019

Copy link
Copy Markdown
Member

I'd like a cosmetic change in the docstring placement, but otherwise the change looks good.

Are you comfortable adding something to Tests/test_SeqFeature.py or do you think the doctests are enough?

@macraild

Copy link
Copy Markdown
Contributor Author

I agree, the docstrings were out of place, so I've rewritten as method-level docstrings. But doctests don't seem to run from here, so I've converted the original doctests to unittests in Test/SeqFeature.py. Note that the scope of the tests is unchanged. To the extent I understand what is required here, these tests cover it, but happy to add more if there is something specific I have missed.

@peterjc

peterjc commented Aug 15, 2019

Copy link
Copy Markdown
Member

Doctests are fragile, so having explicit unittests seems better all round. Are you OK with a squash-merge? Do you want your name in the NEWS.rst and CONTRIB.rst?

@macraild

Copy link
Copy Markdown
Contributor Author

Yes, squash-merge is fine. I'm happy to have my name in NEWS and CONTRIB if you think it is warranted.

I need to be more careful when I edit these things via the Web Interface...
@peterjc
peterjc merged commit dd269a0 into biopython:master Aug 16, 2019
@peterjc

peterjc commented Aug 16, 2019

Copy link
Copy Markdown
Member

Thank you, applied.

peterjc added a commit to peterjc/biopython that referenced this pull request Nov 8, 2019
peterjc added a commit to peterjc/biopython that referenced this pull request Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants