Skip to content

Commit 476879f

Browse files
beniericknikure
authored andcommitted
fix flake8
1 parent 43e0174 commit 476879f

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
@@ -177,7 +177,7 @@ def test_build_happy_path_with_sagemaker_endpoint_mode_and_byoc(
177177
mock_sageMakerEndpointMode.side_effect = lambda inference_spec, model_server: (
178178
mock_mode if inference_spec is None and model_server == ModelServer.TORCHSERVE else None
179179
)
180-
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: (
180+
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: ( # noqa E501
181181
(
182182
model_data,
183183
ENV_VAR_PAIR,
@@ -191,8 +191,8 @@ def test_build_happy_path_with_sagemaker_endpoint_mode_and_byoc(
191191
)
192192

193193
mock_model_obj = Mock()
194-
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: (
195-
mock_model_obj # noqa E501
194+
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: ( # noqa E501
195+
mock_model_obj
196196
if image_uri == mock_image_uri
197197
and image_config == MOCK_IMAGE_CONFIG
198198
and vpc_config == MOCK_VPC_CONFIG
@@ -280,7 +280,7 @@ def test_build_happy_path_with_sagemaker_endpoint_mode_and_1p_dlc_as_byoc(
280280
mock_sageMakerEndpointMode.side_effect = lambda inference_spec, model_server: (
281281
mock_mode if inference_spec is None and model_server == ModelServer.TORCHSERVE else None
282282
)
283-
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: (
283+
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: ( # noqa E501
284284
(
285285
model_data,
286286
ENV_VAR_PAIR,
@@ -294,8 +294,8 @@ def test_build_happy_path_with_sagemaker_endpoint_mode_and_1p_dlc_as_byoc(
294294
)
295295

296296
mock_model_obj = Mock()
297-
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: (
298-
mock_model_obj # noqa E501
297+
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: ( # noqa E501
298+
mock_model_obj
299299
if image_uri == mock_1p_dlc_image_uri
300300
and model_data == model_data
301301
and role == mock_role_arn
@@ -387,7 +387,7 @@ def test_build_happy_path_with_sagemaker_endpoint_mode_and_inference_spec(
387387
if inference_spec == mock_inference_spec and model_server == ModelServer.TORCHSERVE
388388
else None
389389
)
390-
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: (
390+
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: ( # noqa E501
391391
(
392392
model_data,
393393
ENV_VAR_PAIR,
@@ -401,8 +401,8 @@ def test_build_happy_path_with_sagemaker_endpoint_mode_and_inference_spec(
401401
)
402402

403403
mock_model_obj = Mock()
404-
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: (
405-
mock_model_obj # noqa E501
404+
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: ( # noqa E501
405+
mock_model_obj
406406
if image_uri == mock_image_uri
407407
and model_data == model_data
408408
and role == mock_role_arn
@@ -483,7 +483,7 @@ def test_build_happy_path_with_sagemakerEndpoint_mode_and_model(
483483
mock_sageMakerEndpointMode.side_effect = lambda inference_spec, model_server: (
484484
mock_mode if inference_spec is None and model_server == ModelServer.TORCHSERVE else None
485485
)
486-
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: (
486+
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: ( # noqa E501
487487
(
488488
model_data,
489489
ENV_VAR_PAIR,
@@ -497,8 +497,8 @@ def test_build_happy_path_with_sagemakerEndpoint_mode_and_model(
497497
)
498498

499499
mock_model_obj = Mock()
500-
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: (
501-
mock_model_obj # noqa E501
500+
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: ( # noqa E501
501+
mock_model_obj
502502
if image_uri == mock_image_uri
503503
and model_data == model_data
504504
and role == mock_role_arn
@@ -587,7 +587,7 @@ def test_build_happy_path_with_sagemakerEndpoint_mode_and_xgboost_model(
587587
mock_sageMakerEndpointMode.side_effect = lambda inference_spec, model_server: (
588588
mock_mode if inference_spec is None and model_server == ModelServer.TORCHSERVE else None
589589
)
590-
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: (
590+
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: ( # noqa E501
591591
(
592592
model_data,
593593
ENV_VAR_PAIR,
@@ -601,8 +601,8 @@ def test_build_happy_path_with_sagemakerEndpoint_mode_and_xgboost_model(
601601
)
602602

603603
mock_model_obj = Mock()
604-
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: (
605-
mock_model_obj # noqa E501
604+
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: ( # noqa E501
605+
mock_model_obj
606606
if image_uri == mock_image_uri
607607
and model_data == model_data
608608
and role == mock_role_arn
@@ -706,8 +706,8 @@ def test_build_happy_path_with_local_container_mode(
706706
mock_mode.prepare.side_effect = lambda: None
707707

708708
mock_model_obj = Mock()
709-
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: (
710-
mock_model_obj # noqa E501
709+
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: ( # noqa E501
710+
mock_model_obj
711711
if image_uri == mock_image_uri
712712
and model_data is None
713713
and role == mock_role_arn
@@ -813,7 +813,7 @@ def test_build_happy_path_with_localContainer_mode_overwritten_with_sagemaker_mo
813813
if inference_spec == mock_inference_spec and model_server == ModelServer.TORCHSERVE
814814
else None
815815
)
816-
mock_sagemaker_endpoint_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: (
816+
mock_sagemaker_endpoint_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: ( # noqa E501
817817
(
818818
model_data,
819819
ENV_VAR_PAIR,
@@ -827,8 +827,8 @@ def test_build_happy_path_with_localContainer_mode_overwritten_with_sagemaker_mo
827827
)
828828

829829
mock_model_obj = Mock()
830-
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: (
831-
mock_model_obj # noqa E501
830+
mock_sdk_model.side_effect = lambda image_uri, image_config, vpc_config, model_data, role, env, sagemaker_session, predictor_cls: ( # noqa E501
831+
mock_model_obj
832832
if image_uri == mock_image_uri
833833
and model_data is None
834834
and role == mock_role_arn
@@ -935,7 +935,7 @@ def test_build_happy_path_with_sagemaker_endpoint_mode_overwritten_with_local_co
935935
mock_sageMakerEndpointMode.side_effect = lambda inference_spec, model_server: (
936936
mock_mode if inference_spec is None and model_server == ModelServer.TORCHSERVE else None
937937
)
938-
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: (
938+
mock_mode.prepare.side_effect = lambda model_path, secret_key, s3_model_data_url, sagemaker_session, image_uri, jumpstart: ( # noqa E501
939939
(
940940
model_data,
941941
ENV_VAR_PAIR,
@@ -973,8 +973,8 @@ def test_build_happy_path_with_sagemaker_endpoint_mode_overwritten_with_local_co
973973
)
974974

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

0 commit comments

Comments
 (0)