chiark / gitweb /
peerdb/tripe-newpeers.in: Upper-case the compiled regexp names.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 26 May 2018 11:22:22 +0000 (12:22 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Thu, 14 Jun 2018 11:50:37 +0000 (12:50 +0100)
Just a cosmetic change.

peerdb/tripe-newpeers.in

index adc847f760e5c83e4bb23568a38e2d4fee998400..59fd85fa0ec009bb02fab94ac30dc35b32cc7046 100644 (file)
@@ -104,10 +104,10 @@ class BulkResolver (object):
 ### The configuration parser.
 
 ## Match a $(VAR) configuration variable reference; group 1 is the VAR.
-r_ref = RX.compile(r'\$\(([^)]+)\)')
+RX_REF = RX.compile(r'(?x) \$ \( ([^)]+) \)')
 
 ## Match a $[HOST] name resolution reference; group 1 is the HOST.
-r_resolve = RX.compile(r'\$\[([^]]+)\]')
+RX_RESOLVE = RX.compile(r'(?x) \$ \[ ([^]]+) \]')
 
 def _fmt_path(path):
   return ' -> '.join(["`%s'" % hop for hop in path])
@@ -181,7 +181,7 @@ class MyConfigParser (CP.RawConfigParser):
     """
     for sec in me.sections():
       for key, value in me.items(sec, resolvep = False):
-        for match in r_resolve.finditer(value):
+        for match in RX_RESOLVE.finditer(value):
           me._resolver.prepare(match.group(1))
     me._resolver.run()
 
@@ -194,11 +194,11 @@ class MyConfigParser (CP.RawConfigParser):
     or not?  This is turned off by the resolve() method while it's collecting
     hostnames to be resolved.
     """
-    string = r_ref.sub \
+    string = RX_REF.sub \
              (lambda m: me.get(sec, m.group(1), resolvep), string)
     if resolvep:
-      string = r_resolve.sub(lambda m: me._resolver.lookup(m.group(1)),
-                             string)
+      string = RX_RESOLVE.sub(lambda m: me._resolver.lookup(m.group(1)),
+                              string)
     return string
 
   def has_option(me, sec, key):