From: Joe Guo Date: Tue, 6 Nov 2018 08:37:47 +0000 (+1300) Subject: netcmd/ldapcmp: promote re object to global X-Git-Tag: tdb-1.3.17~691 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26f0992c24281514dd3ef079c1951a56277373a4;p=thirdparty%2Fsamba.git netcmd/ldapcmp: promote re object to global Then we can reuse the re obj. Signed-off-by: Joe Guo Reviewed-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/netcmd/ldapcmp.py b/python/samba/netcmd/ldapcmp.py index 4acabaa87db..ffa452c909a 100644 --- a/python/samba/netcmd/ldapcmp.py +++ b/python/samba/netcmd/ldapcmp.py @@ -37,6 +37,8 @@ from samba.netcmd import ( Option, ) +RE_RANGED_RESULT = re.compile("^([^;]+);range=(\d+)-(\d+|\*)$") + class LDAPBase(object): @@ -138,9 +140,7 @@ class LDAPBase(object): It resolved ranged results e.g. member;range=0-1499 """ - r = re.compile("^([^;]+);range=(\d+)-(\d+|\*)$") - - m = r.match(key) + m = RE_RANGED_RESULT.match(key) if m is None: return key @@ -151,9 +151,7 @@ class LDAPBase(object): It resolved ranged results e.g. member;range=0-1499 """ - r = re.compile("^([^;]+);range=(\d+)-(\d+|\*)$") - - m = r.match(key) + m = RE_RANGED_RESULT.match(key) if m is None: # no range, just return the values return vals @@ -175,7 +173,7 @@ class LDAPBase(object): fvals = None for key in res.keys(): - m = r.match(key) + m = RE_RANGED_RESULT.match(key) if m is None: continue