Skip to content
Snippets Groups Projects
Commit c3b7d044 authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Black

parent 3ddccf0a
No related branches found
No related tags found
1 merge request!47Resolve "uproot4 integration"
Pipeline #16293 failed
......@@ -10,6 +10,7 @@ from .tools import cached_property
class GSGReader(EventReader):
"""reader for gSeaGen ROOT files"""
event_path = "Events"
skip_keys = ["Header"]
......
......@@ -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"""
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment