Skip to content

Commit 19a2f70

Browse files
authored
Merge branch 'zwei' into model-dir-slashes
2 parents b14066c + f7b3f6b commit 19a2f70

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

src/sagemaker/cli/compatibility/v2/modifiers/serde.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def node_should_be_modified(self, node):
274274
the ``sagemaker.amazon.common`` module.
275275
"""
276276
return node.module == "sagemaker.amazon.common" and any(
277-
[alias.name in OLD_AMAZON_CLASS_NAMES for alias in node.names]
277+
alias.name in OLD_AMAZON_CLASS_NAMES for alias in node.names
278278
)
279279

280280
def modify_node(self, node):
@@ -368,7 +368,11 @@ class SerializerImportInserter(_ImportInserter):
368368
"""
369369

370370
def __init__(self):
371-
# Amazon SerDe are not defined in the sagemaker.serializers module.
371+
"""Initialize the ``class_names`` and ``import_node`` attributes.
372+
373+
Amazon-specific serializers are ignored because they are not defined in
374+
the ``sagemaker.serializers`` module.
375+
"""
372376
class_names = {
373377
class_name
374378
for class_name in NEW_CLASS_NAMES - NEW_AMAZON_CLASS_NAMES
@@ -398,7 +402,11 @@ class DeserializerImportInserter(_ImportInserter):
398402
"""
399403

400404
def __init__(self):
401-
# Amazon SerDe are not defined in the sagemaker.serializers module.
405+
"""Initialize the ``class_names`` and ``import_node`` attributes.
406+
407+
Amazon-specific deserializers are ignored because they are not defined
408+
in the ``sagemaker.deserializers`` module.
409+
"""
402410
class_names = {
403411
class_name
404412
for class_name in NEW_CLASS_NAMES - NEW_AMAZON_CLASS_NAMES

src/sagemaker/serializers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from sagemaker.utils import DeferredError
2525

2626
try:
27-
import scipy
27+
import scipy.sparse
2828
except ImportError as e:
2929
scipy = DeferredError(e)
3030

tests/unit/sagemaker/test_serializers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import numpy as np
2020
import pytest
21-
import scipy
21+
import scipy.sparse
2222

2323
from sagemaker.serializers import (
2424
CSVSerializer,

0 commit comments

Comments
 (0)