Skip to content

Commit 5b6da32

Browse files
author
Balaji Veeramani
committed
Address review comments
1 parent 77b37f5 commit 5b6da32

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/sagemaker/serializers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ def serialize(self, data):
6666
def is_sequence_like(obj):
6767
return hasattr(obj, "__iter__") and hasattr(obj, "__getitem__")
6868

69-
def is_mutable_sequence_like(obj):
70-
return is_sequence_like(obj) and hasattr(obj, "__setitem__")
69+
is_mutable_sequence_like = is_sequence_like(data) and hasattr(data, "__setitem__")
70+
has_multiple_rows = len(data) > 0 and is_sequence_like(data[0])
7171

72-
if is_mutable_sequence_like(data) and len(data) > 0 and is_sequence_like(data[0]):
72+
if is_mutable_sequence_like and has_multiple_rows:
7373
return "\n".join([self._serialize_row(row) for row in data])
7474

7575
return self._serialize_row(data)

0 commit comments

Comments
 (0)