Skip to content

Commit d6973bc

Browse files
knakadpengk19
authored andcommitted
change: correct code per len-as-condition Pylint check (aws#902)
The Pylint check is not actually enabled in this commit as it conflicts directly with NumPy. Pylint has corrected this, and it will be included in their next release (2.4.0): pylint-dev/pylint#2684 Once Pylint 2.4.0 is released, we can consume it and remove this check. A summary of this information is included in a TODO near the relevant Pylint disable rule (len-as-condition).
1 parent 0b4a93e commit d6973bc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

.pylintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ disable=
8282
invalid-name,
8383
too-many-instance-attributes,
8484
line-too-long, # We let Flake8 take care of this # TODO: Fix these and stop relying on flake8
85-
len-as-condition, # TODO: Use if seq: and if not seq: instead
85+
len-as-condition, # TODO: Enable this check once pylint 2.4.0 is released and consumed due to the fix in https://github.com/PyCQA/pylint/issues/2684
8686
logging-format-interpolation, # TODO: Fix logging so as to remove this.
8787
import-error, # TODO: Fix import errors
8888
logging-not-lazy, # TODO: Fix logging

src/sagemaker/predictor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def _serialize_row(data):
195195
if isinstance(data, np.ndarray):
196196
data = np.ndarray.flatten(data)
197197
if hasattr(data, "__len__"):
198-
if len(data):
198+
if len(data) > 0:
199199
return _csv_serialize_python_array(data)
200200
else:
201201
raise ValueError("Cannot serialize empty array")

0 commit comments

Comments
 (0)