Further simplify code

This commit is contained in:
XANTRONIX Industrial 2025-02-20 13:35:56 -05:00
parent 52978b267f
commit 44bd511347

View file

@ -3,8 +3,6 @@ import enum
import datetime
import shapely
from typing import Self
from nexrad.db import DatabaseTable
from nexrad.coord import COORD_SYSTEM
from nexrad.vtec import VTECEvent
@ -220,11 +218,16 @@ class AFOSMessageParser():
def parse_body(self, line: str):
if line == '&&':
self.state = AFOSMessageParserState.TAGS
elif self.timestamp is None:
return
if self.timestamp is not None:
return
match = RE_DATE.match(line)
if match is not None:
tzoffset = TIMEZONES[match['tz'].upper()]
tzinfo = datetime.timezone(datetime.timedelta(hours=tzoffset))
self.timestamp = datetime.datetime(
year = int(match['year']),
@ -233,7 +236,7 @@ class AFOSMessageParser():
hour = int(match['hour']),
minute = int(match['minute']),
second = 0,
tzinfo = datetime.timezone(datetime.timedelta(hours=tzoffset))
tzinfo = tzinfo
).astimezone(datetime.UTC)
def parse_tags(self, line: str):