Regex readability improvements

This commit is contained in:
XANTRONIX 2025-02-23 21:06:12 -05:00
parent 87d5031e92
commit bfff79c929

View file

@ -17,25 +17,25 @@ RE_HEADER = re.compile(r'''
[ ] (?P<numlev>[0-9\ ]{4})
[ ] (?P<p_src>.{8})
[ ] (?P<np_src>.{8})
[ ] (?P<lat>[0-9 ]{7})
[ ] (?P<lon>[0-9 ]{8})
[ ] (?P<lat>[0-9\- ]{7})
[ ] (?P<lon>[0-9\- ]{8})
$
''', re.X)
RE_SAMPLE = re.compile(r'''
^ (?P<lvltyp1>\d)
(?P<lvltyp2>\d)
[ ] (?P<etime>[0-9 \-]{5})
(?P<press>[0-9 \-]{7})
[ ] (?P<etime>[0-9\- ]{5})
(?P<press>[0-9\- ]{7})
(?P<pflag>[AB ])
(?P<gph>[0-9 \-]{5})
(?P<gph>[0-9\- ]{5})
(?P<zflag>[AB ])
(?P<temp>[0-9 \-]{5})
(?P<temp>[0-9\- ]{5})
(?P<tflag>[AB ])
(?P<rh>[0-9 \-]{5})
[ ] (?P<dpdp>[0-9 \-]{5})
[ ] (?P<wdir>[0-9 \-]{5})
[ ] (?P<wspd>[0-9 \-]{5})
(?P<rh>[0-9\- ]{5})
[ ] (?P<dpdp>[0-9\- ]{5})
[ ] (?P<wdir>[0-9\- ]{5})
[ ] (?P<wspd>[0-9\- ]{5})
''', re.X)
def etime_to_seconds(etime: str) -> int: