From 295c4c2999409f9aac01940f4fc01b29cc88f8b6 Mon Sep 17 00:00:00 2001 From: Maximilian Linhoff Date: Thu, 27 Oct 2022 12:38:22 +0200 Subject: [PATCH] Move version check into cython --- src/eventio/simtel/objects.py | 4 +--- src/eventio/simtel/parsing.pyx | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/eventio/simtel/objects.py b/src/eventio/simtel/objects.py index bca05a5e..93cc781b 100644 --- a/src/eventio/simtel/objects.py +++ b/src/eventio/simtel/objects.py @@ -1406,10 +1406,8 @@ def __str__(self): ) def parse(self): - ''' ''' - assert_version_in(self, (1, 2)) + '''''' self.seek(0) - d = MCEvent.parse_mc_event(self.read(), self.header.version) d['event_id'] = self.header.id return d diff --git a/src/eventio/simtel/parsing.pyx b/src/eventio/simtel/parsing.pyx index 459f9c78..3b7723a2 100644 --- a/src/eventio/simtel/parsing.pyx +++ b/src/eventio/simtel/parsing.pyx @@ -54,6 +54,12 @@ cpdef dict parse_mc_event( const uint8_t[:] data, uint32_t version ): + if version > 2: + raise NotImplementedError( + 'Unsupported version of MCEvent:' + ' only versions up to 2 supported,' + f' got: {version} ' + ) cdef uint64_t pos = 0 cdef float xcore, ycore, aweight