diff --git a/.pydocstylerc b/.pydocstylerc index 63e3a35b70..a5083c0d63 100644 --- a/.pydocstylerc +++ b/.pydocstylerc @@ -1,4 +1,4 @@ [pydocstyle] inherit = false -ignore = D104,D107,D202,D203,D212,D213,D214,D400,D401,D404,D406,D407,D411,D413,D414,D415,D417 +ignore = D104,D107,D202,D203,D213,D214,D400,D401,D404,D406,D407,D411,D413,D414,D415,D417 match = (?!record_pb2).*\.py diff --git a/src/sagemaker/amazon/factorization_machines.py b/src/sagemaker/amazon/factorization_machines.py index b1f9dc1747..3659c363bd 100644 --- a/src/sagemaker/amazon/factorization_machines.py +++ b/src/sagemaker/amazon/factorization_machines.py @@ -290,8 +290,7 @@ def __init__( serializer=RecordSerializer(), deserializer=RecordDeserializer(), ): - """ - Initialization for FactorizationMachinesPredictor class. + """Initialization for FactorizationMachinesPredictor class. Args: endpoint_name (str): Name of the Amazon SageMaker endpoint to which @@ -321,8 +320,7 @@ class FactorizationMachinesModel(Model): """ def __init__(self, model_data, role, sagemaker_session=None, **kwargs): - """ - Initialization for FactorizationMachinesModel class. + """Initialization for FactorizationMachinesModel class. Args: model_data (str): The S3 location of a SageMaker model data diff --git a/src/sagemaker/amazon/ipinsights.py b/src/sagemaker/amazon/ipinsights.py index e86f627e78..5b1681e6c3 100644 --- a/src/sagemaker/amazon/ipinsights.py +++ b/src/sagemaker/amazon/ipinsights.py @@ -193,9 +193,9 @@ def __init__( serializer=CSVSerializer(), deserializer=JSONDeserializer(), ): - """ - Args: + """Creates object to be used to get dot product of entity nad IP address. + Args: endpoint_name (str): Name of the Amazon SageMaker endpoint to which requests are sent. sagemaker_session (sagemaker.session.Session): A SageMaker Session @@ -223,9 +223,9 @@ class IPInsightsModel(Model): """ def __init__(self, model_data, role, sagemaker_session=None, **kwargs): - """ - Args: + """Creates object to get insights on S3 model data. + Args: model_data (str): The S3 location of a SageMaker model data ``.tar.gz`` file. role (str): An AWS IAM role (either name or full ARN). The Amazon diff --git a/src/sagemaker/amazon/kmeans.py b/src/sagemaker/amazon/kmeans.py index 4c26bb846e..a7b7c5fd9a 100644 --- a/src/sagemaker/amazon/kmeans.py +++ b/src/sagemaker/amazon/kmeans.py @@ -217,8 +217,7 @@ def __init__( serializer=RecordSerializer(), deserializer=RecordDeserializer(), ): - """ - Initialization for KMeansPredictor class. + """Initialization for KMeansPredictor class. Args: endpoint_name (str): Name of the Amazon SageMaker endpoint to which @@ -248,8 +247,7 @@ class KMeansModel(Model): """ def __init__(self, model_data, role, sagemaker_session=None, **kwargs): - """ - Initialization for KMeansModel class. + """Initialization for KMeansModel class. Args: model_data (str): The S3 location of a SageMaker model data diff --git a/src/sagemaker/amazon/knn.py b/src/sagemaker/amazon/knn.py index 089d1427f3..760db42d05 100644 --- a/src/sagemaker/amazon/knn.py +++ b/src/sagemaker/amazon/knn.py @@ -209,8 +209,7 @@ def __init__( serializer=RecordSerializer(), deserializer=RecordDeserializer(), ): - """ - Function to initialize KNNPredictor. + """Function to initialize KNNPredictor. Args: endpoint_name (str): Name of the Amazon SageMaker endpoint to which @@ -240,8 +239,7 @@ class KNNModel(Model): """ def __init__(self, model_data, role, sagemaker_session=None, **kwargs): - """ - Function to initialize KNNModel. + """Function to initialize KNNModel. Args: model_data (str): The S3 location of a SageMaker model data diff --git a/src/sagemaker/amazon/lda.py b/src/sagemaker/amazon/lda.py index ffd7cd7c4f..c7437e2e68 100644 --- a/src/sagemaker/amazon/lda.py +++ b/src/sagemaker/amazon/lda.py @@ -53,8 +53,7 @@ def __init__( tol=None, **kwargs ): - """ - Latent Dirichlet Allocation (LDA) is :class:`Estimator` used for unsupervised learning. + """Latent Dirichlet Allocation (LDA) is :class:`Estimator` used for unsupervised learning. Amazon SageMaker Latent Dirichlet Allocation is an unsupervised learning algorithm that attempts to describe a set of observations as a @@ -192,9 +191,9 @@ def __init__( serializer=RecordSerializer(), deserializer=RecordDeserializer(), ): - """ - Args: + """Creates "LDAPredictor" object to be used for transforming input vectors. + Args: endpoint_name (str): Name of the Amazon SageMaker endpoint to which requests are sent. sagemaker_session (sagemaker.session.Session): A SageMaker Session @@ -222,8 +221,7 @@ class LDAModel(Model): """ def __init__(self, model_data, role, sagemaker_session=None, **kwargs): - """ - Initialization for LDAModel class. + """Initialization for LDAModel class. Args: model_data (str): The S3 location of a SageMaker model data diff --git a/src/sagemaker/amazon/linear_learner.py b/src/sagemaker/amazon/linear_learner.py index 85e85ee0d7..3f29c0da02 100644 --- a/src/sagemaker/amazon/linear_learner.py +++ b/src/sagemaker/amazon/linear_learner.py @@ -452,8 +452,7 @@ def __init__( serializer=RecordSerializer(), deserializer=RecordDeserializer(), ): - """ - Initialization for LinearLearnerPredictor. + """Initialization for LinearLearnerPredictor. Args: endpoint_name (str): Name of the Amazon SageMaker endpoint to which @@ -483,8 +482,7 @@ class LinearLearnerModel(Model): """ def __init__(self, model_data, role, sagemaker_session=None, **kwargs): - """ - Initialization for LinearLearnerModel. + """Initialization for LinearLearnerModel. Args: model_data (str): The S3 location of a SageMaker model data diff --git a/src/sagemaker/amazon/ntm.py b/src/sagemaker/amazon/ntm.py index b859fdeb6e..2c3b4d2b06 100644 --- a/src/sagemaker/amazon/ntm.py +++ b/src/sagemaker/amazon/ntm.py @@ -220,8 +220,7 @@ def __init__( serializer=RecordSerializer(), deserializer=RecordDeserializer(), ): - """ - Initialization for NTMPredictor class. + """Initialization for NTMPredictor class. Args: endpoint_name (str): Name of the Amazon SageMaker endpoint to which @@ -251,8 +250,7 @@ class NTMModel(Model): """ def __init__(self, model_data, role, sagemaker_session=None, **kwargs): - """ - Initialization for NTMModel class. + """Initialization for NTMModel class. Args: model_data (str): The S3 location of a SageMaker model data diff --git a/src/sagemaker/amazon/object2vec.py b/src/sagemaker/amazon/object2vec.py index 94552cb54f..aeaf0614c1 100644 --- a/src/sagemaker/amazon/object2vec.py +++ b/src/sagemaker/amazon/object2vec.py @@ -345,8 +345,7 @@ class Object2VecModel(Model): """ def __init__(self, model_data, role, sagemaker_session=None, **kwargs): - """ - Initialization for Object2VecModel class. + """Initialization for Object2VecModel class. Args: model_data (str): The S3 location of a SageMaker model data diff --git a/src/sagemaker/amazon/pca.py b/src/sagemaker/amazon/pca.py index 451992e577..b105a2abc5 100644 --- a/src/sagemaker/amazon/pca.py +++ b/src/sagemaker/amazon/pca.py @@ -208,8 +208,7 @@ def __init__( serializer=RecordSerializer(), deserializer=RecordDeserializer(), ): - """ - Initialization for PCAPredictor. + """Initialization for PCAPredictor. Args: endpoint_name (str): Name of the Amazon SageMaker endpoint to which @@ -239,8 +238,7 @@ class PCAModel(Model): """ def __init__(self, model_data, role, sagemaker_session=None, **kwargs): - """ - Initialization for PCAModel. + """Initialization for PCAModel. Args: model_data (str): The S3 location of a SageMaker model data diff --git a/src/sagemaker/amazon/randomcutforest.py b/src/sagemaker/amazon/randomcutforest.py index 7f2a4654ab..aef93baf9c 100644 --- a/src/sagemaker/amazon/randomcutforest.py +++ b/src/sagemaker/amazon/randomcutforest.py @@ -180,8 +180,7 @@ def __init__( serializer=RecordSerializer(), deserializer=RecordDeserializer(), ): - """ - Initialization for RandomCutForestPredictor class. + """Initialization for RandomCutForestPredictor class. Args: endpoint_name (str): Name of the Amazon SageMaker endpoint to which @@ -211,8 +210,7 @@ class RandomCutForestModel(Model): """ def __init__(self, model_data, role, sagemaker_session=None, **kwargs): - """ - Initialization for RandomCutForestModel class. + """Initialization for RandomCutForestModel class. Args: model_data (str): The S3 location of a SageMaker model data diff --git a/src/sagemaker/clarify.py b/src/sagemaker/clarify.py index 9691ab3283..3268d87a17 100644 --- a/src/sagemaker/clarify.py +++ b/src/sagemaker/clarify.py @@ -262,8 +262,7 @@ def __init__( use_logit=False, save_local_shap_values=True, ): - """ - Initializes config for SHAP. + """Initializes config for SHAP. Args: baseline (str or list): A list of rows (at least one) or S3 object URI to be used as diff --git a/src/sagemaker/debugger/framework_profile.py b/src/sagemaker/debugger/framework_profile.py index 8676fc2b94..1d50141c9d 100644 --- a/src/sagemaker/debugger/framework_profile.py +++ b/src/sagemaker/debugger/framework_profile.py @@ -38,8 +38,7 @@ class FrameworkProfile: - """ - Sets up the profiling configuration for framework metrics. + """Sets up the profiling configuration for framework metrics. Validates user inputs and fills in default values if no input is provided. There are three main profiling options to choose from: diff --git a/src/sagemaker/estimator.py b/src/sagemaker/estimator.py index f3dee93c20..aa8b96225d 100644 --- a/src/sagemaker/estimator.py +++ b/src/sagemaker/estimator.py @@ -1570,8 +1570,7 @@ def _get_update_args(cls, estimator, profiler_rule_configs, profiler_config): return update_args def wait(self, logs="All"): - """ - Placeholder docstring. + """Placeholder docstring. Args: logs ([str]): A list of strings specifying which logs to print. Acceptable diff --git a/src/sagemaker/pytorch/estimator.py b/src/sagemaker/pytorch/estimator.py index 5da7a4036c..2661b4e7ce 100644 --- a/src/sagemaker/pytorch/estimator.py +++ b/src/sagemaker/pytorch/estimator.py @@ -51,8 +51,7 @@ def __init__( distribution=None, **kwargs ): - """ - This ``Estimator`` executes an PyTorch script in a managed PyTorch execution environment. + """This ``Estimator`` executes a PyTorch script in a managed PyTorch execution environment. The managed PyTorch environment is an Amazon-built Docker container that executes functions defined in the supplied ``entry_point`` Python script within a SageMaker Training Job. diff --git a/src/sagemaker/pytorch/model.py b/src/sagemaker/pytorch/model.py index d03c0caaeb..7dcc645e35 100644 --- a/src/sagemaker/pytorch/model.py +++ b/src/sagemaker/pytorch/model.py @@ -272,8 +272,7 @@ def serving_image_uri(self, region_name, instance_type, accelerator_type=None): ) def _is_mms_version(self): - """ - Determines if the framework corresponds to an and using MMS. + """Determines if the framework corresponds to an and using MMS. Whether the framework version corresponds to an inference image using the Multi-Model Server (https://github.com/awslabs/multi-model-server). diff --git a/src/sagemaker/session.py b/src/sagemaker/session.py index 3b02086487..0a86228bd8 100644 --- a/src/sagemaker/session.py +++ b/src/sagemaker/session.py @@ -2029,14 +2029,13 @@ def create_tuning_job( self.sagemaker_client.create_hyper_parameter_tuning_job(**tune_request) def describe_tuning_job(self, job_name): - """ - Calls the DescribeHyperParameterTuningJob API for the given job name, returns the response. + """Calls DescribeHyperParameterTuningJob API for the given job name, returns the response. - Args: - job_name (str): The name of the hyperparameter tuning job to describe. + Args: + job_name (str): The name of the hyperparameter tuning job to describe. - Returns: - dict: A dictionary response with the hyperparameter tuning job description. + Returns: + dict: A dictionary response with the hyperparameter tuning job description. """ return self.sagemaker_client.describe_hyper_parameter_tuning_job( HyperParameterTuningJobName=job_name @@ -2053,8 +2052,7 @@ def _map_tuning_config( objective_metric_name=None, parameter_ranges=None, ): - """ - Construct tuning job configuration dictionary. + """Construct tuning job configuration dictionary. Args: strategy (str): Strategy to be used for hyperparameter estimations. @@ -2097,8 +2095,7 @@ def _map_tuning_config( @classmethod def _map_tuning_objective(cls, objective_type, objective_metric_name): - """ - Construct a dictionary of tuning objective from the arguments. + """Construct a dictionary of tuning objective from the arguments. Args: objective_type (str): The type of the objective metric for evaluating training jobs. @@ -2148,8 +2145,7 @@ def _map_training_config( checkpoint_s3_uri=None, checkpoint_local_path=None, ): - """ - Construct a dictionary of training job configuration from the arguments. + """Construct a dictionary of training job configuration from the arguments. Args: static_hyperparameters (dict): Hyperparameters for model training. These diff --git a/src/sagemaker/sklearn/estimator.py b/src/sagemaker/sklearn/estimator.py index 9ab4070909..7d683cf692 100644 --- a/src/sagemaker/sklearn/estimator.py +++ b/src/sagemaker/sklearn/estimator.py @@ -45,8 +45,7 @@ def __init__( image_uri=None, **kwargs ): - """ - Creates a SKLearn Estimator for Scikit-learn environment. + """Creates a SKLearn Estimator for Scikit-learn environment. It will execute an Scikit-learn script within a SageMaker Training Job. The managed Scikit-learn environment is an Amazon-built Docker container that executes functions diff --git a/src/sagemaker/tensorflow/estimator.py b/src/sagemaker/tensorflow/estimator.py index dc2e7c0cb5..28342c7404 100644 --- a/src/sagemaker/tensorflow/estimator.py +++ b/src/sagemaker/tensorflow/estimator.py @@ -265,8 +265,7 @@ def create_model( dependencies=None, **kwargs ): - """ - Create a ``TensorFlowModel`` object that can be used for creating SageMaker model entities. + """Creates ``TensorFlowModel`` object to be used for creating SageMaker model entities. This can be done by deploying it to a SageMaker endpoint, or starting SageMaker Batch Transform jobs. diff --git a/src/sagemaker/utils.py b/src/sagemaker/utils.py index b4b1499076..5ed75fe380 100644 --- a/src/sagemaker/utils.py +++ b/src/sagemaker/utils.py @@ -570,8 +570,7 @@ def _botocore_resolver(): def _aws_partition(region): - """ - Given a region name (ex: "cn-north-1"), return the corresponding aws partition ("aws-cn"). + """Given a region name (ex: "cn-north-1"), return the corresponding aws partition ("aws-cn"). Args: region (str): The region name for which to return the corresponding partition. diff --git a/src/sagemaker/workflow/airflow.py b/src/sagemaker/workflow/airflow.py index 4b4d0291eb..58caeea108 100644 --- a/src/sagemaker/workflow/airflow.py +++ b/src/sagemaker/workflow/airflow.py @@ -388,8 +388,7 @@ def _extract_training_config_from_estimator(tuner, inputs, include_cls_metadata, def _extract_training_config_list_from_estimator_dict( tuner, inputs, include_cls_metadata, mini_batch_size ): - """ - Extracts a list of training job configs from a Hyperparameter Tuner. + """Extracts a list of training job configs from a Hyperparameter Tuner. It uses the ``estimator_dict`` field. """ @@ -511,8 +510,7 @@ def update_estimator_from_task(estimator, task_id, task_type): def prepare_framework_container_def(model, instance_type, s3_operations): - """ - This prepares the framework model container information and specifies related S3 operations. + """This prepares the framework model container information and specifies related S3 operations. Prepare the framework model container information. Specify related S3 operations for Airflow to perform. (Upload `source_dir` )