Repository navigation
Main - #25
Merged
Merged
Main#25
Conversation
rpReaction.build() (used when loading reactions back from an rpSBML
file) passed the raw MIRIAM annotation list straight through as
`miriam`, while every type hint, docstring and the ec-code dict access
in __init__ treat it as a Dict. So get_miriam() returned a list for
SBML-imported reactions but a dict for directly-constructed ones.
- rpSBML.convert_miriam_to_dict(): fix the regex to accept hyphens in
the database segment (it silently dropped "ec-code" entries, since
'-' isn't a word character) and dots/colons/hyphens in the reference
segment (EC numbers like "1.2.3.-" were truncated to "1").
- rpReaction.build(): use convert_miriam_to_dict() to build a proper
{"ec-code": [...], "uniprot": [...], ...} dict instead of passing
the raw annotation list through.
- rpPathway.to_rpSBML(): the reaction cross-references written back
out only ever included "ec-code", silently dropping any other miriam
entry (e.g. "uniprot" from selenzy) on every write. Now all entries
in get_miriam() are carried over, with ec_numbers kept as the
authoritative "ec-code" source since it's populated regardless of
how the reaction was constructed.
This was blocking adding UniProt IDs from selenzy_wrapper: they were
already present in existing rpSBML files but got reduced to a list
nobody could index into, and wouldn't have survived being written back
out even once get_miriam() was fixed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Adds explicit coverage for the miriam dict fix (373fad4): reading ec-code + uniprot annotations off tests/data/lycopene.sbml as a proper dict, and a write -> read round-trip confirming every miriam entry (not just ec-code) survives to_rpSBML(). Verified both fail with AttributeError: 'list' object has no attribute 'keys' against the pre-fix code. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Addresses B006/B008 (mutable/function-call defaults), RUF012/RUF013 (implicit Optional, mutable class defaults), RUF015/RUF059 (iterable allocation, unused unpacked vars), SIM102/103/114/118/201 (simplify-able conditionals), PLR1722 (sys.exit), BLE001, C403/405/408 and the two false-positive EXE001/EXE005 shebang hits (triggered by a "#!!!!" comment, not an actual shebang) found by the lint CI job. Loggers now default to a module-level singleton instead of calling getLogger() in the signature, consistently across rpObject, rpCompound, rpGraph, rpReaction, rpPathway, rpSBML and cobra_format. Two of the mutable-default fixes are real bugs, not just style: both rpPathway.to_rpSBML()'s local_cache and rpReaction.__init__'s reactants/products/miriam were shared, process-lifetime dicts that get written into in place elsewhere in the same call graph. Any caller relying on the default (to_rpSBML() with no local_cache, several exist across rpScore/rpThermo) would have silently accumulated species-ID remappings across unrelated pathway conversions. The three intentional blind `except Exception` catches (malformed/ missing XML annotations, non-literal eval() fallback) are annotated with `# noqa: BLE001` plus a comment rather than narrowed, since the precise exception types libsbml/eval() can raise here aren't reliably documented. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
CI ran an unpinned `pip install ruff`, so lint results silently depended on whichever ruff version happened to be latest at run time. Declare the exact rule codes the CI run actually flagged (and we just fixed) in pyproject.toml, so the active rule set no longer drifts with ruff's own evolving defaults. N999 (invalid module name) is suppressed per public-API module (rpSBML, rpPathway, rpReaction, rpCompound, rpGraph, rpObject, inchikeyMIRIAM), since renaming any of them would break every downstream consumer's `from rplibs import ...`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.