Skip to content

Commit 791ddf5

Browse files
committed
address linters
1 parent 403fe78 commit 791ddf5

14 files changed

+18
-58
lines changed

src/sagemaker/amazon/factorization_machines.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,7 @@ def __init__(
212212
:class:`~sagemaker.estimator.amazon_estimator.AmazonAlgorithmEstimatorBase` and
213213
:class:`~sagemaker.estimator.EstimatorBase`.
214214
"""
215-
super(FactorizationMachines, self).__init__(
216-
role, instance_count, instance_type, **kwargs
217-
)
215+
super(FactorizationMachines, self).__init__(role, instance_count, instance_type, **kwargs)
218216

219217
self.num_factors = num_factors
220218
self.predictor_type = predictor_type

src/sagemaker/amazon/linear_learner.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,7 @@ def __init__(
325325
:class:`~sagemaker.estimator.amazon_estimator.AmazonAlgorithmEstimatorBase` and
326326
:class:`~sagemaker.estimator.EstimatorBase`.
327327
"""
328-
super(LinearLearner, self).__init__(
329-
role, instance_count, instance_type, **kwargs
330-
)
328+
super(LinearLearner, self).__init__(role, instance_count, instance_type, **kwargs)
331329
self.predictor_type = predictor_type
332330
self.binary_classifier_model_selection_criteria = binary_classifier_model_selection_criteria
333331
self.target_recall = target_recall

src/sagemaker/amazon/randomcutforest.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@ def __init__(
112112
:class:`~sagemaker.estimator.EstimatorBase`.
113113
"""
114114

115-
super(RandomCutForest, self).__init__(
116-
role, instance_count, instance_type, **kwargs
117-
)
115+
super(RandomCutForest, self).__init__(role, instance_count, instance_type, **kwargs)
118116
self.num_samples_per_tree = num_samples_per_tree
119117
self.num_trees = num_trees
120118
self.eval_metrics = eval_metrics

src/sagemaker/job.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ def _load_config(inputs, estimator, expand_role=True, validate_uri=True):
8989
estimator.volume_size,
9090
estimator.volume_kms_key,
9191
)
92-
stop_condition = _Job._prepare_stop_condition(
93-
estimator.max_run, estimator.max_wait
94-
)
92+
stop_condition = _Job._prepare_stop_condition(estimator.max_run, estimator.max_wait)
9593
vpc_config = estimator.get_vpc_config()
9694

9795
model_channel = _Job._prepare_channel(

src/sagemaker/session.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ def train( # noqa: C901
567567
if encrypt_inter_container_traffic:
568568
train_request["EnableInterContainerTrafficEncryption"] = encrypt_inter_container_traffic
569569

570-
if train_use_spot_instances:
570+
if use_spot_instances:
571571
train_request["EnableManagedSpotTraining"] = use_spot_instances
572572

573573
if checkpoint_s3_uri:

tests/unit/test_chainer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def _chainer_estimator(
115115
)
116116

117117

118-
def _create_job(version, py_version):
118+
def _create_train_job(version, py_version):
119119
return {
120120
"image_uri": _get_full_cpu_image_uri(version, py_version),
121121
"input_mode": "File",

tests/unit/test_kmeans.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ def sagemaker_session():
6464

6565

6666
def test_init_required_positional(sagemaker_session):
67-
kmeans = KMeans(
68-
ROLE, INSTANCE_COUNT, INSTANCE_TYPE, K, sagemaker_session=sagemaker_session
69-
)
67+
kmeans = KMeans(ROLE, INSTANCE_COUNT, INSTANCE_TYPE, K, sagemaker_session=sagemaker_session)
7068
assert kmeans.role == ROLE
7169
assert kmeans.instance_count == INSTANCE_COUNT
7270
assert kmeans.instance_type == INSTANCE_TYPE
@@ -76,7 +74,7 @@ def test_init_required_positional(sagemaker_session):
7674
def test_init_required_named(sagemaker_session):
7775
kmeans = KMeans(sagemaker_session=sagemaker_session, **ALL_REQ_ARGS)
7876

79-
assert kmeans.role == COMMON_ARGS["role"]
77+
assert kmeans.role == COMMON_TRAIN_ARGS["role"]
8078
assert kmeans.instance_count == INSTANCE_COUNT
8179
assert kmeans.instance_type == COMMON_TRAIN_ARGS["instance_type"]
8280
assert kmeans.k == ALL_REQ_ARGS["k"]

tests/unit/test_linear_learner.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,7 @@ def sagemaker_session():
6666

6767
def test_init_required_positional(sagemaker_session):
6868
lr = LinearLearner(
69-
ROLE,
70-
INSTANCE_COUNT,
71-
INSTANCE_TYPE,
72-
PREDICTOR_TYPE,
73-
sagemaker_session=sagemaker_session,
69+
ROLE, INSTANCE_COUNT, INSTANCE_TYPE, PREDICTOR_TYPE, sagemaker_session=sagemaker_session,
7470
)
7571
assert lr.role == ROLE
7672
assert lr.instance_count == INSTANCE_COUNT
@@ -429,6 +425,6 @@ def test_predictor_type(sagemaker_session):
429425
)
430426
lr.fit(data)
431427
model = lr.create_model()
432-
predictor = model.deploy(1, TRAIN_INSTANCE_TYPE)
428+
predictor = model.deploy(1, INSTANCE_TYPE)
433429

434430
assert isinstance(predictor, LinearLearnerPredictor)

tests/unit/test_ntm.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,7 @@ def sagemaker_session():
6464

6565

6666
def test_init_required_positional(sagemaker_session):
67-
ntm = NTM(
68-
ROLE,
69-
INSTANCE_COUNT,
70-
INSTANCE_TYPE,
71-
NUM_TOPICS,
72-
sagemaker_session=sagemaker_session,
73-
)
67+
ntm = NTM(ROLE, INSTANCE_COUNT, INSTANCE_TYPE, NUM_TOPICS, sagemaker_session=sagemaker_session,)
7468
assert ntm.role == ROLE
7569
assert ntm.instance_count == INSTANCE_COUNT
7670
assert ntm.instance_type == INSTANCE_TYPE

tests/unit/test_pca.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,7 @@ def sagemaker_session():
6565

6666
def test_init_required_positional(sagemaker_session):
6767
pca = PCA(
68-
ROLE,
69-
INSTANCE_COUNT,
70-
INSTANCE_TYPE,
71-
NUM_COMPONENTS,
72-
sagemaker_session=sagemaker_session,
68+
ROLE, INSTANCE_COUNT, INSTANCE_TYPE, NUM_COMPONENTS, sagemaker_session=sagemaker_session,
7369
)
7470
assert pca.role == ROLE
7571
assert pca.instance_count == INSTANCE_COUNT

tests/unit/test_sklearn.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -430,14 +430,10 @@ def test_train_image_default(sagemaker_session, sklearn_version):
430430

431431

432432
def test_train_image_cpu_instances(sagemaker_session, sklearn_version):
433-
sklearn = _sklearn_estimator(
434-
sagemaker_session, sklearn_version, instance_type="ml.c2.2xlarge"
435-
)
433+
sklearn = _sklearn_estimator(sagemaker_session, sklearn_version, instance_type="ml.c2.2xlarge")
436434
assert sklearn.train_image() == _get_full_cpu_image_uri(sklearn_version)
437435

438-
sklearn = _sklearn_estimator(
439-
sagemaker_session, sklearn_version, instance_type="ml.c4.2xlarge"
440-
)
436+
sklearn = _sklearn_estimator(sagemaker_session, sklearn_version, instance_type="ml.c4.2xlarge")
441437
assert sklearn.train_image() == _get_full_cpu_image_uri(sklearn_version)
442438

443439
sklearn = _sklearn_estimator(sagemaker_session, sklearn_version, instance_type="ml.m16")

tests/unit/test_tuner.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,7 @@ def test_prepare_for_training(tuner):
8181

8282
def test_prepare_for_tuning_with_amazon_estimator(tuner, sagemaker_session):
8383
tuner.estimator = PCA(
84-
ROLE,
85-
INSTANCE_COUNT,
86-
INSTANCE_TYPE,
87-
NUM_COMPONENTS,
88-
sagemaker_session=sagemaker_session,
84+
ROLE, INSTANCE_COUNT, INSTANCE_TYPE, NUM_COMPONENTS, sagemaker_session=sagemaker_session,
8985
)
9086

9187
tuner._prepare_for_tuning()

tests/unit/test_xgboost.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -423,14 +423,10 @@ def test_train_image_default(sagemaker_session, xgboost_full_version):
423423

424424

425425
def test_train_image_cpu_instances(sagemaker_session, xgboost_version):
426-
xgboost = _xgboost_estimator(
427-
sagemaker_session, xgboost_version, instance_type="ml.c2.2xlarge"
428-
)
426+
xgboost = _xgboost_estimator(sagemaker_session, xgboost_version, instance_type="ml.c2.2xlarge")
429427
assert xgboost.train_image() == _get_full_cpu_image_uri(xgboost_version)
430428

431-
xgboost = _xgboost_estimator(
432-
sagemaker_session, xgboost_version, instance_type="ml.c4.2xlarge"
433-
)
429+
xgboost = _xgboost_estimator(sagemaker_session, xgboost_version, instance_type="ml.c4.2xlarge")
434430
assert xgboost.train_image() == _get_full_cpu_image_uri(xgboost_version)
435431

436432
xgboost = _xgboost_estimator(sagemaker_session, xgboost_version, instance_type="ml.m16")

tests/unit/tuner_test_utils.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,7 @@
8080
sagemaker_session=SAGEMAKER_SESSION,
8181
)
8282
ESTIMATOR_TWO = PCA(
83-
ROLE,
84-
INSTANCE_COUNT,
85-
INSTANCE_TYPE,
86-
NUM_COMPONENTS,
87-
sagemaker_session=SAGEMAKER_SESSION,
83+
ROLE, INSTANCE_COUNT, INSTANCE_TYPE, NUM_COMPONENTS, sagemaker_session=SAGEMAKER_SESSION,
8884
)
8985

9086
WARM_START_CONFIG = WarmStartConfig(

0 commit comments

Comments
 (0)