From 95b95e27f1e637f262a5ec2052769c7bfc31857c Mon Sep 17 00:00:00 2001 From: Jan Kwakkel Date: Thu, 1 Sep 2022 10:20:04 +0200 Subject: [PATCH 1/2] switch to using format string in prim logging fixes #155 --- ema_workbench/analysis/prim.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ema_workbench/analysis/prim.py b/ema_workbench/analysis/prim.py index e8081d012..c99cae15d 100644 --- a/ema_workbench/analysis/prim.py +++ b/ema_workbench/analysis/prim.py @@ -1046,8 +1046,8 @@ def __init__( x = x.drop(column, axis=1) _logger.info( ( - "{} dropped from analysis " "because only a single category" - ).format(column) + f"{column} dropped from analysis " "because only a single category" + ) ) x_nominal = x.select_dtypes(exclude=np.number) @@ -1164,8 +1164,8 @@ def find_box(self): _logger.info( ( "box does not meet threshold criteria, " - "value is {}, returning dump box" - ).format(box.mean) + f"value is {box.mean}, returning dump box" + ) ) box = PrimBox(self, self.box_init, self.yi_remaining[:]) self._boxes.append(box) @@ -1475,7 +1475,7 @@ def _paste(self, box): for i, u in enumerate(columns): if u not in res_dim: continue - _logger.debug("pasting " + u) + _logger.debug(f"pasting {u}") pastes = self._pastes[dtype](self, box, u, x, restricted_dims) [possible_pastes.append(entry) for entry in pastes] if not possible_pastes: From 61953392a0e8777391ef32678ebb3b836c6d738e Mon Sep 17 00:00:00 2001 From: Jan Kwakkel Date: Thu, 1 Sep 2022 16:41:36 +0200 Subject: [PATCH 2/2] minor reformatting using black --- ema_workbench/analysis/prim.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ema_workbench/analysis/prim.py b/ema_workbench/analysis/prim.py index c99cae15d..41ef90e5f 100644 --- a/ema_workbench/analysis/prim.py +++ b/ema_workbench/analysis/prim.py @@ -1045,9 +1045,7 @@ def __init__( if np.unique(x[column]).shape == (1,): x = x.drop(column, axis=1) _logger.info( - ( - f"{column} dropped from analysis " "because only a single category" - ) + f"{column} dropped from analysis " "because only a single category" ) x_nominal = x.select_dtypes(exclude=np.number) @@ -1162,10 +1160,7 @@ def find_box(self): else: # make a dump box _logger.info( - ( - "box does not meet threshold criteria, " - f"value is {box.mean}, returning dump box" - ) + f"box does not meet threshold criteria, value is {box.mean}, returning dump box" ) box = PrimBox(self, self.box_init, self.yi_remaining[:]) self._boxes.append(box)