From: Michael Orlitzky Date: Thu, 22 Sep 2022 01:30:35 +0000 (-0400) Subject: djbdns/{dnscache,tinydns}.py: don't clobber the global compile(). X-Git-Tag: 0.0.1~9 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=d73740c3a7d3696aaf7f3d677f83654cbd4b3583;p=djbdns-logparse.git djbdns/{dnscache,tinydns}.py: don't clobber the global compile(). --- diff --git a/djbdns/dnscache.py b/djbdns/dnscache.py index 785121b..0d9de08 100644 --- a/djbdns/dnscache.py +++ b/djbdns/dnscache.py @@ -1,9 +1,11 @@ -from re import compile +# Don't clobber the global compile() with a named import. +import re + from typing import Optional from djbdns.common import * # The regex to match dnscache log lines. -dnscache_log_re = compile(fr'({timestamp_pat}) (\w+)(.*)') +dnscache_log_re = re.compile(fr'({timestamp_pat}) (\w+)(.*)') def decode_client(words : list, i : int): diff --git a/djbdns/tinydns.py b/djbdns/tinydns.py index 52b06a4..34cedef 100644 --- a/djbdns/tinydns.py +++ b/djbdns/tinydns.py @@ -1,4 +1,6 @@ -from re import compile +# Don't clobber the global compile() with a named import. +import re + from typing import Optional from djbdns.common import * @@ -13,7 +15,7 @@ hex4_pat = r'[0-9a-f]{4}' ip_pat = r'[0-9a-f]{8,32}' # The regex to match tinydns log lines. -tinydns_log_re = compile( +tinydns_log_re = re.compile( rf'({timestamp_pat}) ({ip_pat}):({hex4_pat}):({hex4_pat}) ([\+\-IC/]) ({hex4_pat}) (.*)' )