Semantic improvements in MBoxReaderBuffer

This commit is contained in:
XANTRONIX Development 2025-01-05 23:18:27 -05:00
parent 00b0347fe2
commit a6a6d32e79

View file

@ -44,15 +44,20 @@ class MBoxReaderBuffer():
def is_start(self): def is_start(self):
if self.lines[0] is None or self.lines[1] is None: if self.lines[0] is None or self.lines[1] is None:
return return False
if self.is_from_line(0) and self.is_header_line(1): if self.is_from_line(0) \
pass and self.is_header_line(1) \
and self.lines[2] is None \
and self.lines[3] is None:
return True
elif self.is_empty_line(0) \ elif self.is_empty_line(0) \
and self.is_empty_line(1) \ and self.is_empty_line(1) \
and self.is_from_line(2) \ and self.is_from_line(2) \
and self.is_header_line(3): and self.is_header_line(3):
return 3 return True
else:
return False
class MBoxReader(): class MBoxReader():
__slots__ = 'path', 'fh', 'line', 'buf', 'message', __slots__ = 'path', 'fh', 'line', 'buf', 'message',