Skip to content

change: enable consider-using-in Pylint check #938

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 6 commits into from
Jul 16, 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
1 change: 0 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,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-in, # TODO: Consider merging comparisons with "in"
too-many-public-methods, # TODO: Resolve
consider-using-ternary, # TODO: Consider ternary expressions
chained-comparison, # TODO: Simplify chained comparison between operands
Expand Down
6 changes: 3 additions & 3 deletions src/sagemaker/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ def _check_job_status(self, job, desc, status_key_name):
# If the status is capital case, then convert it to Camel case
status = _STATUS_CODE_TABLE.get(status, status)

if status != "Completed" and status != "Stopped":
if status not in ("Completed", "Stopped"):
reason = desc.get("FailureReason", "(No reason provided)")
job_type = status_key_name.replace("JobStatus", " job")
raise ValueError("Error for {} {}: {} Reason: {}".format(job_type, job, status, reason))
Expand Down Expand Up @@ -1292,7 +1292,7 @@ def logs_for_job( # noqa: C901 - suppress complexity warning for this method
client = self.boto_session.client("logs", config=config)
log_group = "/aws/sagemaker/TrainingJobs"

job_already_completed = status == "Completed" or status == "Failed" or status == "Stopped"
job_already_completed = status in ("Completed", "Failed", "Stopped")

state = LogState.TAILING if wait and not job_already_completed else LogState.COMPLETE
dot = False
Expand Down Expand Up @@ -1385,7 +1385,7 @@ def logs_for_job( # noqa: C901 - suppress complexity warning for this method

status = description["TrainingJobStatus"]

if status == "Completed" or status == "Failed" or status == "Stopped":
if status in ("Completed", "Failed", "Stopped"):
print()
state = LogState.JOB_COMPLETE

Expand Down