From c3b7d04404f1118f33ab93bb39ffab9a3c31281a Mon Sep 17 00:00:00 2001 From: Tamas Gal <tgal@km3net.de> Date: Wed, 9 Dec 2020 18:22:22 +0100 Subject: [PATCH] Black --- km3io/gseagen.py | 1 + km3io/rootio.py | 11 +++++++++-- tests/test_offline.py | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/km3io/gseagen.py b/km3io/gseagen.py index 5d4188f..d14502d 100644 --- a/km3io/gseagen.py +++ b/km3io/gseagen.py @@ -10,6 +10,7 @@ from .tools import cached_property class GSGReader(EventReader): """reader for gSeaGen ROOT files""" + event_path = "Events" skip_keys = ["Header"] diff --git a/km3io/rootio.py b/km3io/rootio.py index c05b459..5c4e4de 100644 --- a/km3io/rootio.py +++ b/km3io/rootio.py @@ -10,6 +10,7 @@ import logging log = logging.getLogger("km3io.rootio") + class EventReader: """reader for offline ROOT files""" @@ -129,7 +130,9 @@ class EventReader: # indexing # TODO: maybe just propagate everything to awkward and let it deal # with the type? - if isinstance(key, (slice, int, np.int32, np.int64, list, np.ndarray, ak.Array)): + if isinstance( + key, (slice, int, np.int32, np.int64, list, np.ndarray, ak.Array) + ): if isinstance(key, (int, np.int32, np.int64)): key = int(key) return self.__class__( @@ -239,7 +242,11 @@ class EventReader: return 1 else: # ignore the usual index magic and access `id` directly - return len(unfold_indices(self._fobj[self.event_path]["id"].array(), self._index_chain)) + return len( + unfold_indices( + self._fobj[self.event_path]["id"].array(), self._index_chain + ) + ) def __actual_len__(self): """The raw number of events without any indexing/slicing magic""" diff --git a/tests/test_offline.py b/tests/test_offline.py index 197105d..8e9e52e 100644 --- a/tests/test_offline.py +++ b/tests/test_offline.py @@ -439,6 +439,7 @@ class TestBranchIndexingMagic(unittest.TestCase): # test selecting with a list self.assertEqual(3, len(self.events[ak.Array([0, 2, 3])])) + class TestUsr(unittest.TestCase): def setUp(self): self.f = OFFLINE_USR -- GitLab