Add docstrings to SequenceDataAbstractBaseClass magic methods#5240
Add docstrings to SequenceDataAbstractBaseClass magic methods#5240LuciPengu wants to merge 2 commits into
Conversation
Add missing one-line docstrings to the 13 magic methods of SequenceDataAbstractBaseClass in Bio/Seq.py, which previously triggered ruff's D105 "Missing docstring in magic method" check. First batch towards issue biopython#2116. The D105 entry in the ruff ignore list in .pre-commit-config.yaml is left in place for now, since other modules still contain undocumented magic methods.
There was a problem hiding this comment.
That suggests to me the return is bytes (but it is a sequence object), does any alternative wording come to mind?
| # by _PartiallyDefinedSequenceData.__radd__ | ||
|
|
||
| def __radd__(self, other): | ||
| """Return the concatenation of other and the sequence data as bytes.""" |
There was a problem hiding this comment.
You don't think something along the lines of 'add on the right' is relevant here - or following the Python string more closely?
| return bytes(self) >= other | ||
|
|
||
| def __add__(self, other): | ||
| """Return the concatenation of the sequence data and other as bytes.""" |
There was a problem hiding this comment.
I think something modelled after the Python string's docstring would be nicer.
|
Hi Neal, thank you for looking at this. I hope this question is just a formality, but is any of this AI generated? See ongoing discussion starting here: https://mailman.open-bio.org/pipermail/biopython/2026-April/017113.html |
I'm so sorry, I had no idea that generative AI wasn't allowed to be used in PRs, I used AI to help me understand the problem and I told it exactly what changes to do to the files as well as to help improve the markdown on my PR but nothing more than that |
|
It isn't official policy yet, but it might well be shortly - see #5241. Until that's settled we're not merging any AI PRs (and potentially will have to just close those currently waiting in limbo). |

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 run the style checkslocally, 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.)
This is a first batch towards #2116 (ruff
D105, "Missing docstring in magic method").It adds one-line docstrings to the 13 magic methods of
SequenceDataAbstractBaseClassinBio/Seq.py, following the existingimperative docstring style used elsewhere in that file. Running
ruff check Bio/Seq.py --select=D105now reports no violations.No behaviour is changed. The
D105entry is intentionally left in the ruffignore list in
.pre-commit-config.yaml, since other modules still containundocumented magic methods; that ignore can be removed in a later PR once
they are all documented.
Towards #2116