Skip to content

fix(codegen): restore codestyle-doc-tests compliance after botocore sync - #6523

Merged
rsareddy0329 merged 3 commits into
aws:masterfrom
rsareddy0329:fix/resources-black-format
Oct 28, 2026
Merged

rsareddy0329 merged 3 commits into
aws:masterfrom
rsareddy0329:fix/resources-black-format

Conversation

@rsareddy0329

Copy link
Copy Markdown
Contributor

Issue

codestyle-doc-tests (sagemaker-core) fails black-check on master: the generated sagemaker-core/src/sagemaker/core/resources.py has two blank lines between the import block and the module logger, which black collapses to one.

Root cause: the import block ends with "\n\n" and LOGGER_STRING (in tools/constants.py) began with a leading "\n", so together they emit an extra blank line.

Description of changes

  • tools/constants.py — drop the leading newline from LOGGER_STRING so the code generator no longer emits the double blank line. This keeps regenerated resources.py black-clean and prevents the next daily Botocore sync from reintroducing the failure (durable fix).
  • resources.py — reformat the currently-committed generated file to match.

Formatting/codegen only — no functional change.

Testing done

With the CI-pinned black==26.3.1 under Python 3.12:

  • black --check on resources.py and constants.py → rc 0
  • flake8 and pydocstyle on both files → clean
  • No unit test pinned the old LOGGER_STRING value.

Note for maintainers

black emitted a "cannot parse code formatted for Python 3.14 … use --target-version or --fast" safety-check warning on resources.py. If the daily-sync black step hit the same warning, black would have skipped reformatting (it won't write when the AST safety check fails unless --fast), which is likely why the extra blank line slipped into the committed file. Worth pinning --target-version/--fast in the sync's black step.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

The generated sagemaker-core resources.py had two blank lines between the
import block and the module logger, which black collapses to one — failing
codestyle-doc-tests (sagemaker-core) black-check. The import block ends
with "\n\n" and LOGGER_STRING began with a leading newline, so together
they emitted the extra blank line.

- tools/constants.py: drop the leading newline from LOGGER_STRING so
  regenerated resources.py is black-clean (durable fix; prevents the next
  daily Botocore sync from reintroducing it).
- resources.py: reformat the currently-committed file to match.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI code review

The PR removes a leading newline from LOGGER_STRING in tools/constants.py so the code generator emits a single blank line (not two) between the import block and the module logger, and reformats the committed resources.py to match. I verified the assembly logic in resources_codegen.py: generate_imports() appends "\n\n" (line 213) and generate_logging() returns LOGGER_STRING immediately after, so the former leading "\n" produced the double blank line that black collapses. The fix is correct, minimal, and purely formatting/codegen with no functional change. Looks clean.

Reviewed commit 60ce4c8. Automated review; verify before acting.

The daily Botocore sync (aws#6520) regenerated config_schema.py and
shape_dag.py without their module docstrings, failing
codestyle-doc-tests (sagemaker-core) docstyle (pydocstyle D100: missing
docstring in public module).

- config_schema.py / shape_dag.py: restore the module docstrings.
- tools/resources_codegen.py / tools/shapes_extractor.py: emit the module
  docstring when generating these files so future daily syncs stay
  docstyle-clean (durable fix).
@rsareddy0329 rsareddy0329 changed the title fix(codegen): avoid double blank line before logger in resources.py fix(codegen): restore codestyle-doc-tests compliance after botocore sync Oct 22, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI code review

This PR is a codegen/formatting fix to restore codestyle-doc-tests (black-check) compliance in sagemaker-core. It drops the leading newline from LOGGER_STRING so the generator stops emitting a double blank line between the import block and logger in resources.py, and adds module docstrings to the generators for config_schema.py and shape_dag.py, updating the committed generated files to match. I verified the generator logic (generate_imports ends with \n\n, so removing LOGGER_STRING's leading \n yields exactly one blank line), confirmed the output path for config_schema.py is the top-level file edited here, and confirmed no unit tests pin these generated strings. The generator and the committed generated files stay in sync. The change is clean and correctly scoped; I found no issues worth blocking.

Reviewed commit 5df72aa. Automated review; verify before acting.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI code review

This PR fixes codestyle-doc-tests on the generated sagemaker-core files. It removes a leading newline from LOGGER_STRING so the import block and logger assignment in generated resources.py are separated by a single blank line (black-clean), and reformats the committed resources.py to match. It also adds module docstrings to the generated config_schema.py and shape_dag.py (and the corresponding codegen writers) — these two files are not excluded from pydocstyle's match pattern (unlike resources.py/shapes.py), so they require a D100 module docstring. I verified the pydocstyle config, the codegen flow, and that no tests pin the old generated content. The change is correct, consistent between generator and committed output, and well-scoped. No issues found.

Reviewed commit 4301369. Automated review; verify before acting.

@rsareddy0329
rsareddy0329 merged commit 200b6f5 into aws:master Oct 28, 2026
29 of 30 checks passed

This branch was successfully deployed

1 active deployment
auto-approve — 43013693 Deployed Oct 27, 2026 by rsareddy0329 via wait-for-approval #763
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.

2 participants