From bfff79c9291d3a2a589b51ead45cfe5c2b8f2d6c Mon Sep 17 00:00:00 2001 From: XANTRONIX Industrial <xan@xantronix.com> Date: Sun, 23 Feb 2025 21:06:12 -0500 Subject: [PATCH] Regex readability improvements --- lib/xmet/igra.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/xmet/igra.py b/lib/xmet/igra.py index bdb5dc4..abaaecc 100644 --- a/lib/xmet/igra.py +++ b/lib/xmet/igra.py @@ -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: