From f3c33c5d6f5f1554056735689edcbd7dc7a7c6dd Mon Sep 17 00:00:00 2001 From: Zineb Aly <zaly@km3net.de> Date: Thu, 12 Nov 2020 12:30:38 +0100 Subject: [PATCH] make black --- km3io/tools.py | 12 +++++++----- tests/test_tools.py | 5 ++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/km3io/tools.py b/km3io/tools.py index 300da0e..3bc0ee0 100644 --- a/km3io/tools.py +++ b/km3io/tools.py @@ -781,16 +781,18 @@ def is_CC(fobj): if all(len_w2lists <= 7): # old nu file have w2list of len 7. usr = fobj.events.mc_tracks.usr_names cc_flag = usr[:, 0][:, 3] - out = (cc_flag == b'cc') # not very reliable, found NC files with cc flag! + out = cc_flag == b"cc" # not very reliable, found NC files with cc flag! else: if "gseagen" in program.lower(): cc_flag = w2list[:, kw2gsg.W2LIST_GSEAGEN_CC] - out = (cc_flag > 0) + out = cc_flag > 0 if "genhen" in program.lower(): cc_flag = w2list[:, kw2gen.W2LIST_GENHEN_CC] - out = (cc_flag > 0) + out = cc_flag > 0 else: - raise ValueError(f"simulation program {fobj.header.simul.program} is not implemented.") + raise ValueError( + f"simulation program {fobj.header.simul.program} is not implemented." + ) - return out \ No newline at end of file + return out diff --git a/tests/test_tools.py b/tests/test_tools.py index 7f325e7..c79fe97 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -31,7 +31,9 @@ from km3io.tools import ( ) OFFLINE_FILE = OfflineReader(data_path("offline/km3net_offline.root")) -GENHEN_OFFLINE_FILE = OfflineReader(data_path("offline/mcv5.1.genhen_anumuNC.sirene.jte.jchain.aashower.sample.root")) +GENHEN_OFFLINE_FILE = OfflineReader( + data_path("offline/mcv5.1.genhen_anumuNC.sirene.jte.jchain.aashower.sample.root") +) GSEAGEN_OFFLINE_FILE = OfflineReader(data_path("offline/numucc.root")) @@ -528,6 +530,7 @@ class TestUnfoldIndices(unittest.TestCase): with self.assertRaises(IndexError): unfold_indices(data, indices) + class TestIsCC(unittest.TestCase): def test_is_CC(self): NC_file = is_CC(GENHEN_OFFLINE_FILE) -- GitLab