Repository navigation
fix(codegen): restore codestyle-doc-tests compliance after botocore sync - #6523
Conversation
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.
There was a problem hiding this comment.
🤖 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).
There was a problem hiding this comment.
🤖 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.
There was a problem hiding this comment.
🤖 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.
Issue
codestyle-doc-tests (sagemaker-core)failsblack-checkonmaster: the generatedsagemaker-core/src/sagemaker/core/resources.pyhas two blank lines between the import block and the modulelogger, which black collapses to one.Root cause: the import block ends with
"\n\n"andLOGGER_STRING(intools/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 fromLOGGER_STRINGso the code generator no longer emits the double blank line. This keeps regeneratedresources.pyblack-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.1under Python 3.12:black --checkonresources.pyandconstants.py→ rc 0flake8andpydocstyleon both files → cleanLOGGER_STRINGvalue.Note for maintainers
black emitted a
"cannot parse code formatted for Python 3.14 … use --target-version or --fast"safety-check warning onresources.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/--fastin 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.