Skip to content

change: Improve code style of SerDe compatibility #1764

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/sagemaker/cli/compatibility/v2/modifiers/serde.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def node_should_be_modified(self, node):
the ``sagemaker.amazon.common`` module.
"""
return node.module == "sagemaker.amazon.common" and any(
[alias.name in OLD_AMAZON_CLASS_NAMES for alias in node.names]
alias.name in OLD_AMAZON_CLASS_NAMES for alias in node.names
)

def modify_node(self, node):
Expand Down Expand Up @@ -368,7 +368,11 @@ class SerializerImportInserter(_ImportInserter):
"""

def __init__(self):
# Amazon SerDe are not defined in the sagemaker.serializers module.
"""Initialize the ``class_names`` and ``import_node`` attributes.

Amazon-specific serializers are ignored because they are not defined in
the ``sagemaker.serializers`` module.
"""
class_names = {
class_name
for class_name in NEW_CLASS_NAMES - NEW_AMAZON_CLASS_NAMES
Expand Down Expand Up @@ -398,7 +402,11 @@ class DeserializerImportInserter(_ImportInserter):
"""

def __init__(self):
# Amazon SerDe are not defined in the sagemaker.serializers module.
"""Initialize the ``class_names`` and ``import_node`` attributes.

Amazon-specific deserializers are ignored because they are not defined
in the ``sagemaker.deserializers`` module.
"""
class_names = {
class_name
for class_name in NEW_CLASS_NAMES - NEW_AMAZON_CLASS_NAMES
Expand Down