]> gitweb.michael.orlitzky.com - djbdns-logparse.git/blobdiff - djbdns/common.py
djbdns/*.py: don't clobber id() and type() built-ins.
[djbdns-logparse.git] / djbdns / common.py
index 6ef4e1ceae89ab6cea39b69330b4196a8e3ff892..06124bf2ef03135d7177b18787a61d8bf7ed31b0 100644 (file)
@@ -12,7 +12,7 @@ timestamp_pat = r'[\d-]+ [\d:\.]+'
 #
 # Note that mapping here is non-exhaustive, and that tinydns will
 # log responses for record types that it does not know about.
-query_type = {
+query_type_name = {
       1: "a",
       2: "ns",
       5: "cname",
@@ -67,6 +67,6 @@ def convert_ip(ip : str) -> str:
     if len(ip) == 8:
         # IPv4, eg. "7f000001" -> "7f 00 00 01" -> "127.0.0.1"
         return ".".join(map(str, pack(">L", int(ip, 16))))
-    elif len(ip) == 32:
-        # IPv6 is actually simpler -- it's just a string-slicing operation.
-        return ":".join([ip[(4*i) : (4*i+4)] for i in range(8)])
+
+    # IPv6 is actually simpler -- it's just a string-slicing operation.
+    return ":".join([ip[(4*i) : (4*i+4)] for i in range(8)])