Skip to content

Commit

Permalink
change: correct code per len-as-condition Pylint check (aws#902)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
knakad authored and pengk19 committed Jul 12, 2019
1 parent 0b4a93e commit d6973bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ disable=
invalid-name,
too-many-instance-attributes,
line-too-long, # We let Flake8 take care of this # TODO: Fix these and stop relying on flake8
len-as-condition, # TODO: Use if seq: and if not seq: instead
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
logging-format-interpolation, # TODO: Fix logging so as to remove this.
import-error, # TODO: Fix import errors
logging-not-lazy, # TODO: Fix logging
Expand Down
2 changes: 1 addition & 1 deletion src/sagemaker/predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def _serialize_row(data):
if isinstance(data, np.ndarray):
data = np.ndarray.flatten(data)
if hasattr(data, "__len__"):
if len(data):
if len(data) > 0:
return _csv_serialize_python_array(data)
else:
raise ValueError("Cannot serialize empty array")
Expand Down

0 comments on commit d6973bc

Please sign in to comment.