tests/audit_log: Pre-compile GUID regex
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Fri, 19 May 2023 02:54:00 +0000 (14:54 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 24 May 2023 00:50:31 +0000 (00:50 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/audit_log_base.py

index c791a1a8ca897bb60d053dfa6fdd2ddd2d8f9cae..18f86a9d31094e9b272fe3a739eac1b46ed7334e 100644 (file)
@@ -183,13 +183,14 @@ class AuditLogTestBase(samba.tests.TestCase):
             self.context["txnMessage"] = None
             self.msg_ctx.loop_once(0.001)
 
-    GUID_RE = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
+    GUID_RE = re.compile(
+        "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}")
 
     #
     # Is the supplied GUID string correctly formatted
     #
     def is_guid(self, guid):
-        return re.match(self.GUID_RE, guid)
+        return self.GUID_RE.match(guid)
 
     def get_session(self):
         return self.auth_context["sessionId"]