From 60126e364e063f4561e8c5a525f5d9f24807e251 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
 <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Mon, 9 Sep 2024 20:26:01 +0000
Subject: [PATCH] style: pre-commit fixes

---
 docs/examples/complete.ipynb      | 12 ++++++------
 docs/examples/plot_spectrum.ipynb |  6 +++---
 panama/_nbstreamreader.py         |  1 +
 panama/constants.py               |  1 +
 panama/prompt.py                  |  7 ++++---
 panama/read.py                    | 24 +++++++++++++++---------
 panama/run.py                     |  1 +
 panama/weights.py                 |  7 ++++---
 8 files changed, 35 insertions(+), 24 deletions(-)

diff --git a/docs/examples/complete.ipynb b/docs/examples/complete.ipynb
index 0de93f4..54d774d 100644
--- a/docs/examples/complete.ipynb
+++ b/docs/examples/complete.ipynb
@@ -243,9 +243,9 @@
     "# Let's see what kind of particles we have in the simulation\n",
     "counts = particles[\"pdgid\"].value_counts()\n",
     "counts.index = counts.index.map(\n",
-    "    lambda pid: f\"{Particle.from_pdgid(pid).name} ({pid})\"\n",
-    "    if pid != 0\n",
-    "    else \"unknown (0)\"\n",
+    "    lambda pid: (\n",
+    "        f\"{Particle.from_pdgid(pid).name} ({pid})\" if pid != 0 else \"unknown (0)\"\n",
+    "    )\n",
     ")\n",
     "counts.plot(kind=\"bar\", log=True)\n",
     "\n",
@@ -293,9 +293,9 @@
     "\n",
     "counts = sel.mother_pdgid_cleaned.value_counts()\n",
     "counts.index = counts.index.map(\n",
-    "    lambda pid: f\"{Particle.from_pdgid(pid).name} ({pid})\"\n",
-    "    if pid != 0\n",
-    "    else \"unknown (0)\"\n",
+    "    lambda pid: (\n",
+    "        f\"{Particle.from_pdgid(pid).name} ({pid})\" if pid != 0 else \"unknown (0)\"\n",
+    "    )\n",
     ")\n",
     "counts.plot(kind=\"bar\", log=True)\n",
     "\n",
diff --git a/docs/examples/plot_spectrum.ipynb b/docs/examples/plot_spectrum.ipynb
index be271d9..74d430c 100644
--- a/docs/examples/plot_spectrum.ipynb
+++ b/docs/examples/plot_spectrum.ipynb
@@ -247,9 +247,9 @@
     "\n",
     "counts = sel.mother_pdgid_cleaned.value_counts()\n",
     "counts.index = counts.index.map(\n",
-    "    lambda pid: f\"{Particle.from_pdgid(pid).name} ({pid})\"\n",
-    "    if pid != 0\n",
-    "    else \"unknown (0)\"\n",
+    "    lambda pid: (\n",
+    "        f\"{Particle.from_pdgid(pid).name} ({pid})\" if pid != 0 else \"unknown (0)\"\n",
+    "    )\n",
     ")\n",
     "counts.plot(kind=\"bar\", log=True)\n",
     "\n",
diff --git a/panama/_nbstreamreader.py b/panama/_nbstreamreader.py
index 8d6418c..f0e35e9 100644
--- a/panama/_nbstreamreader.py
+++ b/panama/_nbstreamreader.py
@@ -4,6 +4,7 @@
 Only to be used internally.
 Adapted from http://eyalarubas.com/python-subproc-nonblock.html
 """
+
 from __future__ import annotations
 
 from queue import Empty, Queue
diff --git a/panama/constants.py b/panama/constants.py
index 64b9d9a..d281522 100644
--- a/panama/constants.py
+++ b/panama/constants.py
@@ -1,6 +1,7 @@
 """
 Some constants used across multiple modules
 """
+
 from particle import PDGID, Particle
 
 D0_LIFETIME = Particle.from_name("D0").lifetime
diff --git a/panama/prompt.py b/panama/prompt.py
index d8163ee..12dccd0 100644
--- a/panama/prompt.py
+++ b/panama/prompt.py
@@ -2,6 +2,7 @@
 Functions to use to determine if a particle is prompt or not,
 using multiple different definitions.
 """
+
 from __future__ import annotations
 
 from math import inf
@@ -60,9 +61,9 @@ def add_cleaned_mother_cols(df_particles: pd.DataFrame) -> None:
     if "mother_lifetime_cleaned" not in df_particles:
         pdgids = df_particles["mother_pdgid_cleaned"].unique()
         lifetimes = {
-            pdgid: Particle.from_pdgid(pdgid).lifetime
-            if pdgid != PDGID_ERROR_VAL
-            else inf
+            pdgid: (
+                Particle.from_pdgid(pdgid).lifetime if pdgid != PDGID_ERROR_VAL else inf
+            )
             for pdgid in pdgids
         }
         for pdgid in lifetimes:
diff --git a/panama/read.py b/panama/read.py
index 3ab62eb..68f5593 100644
--- a/panama/read.py
+++ b/panama/read.py
@@ -282,9 +282,11 @@ def read_DAT(
         # the use of pd.NA is currently experimental in Int64 type columns
         corsikaids = df_particles["corsikaid"].unique()
         pdg_map = {
-            corsikaid: int(Corsika7ID(corsikaid).to_pdgid())
-            if Corsika7ID(corsikaid).is_particle()
-            else PDGID_ERROR_VAL  # This will be our error value
+            corsikaid: (
+                int(Corsika7ID(corsikaid).to_pdgid())
+                if Corsika7ID(corsikaid).is_particle()
+                else PDGID_ERROR_VAL
+            )  # This will be our error value
             for corsikaid in corsikaids
         }
         df_particles["pdgid"] = (
@@ -381,9 +383,11 @@ def add_mother_columns(
         df_particles.loc[~df_particles["has_mother"], f"mother_{name}"] = error_val
 
     has_charm = {
-        pdgid: "c" in Particle.from_pdgid(pdgid).quarks.lower()
-        if pdgid != PDGID_ERROR_VAL
-        else False
+        pdgid: (
+            "c" in Particle.from_pdgid(pdgid).quarks.lower()
+            if pdgid != PDGID_ERROR_VAL
+            else False
+        )
         for pdgid in pdgids
     }
 
@@ -397,9 +401,11 @@ def add_mother_columns(
             lifetimes[pdgid] = 0
 
     is_resonance = {
-        pdgid: "*" in Particle.from_pdgid(pdgid).name
-        if pdgid != PDGID_ERROR_VAL
-        else False
+        pdgid: (
+            "*" in Particle.from_pdgid(pdgid).name
+            if pdgid != PDGID_ERROR_VAL
+            else False
+        )
         for pdgid in pdgids
     }
 
diff --git a/panama/run.py b/panama/run.py
index 2e1687f..76f0344 100644
--- a/panama/run.py
+++ b/panama/run.py
@@ -1,6 +1,7 @@
 """
 Classes handling the parallel execution of CORSIKA7 processes.
 """
+
 from __future__ import annotations
 
 import io
diff --git a/panama/weights.py b/panama/weights.py
index 107f69d..88c3b87 100644
--- a/panama/weights.py
+++ b/panama/weights.py
@@ -4,6 +4,7 @@
 are given in units of :math:`(\mathrm{m^2}\ \mathrm{s}\ \mathrm{sr}\ \mathrm{GeV})^{-1}`.
 
 """  # noqa: W605
+
 from __future__ import annotations
 
 from typing import Any
@@ -150,9 +151,9 @@ def add_weight_prompt(
         df.sort_index(inplace=True)
 
     df[weight_col_name] = 1.0
-    df.loc[
-        df[is_prompt_col_name] == True, weight_col_name  # noqa: E712
-    ] = prompt_factor
+    df.loc[df[is_prompt_col_name] == True, weight_col_name] = (  # noqa: E712
+        prompt_factor
+    )
 
 
 def add_weight_prompt_per_event(