refactor(bfabric_scripts): trim the api command internals - #616
Draft
leoschwarz wants to merge 2 commits into
Draft
refactor(bfabric_scripts): trim the api command internals#616leoschwarz wants to merge 2 commits into
leoschwarz wants to merge 2 commits into
Conversation
Removes excess from bfabric_scripts/cli/api/ ahead of adding JSON input to the api commands, so that feature lands net-negative overall. - parser.py / inspect.py: drop the Google-style Args:/Returns: blocks that AGENTS.md rules out, the comments that restate the line below them, and ConfigDict(arbitrary_types_allowed=True) on two models whose fields are all standard types. Kept every comment that explains *why* (the engine guard, the minOccurs/maxOccurs XSD defaults). - query_repr.py: drop to_dict's three @Overloads and its duplicates="drop" mode, which no production caller used, for one uniform return type. - read.py: drop a dead __all__ re-export shim, and stop routing client.read through eval() -- it built the call as an f-string purely to log the equivalent Python, which the log string still does. That eval was also masking perform_query's return type, annotated list[ApiResponseObjectType] while returning a ResultContainer. - create.py / update.py: fold their identical render_output tail into render_saved() in output_format.py. _confirm_action takes a Mapping[str, object] now: it only logs and pretty- prints the attributes, and an invariant dict annotation forced a needless exact match on the value type.
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.
Internal cleanup of
bfabric_scripts/cli/api/, no behaviour change. Drops the Google-style docstring blocks and code-narrating comments AGENTS.md rules out,to_dict's unusedduplicates="drop"mode and its three overloads, a dead__all__re-export shim, and aneval()that built aclient.readcall as an f-string only to log it. Net -70 production lines.That
evalwas also maskingperform_query's return type, annotatedlist[ApiResponseObjectType]while returning aResultContainer.Groundwork for #159, whose PR is stacked on this one.
🤖 Prepared with assistance from Claude Opus 5 via Claude Code.