Skip to content

change: enable consider-using-ternary Pylint check #942

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 1 commit into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
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
7 changes: 4 additions & 3 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ profile=no
# paths.
ignore=CVS,tensorflow_serving

# Add files or directories matching the regex patterns to the blacklist. The
# regex matches against base names, not paths.
# Add files or directories matching the regex patterns to the blacklist.
# The regex matches against base names, not paths.
# Regex patterns can be comma(and newline)-separated
ignore-patterns=
.*_pb2.py, # Ignore all files generated by the protocol buffer compiler

# Pickle collected data for later comparisons.
persistent=yes
Expand Down Expand Up @@ -89,7 +91,6 @@ disable=
useless-object-inheritance, # TODO: Remove unnecessary imports
cyclic-import, # TODO: Resolve cyclic imports
no-self-use, # TODO: Convert methods to functions where appropriate
consider-using-ternary, # TODO: Consider ternary expressions
too-many-branches, # TODO: Simplify or ignore as appropriate
missing-docstring, # TODO: Fix missing docstring

Expand Down
4 changes: 3 additions & 1 deletion src/sagemaker/predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ def _is_mutable_sequence_like(obj):

def _is_sequence_like(obj):
# Need to explicitly check on str since str lacks the iterable magic methods in Python 2
return (hasattr(obj, "__iter__") and hasattr(obj, "__getitem__")) or isinstance(obj, str)
return ( # pylint: disable=consider-using-ternary
hasattr(obj, "__iter__") and hasattr(obj, "__getitem__")
) or isinstance(obj, str)


def _row_to_csv(obj):
Expand Down