From 0ad1ed49f5f4ab1354c642073834fca47ed23382 Mon Sep 17 00:00:00 2001 From: Ben Elliston Date: Sat, 29 Jun 2024 19:49:53 +1000 Subject: [PATCH] * summary: Ruff fixes. --- summary | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) mode change 100644 => 100755 summary diff --git a/summary b/summary old mode 100644 new mode 100755 index 3cc3bf15..af81e433 --- a/summary +++ b/summary @@ -105,10 +105,10 @@ patterns = { 'diesel.*[kMG]W$': lambda f: addcap("diesel", f), '(DR|demand, f).*[kMG]W$': lambda f: addcap("DR", f), 'HydrogenGT.*[kMG]W$': lambda f: addcap("HydrogenGT", f), - '[kMG]W$': warn + '[kMG]W$': warn, } -for line in sys.stdin: # noqa: C901 +for line in sys.stdin: fields = awklite.Fields(line.strip().split()) nf = len(fields) @@ -156,9 +156,8 @@ for line in sys.stdin: # noqa: C901 av.penalty = float(fields[2]) if search('Constraints violated', line): - line = line.replace('Constraints violated: ', '').strip('\n') - line = line.replace(' ', ',') - av.constraints = line + newline = line.replace('Constraints violated: ', '').strip('\n') + av.constraints = newline.replace(' ', ',') if search('Timesteps:', line): av.timesteps = int(fields[2]) @@ -181,7 +180,7 @@ for line in sys.stdin: # noqa: C901 if av.CO2 > 0: print(f"# emissions {av.CO2:.2f} Mt") if av.unserved: - print(f"# unserved {str(av.unserved)}") + print(f"# unserved {av.unserved}") print(f"# score {av.cost} $/MWh") if av.penalty > 0: print(f"# penalty {av.penalty} $/MWh")