ReactionMechanismGenerator / ReactionMechanismGenerator/ARC
Level: unify the 'does this level carry meaningful args?' predicate between __str__ and as_dict()
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 51
- Forks
- 25
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 15
Description
Follow-up to #963, which was deliberately scoped to the as_dict() round-trip.
Level now answers the same question two different ways:
arc/level.py:200(as_dict):any(v for v in self.args.values())— retainsargswhen at least one of thekeyword/blockslots holds content (this is what #963 fixed).arc/level.py:152(__str__):all([val for val in self.args.values()])— requires both slots to be populated.
Consequence: a keyword-only level (the common case, e.g. args={'keyword': {'opt': 'opt=(verytight)'}}) serialises its args correctly but stays silent about them in its string representation, so the args are invisible in logs and in anything that renders a level via str().
This is cosmetic — it affects log/repr text only, not the round-trip or job args — but the divergence is a trap for the next reader.
Suggested fix: extract one named helper (e.g. Level.has_args() -> bool) returning bool(self.args) and any(v for v in self.args.values()), and call it from both sites. A unit test asserting that a keyword-only level shows its keyword args in str(level) would pin the behaviour.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in arc/level.py at str (line 152) and as_dict() (line 200), then inspect the existing Level unit tests. Define one shared meaningful-args predicate and use it at both entry points. Done means a keyword-only level includes its keyword args in str(level) while as_dict() behavior remains covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100