Skip to content

Commit 4430c8c

Browse files
fix: Make type annotation of UploadedCode consistent (#3839)
1 parent 0809b05 commit 4430c8c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/sagemaker/estimator.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ def __init__(
556556
self.code_location = code_location
557557
self.entry_point = entry_point
558558
self.dependencies = dependencies or []
559-
self.uploaded_code = None
559+
self.uploaded_code: Optional[UploadedCode] = None
560560
self.tags = add_jumpstart_tags(
561561
tags=tags, training_model_uri=self.model_uri, training_script_uri=self.source_dir
562562
)
@@ -839,7 +839,7 @@ def _script_mode_hyperparam_update(self, code_dir: str, script: str) -> None:
839839

840840
self._hyperparameters.update(EstimatorBase._json_encode_hyperparameters(hyperparams))
841841

842-
def _stage_user_code_in_s3(self) -> str:
842+
def _stage_user_code_in_s3(self) -> UploadedCode:
843843
"""Uploads the user training script to S3 and returns the S3 URI.
844844
845845
Returns: S3 URI
@@ -3135,7 +3135,7 @@ def __init__(
31353135
self.git_config = git_config
31363136
self.source_dir = source_dir
31373137
self.dependencies = dependencies or []
3138-
self.uploaded_code = None
3138+
self.uploaded_code: Optional[UploadedCode] = None
31393139

31403140
self.container_log_level = container_log_level
31413141
self.code_location = code_location

src/sagemaker/fw_utils.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737

3838
_TAR_SOURCE_FILENAME = "source.tar.gz"
3939

40-
UploadedCode = namedtuple("UserCode", ["s3_prefix", "script_name"])
41-
"""sagemaker.fw_utils.UserCode: An object containing the S3 prefix and script name.
40+
UploadedCode = namedtuple("UploadedCode", ["s3_prefix", "script_name"])
41+
"""sagemaker.fw_utils.UploadedCode: An object containing the S3 prefix and script name.
4242
This is for the source code used for the entry point with an ``Estimator``. It can be
4343
instantiated with positional or keyword arguments.
4444
"""
@@ -398,7 +398,7 @@ def tar_and_upload_dir(
398398
kms_key=None,
399399
s3_resource=None,
400400
settings: Optional[SessionSettings] = None,
401-
):
401+
) -> UploadedCode:
402402
"""Package source files and upload a compress tar file to S3.
403403
404404
The S3 location will be ``s3://<bucket>/s3_key_prefix/sourcedir.tar.gz``.
@@ -429,7 +429,7 @@ def tar_and_upload_dir(
429429
of the SageMaker ``Session``, can be used to override the default encryption
430430
behavior (default: None).
431431
Returns:
432-
sagemaker.fw_utils.UserCode: An object with the S3 bucket and key (S3 prefix) and
432+
sagemaker.fw_utils.UploadedCode: An object with the S3 bucket and key (S3 prefix) and
433433
script name.
434434
"""
435435
if directory and (is_pipeline_variable(directory) or directory.lower().startswith("s3://")):

0 commit comments

Comments
 (0)