chore: doc/style cleanup batch#34
Draft
hozblok wants to merge 1 commit into
Draft
Conversation
…ons) Combines three small cleanup items into one PR per the per-PR plan. None changes behaviour for normal callers. - src/formula/__init__.py: add `__all__ = ["FmtFlags", "Formula", "Solver", "Number", "MAX_PRECISION"]`. Pins the public API surface for `from formula import *` so accidental imports from submodules don't escape into the package namespace. (Doc item #18.) - boost_headers/update_command.py: wrap the top-level script body in `def main()` and gate the call with `if __name__ == "__main__":`. Lets IDEs, test discovery, and the zip-slip-guard tests (item #11 follow-up) import the module without triggering the argparse + download + rmtree flow. (Doc item #22.) - boost_headers/update_command.py: replace bare `Exception` raises with specific types — `ValueError` for bad input, `RuntimeError` for unexpected runtime state — so callers can catch by intent and pylint's `broad-exception-raised` stops firing. (Doc item #23.) Item #20 (Solver.__init__ useless-super-delegation) is intentionally deferred: PR fix/19-enforce-max-precision adds validation to that method, making it non-trivial. Removing the override here would conflict with #19 and remove the validation. Once #19 lands, the pylint suppression there can be dropped without further change. See ai/improvements_2026-05-09.md items #18, #22, #23 (and notes about #20). Co-Authored-By: Claude Opus 4.7 (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.
Combines three small cleanup items into one PR per the per-PR plan. None changes behaviour for normal callers.
src/formula/__init__.py: add__all__ = ["FmtFlags", "Formula", "Solver", "Number", "MAX_PRECISION"]. Pins the public API surface forfrom formula import *so accidental imports from submodules don't escape into the package namespace. (Doc item feat(Number)!: simpler API, reverse arithmetic, complex equality #18.)boost_headers/update_command.py: wrap the top-level script body indef main()and gate the call withif __name__ == "__main__":. Lets IDEs, test discovery, and any future zip-slip-guard tests import the module without triggering the argparse + download + rmtree flow. (Doc item refactor: stop mutating self.variables() in the one-variable shortcut #22.)boost_headers/update_command.py: replace bareExceptionraises with specific types —ValueErrorfor bad input,RuntimeErrorfor unexpected runtime state — so callers can catch by intent and pylint'sbroad-exception-raisedstops firing. (Doc item refactor: accumulate Number arithmetic symbolically #23.)Item #20 (Solver.init useless-super-delegation) is intentionally deferred from this batch. PR
fix/19-enforce-max-precision(#31) adds validation to that method, making it non-trivial; removing the override here would conflict with #19. Once #19 lands the pylint suppression can be dropped in a follow-up without further change.Full pytest suite 316/316. AST checks confirm:
mainis defined and there are no surviving top-level Call expressions; noraise Exception(remains;formula.__all__matches the expected list; the updated module is now importable without side effects.