From cbb17668ba8035ae29cbff7a944e509e991f5ad2 Mon Sep 17 00:00:00 2001 From: Karim Nakad Date: Thu, 11 Jul 2019 14:01:46 -0700 Subject: [PATCH 1/2] change: enable simplifiable-if-expression pylint checks --- .pylintrc | 1 - src/sagemaker/session.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.pylintrc b/.pylintrc index 0a980d43b3..9a3ee55af3 100644 --- a/.pylintrc +++ b/.pylintrc @@ -94,7 +94,6 @@ disable= inconsistent-return-statements, # TODO: Make returns consistent consider-merging-isinstance, # TODO: Merge isinstance where appropriate consider-using-in, # TODO: Consider merging comparisons with "in" - simplifiable-if-expression, # TODO: Simplify expressions too-many-public-methods, # TODO: Resolve ungrouped-imports, # TODO: Group imports consider-using-ternary, # TODO: Consider ternary expressions diff --git a/src/sagemaker/session.py b/src/sagemaker/session.py index efa56fc0f9..9ccf1b251b 100644 --- a/src/sagemaker/session.py +++ b/src/sagemaker/session.py @@ -1292,8 +1292,8 @@ 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 = ( - True if status == "Completed" or status == "Failed" or status == "Stopped" else False + job_already_completed = bool( + status == "Completed" or status == "Failed" or status == "Stopped" ) state = LogState.TAILING if wait and not job_already_completed else LogState.COMPLETE From 584f72cf166463e624db1c3726db7ae77f597b45 Mon Sep 17 00:00:00 2001 From: Karim Nakad Date: Thu, 11 Jul 2019 14:46:45 -0700 Subject: [PATCH 2/2] change: simplify expression further --- src/sagemaker/session.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/sagemaker/session.py b/src/sagemaker/session.py index 9ccf1b251b..019f9e4ef9 100644 --- a/src/sagemaker/session.py +++ b/src/sagemaker/session.py @@ -1292,9 +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 = bool( - status == "Completed" or status == "Failed" or status == "Stopped" - ) + job_already_completed = status == "Completed" or status == "Failed" or status == "Stopped" state = LogState.TAILING if wait and not job_already_completed else LogState.COMPLETE dot = False