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
This commit is part of merge request !47. Comments created here will be created in the context of that merge request.
...@@ -10,6 +10,7 @@ from .tools import cached_property ...@@ -10,6 +10,7 @@ from .tools import cached_property
class GSGReader(EventReader): class GSGReader(EventReader):
"""reader for gSeaGen ROOT files""" """reader for gSeaGen ROOT files"""
event_path = "Events" event_path = "Events"
skip_keys = ["Header"] skip_keys = ["Header"]
......
...@@ -10,6 +10,7 @@ import logging ...@@ -10,6 +10,7 @@ import logging
log = logging.getLogger("km3io.rootio") log = logging.getLogger("km3io.rootio")
class EventReader: class EventReader:
"""reader for offline ROOT files""" """reader for offline ROOT files"""
...@@ -129,7 +130,9 @@ class EventReader: ...@@ -129,7 +130,9 @@ class EventReader:
# indexing # indexing
# TODO: maybe just propagate everything to awkward and let it deal # TODO: maybe just propagate everything to awkward and let it deal
# with the type? # 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)): if isinstance(key, (int, np.int32, np.int64)):
key = int(key) key = int(key)
return self.__class__( return self.__class__(
...@@ -239,7 +242,11 @@ class EventReader: ...@@ -239,7 +242,11 @@ class EventReader:
return 1 return 1
else: else:
# ignore the usual index magic and access `id` directly # 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): def __actual_len__(self):
"""The raw number of events without any indexing/slicing magic""" """The raw number of events without any indexing/slicing magic"""
......
...@@ -439,6 +439,7 @@ class TestBranchIndexingMagic(unittest.TestCase): ...@@ -439,6 +439,7 @@ class TestBranchIndexingMagic(unittest.TestCase):
# test selecting with a list # test selecting with a list
self.assertEqual(3, len(self.events[ak.Array([0, 2, 3])])) self.assertEqual(3, len(self.events[ak.Array([0, 2, 3])]))
class TestUsr(unittest.TestCase): class TestUsr(unittest.TestCase):
def setUp(self): def setUp(self):
self.f = OFFLINE_USR 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