Skip to content

refactor(bfabric_scripts): trim the api command internals - #616

Draft
leoschwarz wants to merge 2 commits into
mainfrom
refactor/api-cli-trim
Draft

refactor(bfabric_scripts): trim the api command internals#616
leoschwarz wants to merge 2 commits into
mainfrom
refactor/api-cli-trim

Conversation

@leoschwarz

Copy link
Copy Markdown
Member

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 unused duplicates="drop" mode and its three overloads, a dead __all__ re-export shim, and an eval() that built a client.read call as an f-string only to log it. Net -70 production lines.

That eval was also masking perform_query's return type, annotated list[ApiResponseObjectType] while returning a ResultContainer.

Groundwork for #159, whose PR is stacked on this one.

🤖 Prepared with assistance from Claude Opus 5 via Claude Code.

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.
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.

1 participant