From 9c3ee53f05431b90a647320a58ac078492c595a7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 18 Mar 2024 17:28:28 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- notebooks/co2scenarios.ipynb | 32 +++++++++++++++++----------- notebooks/preprocess-dashboard.ipynb | 8 ++++--- notebooks/sankey.ipynb | 6 +++--- notebooks/scenarios.py.ipynb | 32 +++++++++++++++++----------- notebooks/single.py.ipynb | 10 +++++---- 5 files changed, 54 insertions(+), 34 deletions(-) diff --git a/notebooks/co2scenarios.ipynb b/notebooks/co2scenarios.ipynb index 8a2ce7a..2e4599a 100644 --- a/notebooks/co2scenarios.ipynb +++ b/notebooks/co2scenarios.ipynb @@ -264,9 +264,11 @@ "\n", " df = df.loc[carrier].groupby(level=2).sum().div(1e6) # TWh / MtCO2\n", " df.index = [\n", - " i[:-1]\n", - " if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n", - " else i\n", + " (\n", + " i[:-1]\n", + " if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n", + " else i\n", + " )\n", " for i in df.index\n", " ]\n", "\n", @@ -396,9 +398,11 @@ "\n", " toprow_kwargs = (\n", " dict(\n", - " title=\"with\\nhydrogen grid\\n\"\n", - " if y[1] == \"H2 grid\"\n", - " else \"without\\nhydrogen grid\\n\"\n", + " title=(\n", + " \"with\\nhydrogen grid\\n\"\n", + " if y[1] == \"H2 grid\"\n", + " else \"without\\nhydrogen grid\\n\"\n", + " )\n", " )\n", " if x[0] == 0\n", " else {}\n", @@ -704,9 +708,11 @@ "outputs": [], "source": [ "df.index = [\n", - " i[:-1]\n", - " if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n", - " else i\n", + " (\n", + " i[:-1]\n", + " if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n", + " else i\n", + " )\n", " for i in df.index\n", "]" ] @@ -917,9 +923,11 @@ "outputs": [], "source": [ "df.index = [\n", - " i[:-1]\n", - " if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n", - " else i\n", + " (\n", + " i[:-1]\n", + " if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n", + " else i\n", + " )\n", " for i in df.index\n", "]" ] diff --git a/notebooks/preprocess-dashboard.ipynb b/notebooks/preprocess-dashboard.ipynb index e73621a..e964cda 100644 --- a/notebooks/preprocess-dashboard.ipynb +++ b/notebooks/preprocess-dashboard.ipynb @@ -396,9 +396,11 @@ "source": [ "kwargs = dict(index_col=0, header=0)\n", "ts = {\n", - " k: pd.read_csv(v + \"edges-hydrogen.csv\", **kwargs)\n", - " if os.path.exists(v + \"edges-hydrogen.csv\")\n", - " else None\n", + " k: (\n", + " pd.read_csv(v + \"edges-hydrogen.csv\", **kwargs)\n", + " if os.path.exists(v + \"edges-hydrogen.csv\")\n", + " else None\n", + " )\n", " for k, v in SCENARIOS.items()\n", "}\n", "\n", diff --git a/notebooks/sankey.ipynb b/notebooks/sankey.ipynb index 0040caa..2a411da 100755 --- a/notebooks/sankey.ipynb +++ b/notebooks/sankey.ipynb @@ -229,9 +229,9 @@ " df.loc[df.label.str.contains(\"heat pump\"), \"value\"] -= hp_elec[\"value\"].values\n", "\n", " df.loc[df.label.str.contains(\"air heat pump\"), \"source\"] = \"air-sourced ambient\"\n", - " df.loc[\n", - " df.label.str.contains(\"ground heat pump\"), \"source\"\n", - " ] = \"ground-sourced ambient\"\n", + " df.loc[df.label.str.contains(\"ground heat pump\"), \"source\"] = (\n", + " \"ground-sourced ambient\"\n", + " )\n", "\n", " df = pd.concat([df, hp_elec])\n", " df = df.set_index([\"label\", \"source\", \"target\"]).squeeze()\n", diff --git a/notebooks/scenarios.py.ipynb b/notebooks/scenarios.py.ipynb index 1b15283..3f906e5 100755 --- a/notebooks/scenarios.py.ipynb +++ b/notebooks/scenarios.py.ipynb @@ -705,9 +705,11 @@ "\n", " df = df.loc[carrier].groupby(level=2).sum().div(1e6) # TWh / MtCO2\n", " df.index = [\n", - " i[:-1]\n", - " if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n", - " else i\n", + " (\n", + " i[:-1]\n", + " if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n", + " else i\n", + " )\n", " for i in df.index\n", " ]\n", "\n", @@ -771,9 +773,11 @@ " df = df.groupby(level=2).sum().div(1e6)\n", "\n", " df.index = [\n", - " i[:-1]\n", - " if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n", - " else i\n", + " (\n", + " i[:-1]\n", + " if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n", + " else i\n", + " )\n", " for i in df.index\n", " ]\n", "\n", @@ -845,9 +849,11 @@ " df = df.groupby(level=2).sum().div(1e6)\n", "\n", " df.index = [\n", - " i[:-1]\n", - " if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n", - " else i\n", + " (\n", + " i[:-1]\n", + " if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n", + " else i\n", + " )\n", " for i in df.index\n", " ]\n", "\n", @@ -3458,9 +3464,11 @@ "\n", " toprow_kwargs = (\n", " dict(\n", - " title=\"with\\nhydrogen grid\\n\"\n", - " if y[1] == \"H2 grd\"\n", - " else \"without\\nhydrogen grid\\n\"\n", + " title=(\n", + " \"with\\nhydrogen grid\\n\"\n", + " if y[1] == \"H2 grd\"\n", + " else \"without\\nhydrogen grid\\n\"\n", + " )\n", " )\n", " if x[0] == 0\n", " else {}\n", diff --git a/notebooks/single.py.ipynb b/notebooks/single.py.ipynb index edb077e..299bf60 100755 --- a/notebooks/single.py.ipynb +++ b/notebooks/single.py.ipynb @@ -3301,10 +3301,12 @@ "\n", " # Create tick labels from timestamps\n", " labels = [\n", - " ts.strftime(f\"{minor_fmt}\\n{major_fmt}\")\n", - " if (getattr(ts, major_attr) != getattr(timestamps[idx - 1], major_attr))\n", - " | (idx == 0) # | (idx == len(timestamps)-1)\n", - " else ts.strftime(minor_fmt)\n", + " (\n", + " ts.strftime(f\"{minor_fmt}\\n{major_fmt}\")\n", + " if (getattr(ts, major_attr) != getattr(timestamps[idx - 1], major_attr))\n", + " | (idx == 0) # | (idx == len(timestamps)-1)\n", + " else ts.strftime(minor_fmt)\n", + " )\n", " for idx, ts in enumerate(timestamps)\n", " ]\n", "\n",