Skip to content

Commit 200b6f5

Browse files
rsareddy0329Roja Reddy Sareddy
andauthored
fix(codegen): restore codestyle-doc-tests compliance after botocore sync (#6523)
* fix(codegen): avoid double blank line before logger in resources.py 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. * fix(codegen): restore module docstrings in config_schema and shape_dag The daily Botocore sync (#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). --------- Co-authored-by: Roja Reddy Sareddy <rsareddy@amazon.com>
1 parent f43ed99 commit 200b6f5

6 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎sagemaker-core/src/sagemaker/core/config_schema.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""JSON schema definition for the SageMaker Python SDK configuration file."""
2+
13
SAGEMAKER_PYTHON_SDK_CONFIG_SCHEMA = {
24
"$schema": "https://json-schema.org/draft/2020-12/schema",
35
"type": "object",

‎sagemaker-core/src/sagemaker/core/resources.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
from sagemaker.core.serializers.base import BaseSerializer
4747
from sagemaker.core.deserializers.base import BaseDeserializer
4848

49-
5049
logger = get_textual_rich_logger(__name__)
5150

5251

‎sagemaker-core/src/sagemaker/core/tools/constants.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@
7878
# language governing permissions and limitations under the License.
7979
"""
8080

81-
LOGGER_STRING = """
82-
logger = get_textual_rich_logger(__name__)
81+
LOGGER_STRING = """logger = get_textual_rich_logger(__name__)
8382
8483
"""
8584

‎sagemaker-core/src/sagemaker/core/tools/resources_codegen.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2115,6 +2115,7 @@ def generate_config_schema(self) -> str:
21152115
with open(output, "w") as file:
21162116
# Generate and write the license to the file
21172117
file.write(
2118+
'"""JSON schema definition for the SageMaker Python SDK configuration file."""\n\n'
21182119
f"SAGEMAKER_PYTHON_SDK_CONFIG_SCHEMA = {json.dumps(combined_config_schema, indent=4)}"
21192120
)
21202121

‎sagemaker-core/src/sagemaker/core/tools/shapes_extractor.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def __init__(self, combined_shapes: Optional[dict] = None):
4343

4444
self.shape_dag = self.get_shapes_dag()
4545
with open(SHAPE_DAG_FILE_PATH, "w") as f:
46+
f.write('"""Generated shape dependency graph used for serialization."""\n\n')
4647
f.write("SHAPE_DAG=")
4748
f.write(textwrap.indent(pprint.pformat(self.shape_dag, width=1), "") + "\n")
4849
reformat_file_with_black(SHAPE_DAG_FILE_PATH)

‎sagemaker-core/src/sagemaker/core/utils/code_injection/shape_dag.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Generated shape dependency graph used for serialization."""
2+
13
SHAPE_DAG = {
24
"AIAdapterModelPackageEntry": {
35
"members": [

0 commit comments

Comments
 (0)