]> gitweb.michael.orlitzky.com - djbdns-logparse.git/commitdiff
bin/djbdns-logparse.py: localize subprocess imports.
authorMichael Orlitzky <michael@orlitzky.com>
Fri, 16 Sep 2022 00:22:46 +0000 (20:22 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Fri, 16 Sep 2022 00:22:46 +0000 (20:22 -0400)
bin/djbdns-logparse.py

index e6a6759ad2f3fa73aeb41053731e0c08d9f72d9e..2a7f6cab5bb4a1f4411d8de82c9ac88db46c0be4 100755 (executable)
@@ -5,7 +5,6 @@ Convert tinydns and dnscache logs to human-readable form
 
 import re, typing
 from struct import pack
-from subprocess import Popen, PIPE
 from time import strftime, gmtime
 
 
@@ -393,9 +392,10 @@ def parse_logfile(file : typing.TextIO):
         >>> remove(f.name)
 
     """
-    # Open pipe to tai64nlocal: we will write lines of our input (the
-    # raw log file) to it, and read log lines with readable timestamps
-    # from it.
+    # Open a pipe to tai64nlocal. We'll write lines of our input file
+    # (the log file) to it, and read back the same lines but with
+    # friendly timestamps in them.
+    from subprocess import Popen, PIPE
     tai = Popen(["tai64nlocal"], stdin=PIPE, stdout=PIPE, text=True, bufsize=0)
 
     for line in file: