Skip to content

Define Locus.__bool__ returning True (2.34.5) - #535

Merged
iskandr merged 1 commit into
mainfrom
fix/locus-bool-534
Nov 19, 2026
Merged

iskandr merged 1 commit into
mainfrom
fix/locus-bool-534

Conversation

@iskandr

@iskandr iskandr commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Define Locus.__bool__ returning True so bool(locus) / if transcript: evaluates in constant time instead of falling back to Transcript.__len__() and querying the exon SQLite table on cold or unindexed genomes.
  • Preserve len(locus) and len(transcript) unchanged.
  • Add regression tests covering Locus, Exon, offline restored Gene/Transcript instances (MissingLocalFile on db), and cold indexed Transcript instances with exons access forbidden.
  • Bump version to 2.34.5 with release notes.

Closes #534

- Return `True` from `Locus.__bool__` so truthiness checks on `Locus`, `Exon`,
  `Gene`, and `Transcript` evaluate in O(1) without falling back to `__len__()`
  and opening the `exon` SQLite table via `Transcript.exons`.
- Add regression tests for `Locus`, `Exon`, offline restored `Gene`/`Transcript`,
  and cold `Transcript` instances with `exons` forbidden.
- Bump version to `2.34.5` with release notes.

Closes #534
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 93.665% (+0.002%) from 93.663% — fix/locus-bool-534 into main

@iskandr
iskandr merged commit 69eac96 into main Nov 19, 2026
9 checks passed
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.

Locus / Transcript lacks __bool__, so bool(transcript) queries the SQLite exon table via __len__

2 participants