Skip to content

Commit 8524ae7

Browse files
committed
fix flake8
1 parent 5fcd7fa commit 8524ae7

File tree

4 files changed

+29
-29
lines changed

4 files changed

+29
-29
lines changed

src/sagemaker/djl_inference/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def _create_estimator(
213213
vpc_config: Optional[
214214
Dict[
215215
str,
216-
List[str,],
216+
List[str],
217217
]
218218
] = None,
219219
volume_kms_key=None,

src/sagemaker/jumpstart/filters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class ProprietaryModelFilterIdentifiers(str, Enum):
7171
}
7272

7373

74-
_PAD_ALPHABETIC_OPERATOR = lambda operator: (
74+
_PAD_ALPHABETIC_OPERATOR = lambda operator: ( # noqa E731
7575
f" {operator} " if any(character.isalpha() for character in operator) else operator
7676
)
7777

tests/unit/sagemaker/remote_function/core/test_serialization.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def __init__(self, x):
408408
@patch("sagemaker.s3.S3Downloader.read_bytes", new=read_error)
409409
def test_serialize_deserialize_service_error():
410410

411-
my_func = lambda a: a + 10 # noqa: E731
411+
my_func = lambda a: a + 10 # noqa: E731
412412

413413
s3_uri = random_s3_uri()
414414
with pytest.raises(
@@ -439,7 +439,7 @@ def test_serialize_deserialize_service_error():
439439
def test_serialize_deserialize_exception_with_traceback():
440440
s3_uri = random_s3_uri()
441441

442-
class CustomError(Exception): ...
442+
class CustomError(Exception): ... # noqa E701
443443

444444
def func_a():
445445
raise TypeError
@@ -468,7 +468,7 @@ def func_b():
468468
def test_serialize_deserialize_custom_exception_with_traceback():
469469
s3_uri = random_s3_uri()
470470

471-
class CustomError(Exception): ...
471+
class CustomError(Exception): ... # noqa: E701
472472

473473
def func_a():
474474
raise TypeError
@@ -498,7 +498,7 @@ def func_b():
498498
def test_serialize_deserialize_remote_function_error_with_traceback():
499499
s3_uri = random_s3_uri()
500500

501-
class CustomError(Exception): ...
501+
class CustomError(Exception): ... # noqa: E701
502502

503503
def func_a():
504504
raise TypeError

tests/unit/sagemaker/serve/builder/test_model_builder.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def test_build_happy_path_with_sagemaker_endpoint_mode_and_byoc(
176176
mock_sageMakerEndpointMode.side_effect = lambda inference_spec, model_server: (
177177
mock_mode if inference_spec is None and model_server == ModelServer.TORCHSERVE else None
178178
)
179-
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: (
179+
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: ( # noqa E501
180180
(
181181
model_data,
182182
ENV_VAR_PAIR,
@@ -190,8 +190,8 @@ def test_build_happy_path_with_sagemaker_endpoint_mode_and_byoc(
190190
)
191191

192192
mock_model_obj = Mock()
193-
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: (
194-
mock_model_obj # noqa E501
193+
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: ( # noqa E501
194+
mock_model_obj
195195
if image_uri == mock_image_uri
196196
and image_config == MOCK_IMAGE_CONFIG
197197
and vpc_config == MOCK_VPC_CONFIG
@@ -279,7 +279,7 @@ def test_build_happy_path_with_sagemaker_endpoint_mode_and_1p_dlc_as_byoc(
279279
mock_sageMakerEndpointMode.side_effect = lambda inference_spec, model_server: (
280280
mock_mode if inference_spec is None and model_server == ModelServer.TORCHSERVE else None
281281
)
282-
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: (
282+
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: ( # noqa E501
283283
(
284284
model_data,
285285
ENV_VAR_PAIR,
@@ -293,8 +293,8 @@ def test_build_happy_path_with_sagemaker_endpoint_mode_and_1p_dlc_as_byoc(
293293
)
294294

295295
mock_model_obj = Mock()
296-
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: (
297-
mock_model_obj # noqa E501
296+
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: ( # noqa E501
297+
mock_model_obj
298298
if image_uri == mock_1p_dlc_image_uri
299299
and model_data == model_data
300300
and role == mock_role_arn
@@ -386,7 +386,7 @@ def test_build_happy_path_with_sagemaker_endpoint_mode_and_inference_spec(
386386
if inference_spec == mock_inference_spec and model_server == ModelServer.TORCHSERVE
387387
else None
388388
)
389-
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: (
389+
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: ( # noqa E501
390390
(
391391
model_data,
392392
ENV_VAR_PAIR,
@@ -400,8 +400,8 @@ def test_build_happy_path_with_sagemaker_endpoint_mode_and_inference_spec(
400400
)
401401

402402
mock_model_obj = Mock()
403-
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: (
404-
mock_model_obj # noqa E501
403+
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: ( # noqa E501
404+
mock_model_obj
405405
if image_uri == mock_image_uri
406406
and model_data == model_data
407407
and role == mock_role_arn
@@ -482,7 +482,7 @@ def test_build_happy_path_with_sagemakerEndpoint_mode_and_model(
482482
mock_sageMakerEndpointMode.side_effect = lambda inference_spec, model_server: (
483483
mock_mode if inference_spec is None and model_server == ModelServer.TORCHSERVE else None
484484
)
485-
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: (
485+
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: ( # noqa E501
486486
(
487487
model_data,
488488
ENV_VAR_PAIR,
@@ -496,8 +496,8 @@ def test_build_happy_path_with_sagemakerEndpoint_mode_and_model(
496496
)
497497

498498
mock_model_obj = Mock()
499-
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: (
500-
mock_model_obj # noqa E501
499+
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: ( # noqa E501
500+
mock_model_obj
501501
if image_uri == mock_image_uri
502502
and model_data == model_data
503503
and role == mock_role_arn
@@ -586,7 +586,7 @@ def test_build_happy_path_with_sagemakerEndpoint_mode_and_xgboost_model(
586586
mock_sageMakerEndpointMode.side_effect = lambda inference_spec, model_server: (
587587
mock_mode if inference_spec is None and model_server == ModelServer.TORCHSERVE else None
588588
)
589-
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: (
589+
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: ( # noqa E501
590590
(
591591
model_data,
592592
ENV_VAR_PAIR,
@@ -600,8 +600,8 @@ def test_build_happy_path_with_sagemakerEndpoint_mode_and_xgboost_model(
600600
)
601601

602602
mock_model_obj = Mock()
603-
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: (
604-
mock_model_obj # noqa E501
603+
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: ( # noqa E501
604+
mock_model_obj
605605
if image_uri == mock_image_uri
606606
and model_data == model_data
607607
and role == mock_role_arn
@@ -705,8 +705,8 @@ def test_build_happy_path_with_local_container_mode(
705705
mock_mode.prepare.side_effect = lambda: None
706706

707707
mock_model_obj = Mock()
708-
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: (
709-
mock_model_obj # noqa E501
708+
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: ( # noqa E501
709+
mock_model_obj
710710
if image_uri == mock_image_uri
711711
and model_data is None
712712
and role == mock_role_arn
@@ -812,7 +812,7 @@ def test_build_happy_path_with_localContainer_mode_overwritten_with_sagemaker_mo
812812
if inference_spec == mock_inference_spec and model_server == ModelServer.TORCHSERVE
813813
else None
814814
)
815-
mock_sagemaker_endpoint_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: (
815+
mock_sagemaker_endpoint_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: ( # noqa E501
816816
(
817817
model_data,
818818
ENV_VAR_PAIR,
@@ -826,8 +826,8 @@ def test_build_happy_path_with_localContainer_mode_overwritten_with_sagemaker_mo
826826
)
827827

828828
mock_model_obj = Mock()
829-
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: (
830-
mock_model_obj # noqa E501
829+
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: ( # noqa E501
830+
mock_model_obj
831831
if image_uri == mock_image_uri
832832
and model_data is None
833833
and role == mock_role_arn
@@ -934,7 +934,7 @@ def test_build_happy_path_with_sagemaker_endpoint_mode_overwritten_with_local_co
934934
mock_sageMakerEndpointMode.side_effect = lambda inference_spec, model_server: (
935935
mock_mode if inference_spec is None and model_server == ModelServer.TORCHSERVE else None
936936
)
937-
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: (
937+
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: ( # noqa E501
938938
(
939939
model_data,
940940
ENV_VAR_PAIR,
@@ -972,8 +972,8 @@ def test_build_happy_path_with_sagemaker_endpoint_mode_overwritten_with_local_co
972972
)
973973

974974
mock_model_obj = Mock()
975-
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: (
976-
mock_model_obj # noqa E501
975+
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: ( # noqa E501
976+
mock_model_obj
977977
if image_uri == mock_image_uri
978978
and model_data == model_data
979979
and role == mock_role_arn

0 commit comments

Comments
 (0)