From d73740c3a7d3696aaf7f3d677f83654cbd4b3583 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 21 Sep 2022 21:30:35 -0400 Subject: [PATCH] djbdns/{dnscache,tinydns}.py: don't clobber the global compile(). --- djbdns/dnscache.py | 6 ++++-- djbdns/tinydns.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) 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}) (.*)' ) -- 2.44.2