From: Joseph Sutton Date: Thu, 28 Apr 2022 08:31:50 +0000 (+1200) Subject: python: Don't use deprecated escape sequences X-Git-Tag: tevent-0.13.0~420 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5045382c6dd04b1bae0eaaae823be908213ff079;p=thirdparty%2Fsamba.git python: Don't use deprecated escape sequences Certain escape sequences are not valid in Python string literals, and will eventually result in a SyntaxError. Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett Reviewed-by: Andreas Schneider --- diff --git a/buildtools/wafsamba/samba_cross.py b/buildtools/wafsamba/samba_cross.py index c6f8c2a0ef2..7ec1edc52ea 100644 --- a/buildtools/wafsamba/samba_cross.py +++ b/buildtools/wafsamba/samba_cross.py @@ -77,7 +77,7 @@ def cross_answer(ca_file, msg): f.close() return (0, ans.strip("'")) else: - m = re.match('\(\s*(-?\d+)\s*,\s*\"(.*)\"\s*\)', ans) + m = re.match(r'\(\s*(-?\d+)\s*,\s*\"(.*)\"\s*\)', ans) if m: f.close() return (int(m.group(1)), m.group(2)) diff --git a/python/samba/netcmd/ldapcmp.py b/python/samba/netcmd/ldapcmp.py index 762047c467b..dddd5a894be 100644 --- a/python/samba/netcmd/ldapcmp.py +++ b/python/samba/netcmd/ldapcmp.py @@ -279,7 +279,7 @@ class Descriptor(object): res = re.search(r"D:(.*?)(\(.*\))", self.sddl).group(2) except AttributeError: return [] - return re.findall("(\(.*?\))", res) + return re.findall(r"(\(.*?\))", res) def fix_sid(self, ace): res = "%s" % ace diff --git a/source4/dsdb/tests/python/acl.py b/source4/dsdb/tests/python/acl.py index 70dca9b7678..1271dfcc957 100755 --- a/source4/dsdb/tests/python/acl.py +++ b/source4/dsdb/tests/python/acl.py @@ -695,7 +695,7 @@ class AclSearchTests(AclTests): # Make sure there are inheritable ACEs initially self.assertTrue("CI" in desc_sddl or "OI" in desc_sddl) # Find and remove all inherit ACEs - res = re.findall("\(.*?\)", desc_sddl) + res = re.findall(r"\(.*?\)", desc_sddl) res = [x for x in res if ("CI" in x) or ("OI" in x)] for x in res: desc_sddl = desc_sddl.replace(x, "") diff --git a/source4/dsdb/tests/python/sec_descriptor.py b/source4/dsdb/tests/python/sec_descriptor.py index b67bf33b5f7..6471fc15c55 100755 --- a/source4/dsdb/tests/python/sec_descriptor.py +++ b/source4/dsdb/tests/python/sec_descriptor.py @@ -1248,7 +1248,7 @@ class DaclDescriptorTests(DescriptorTests): # Make sure there are inheritable ACEs initially self.assertTrue("CI" in desc_sddl or "OI" in desc_sddl) # Find and remove all inherit ACEs - res = re.findall("\(.*?\)", desc_sddl) + res = re.findall(r"\(.*?\)", desc_sddl) res = [x for x in res if ("CI" in x) or ("OI" in x)] for x in res: desc_sddl = desc_sddl.replace(x, "") @@ -1315,12 +1315,12 @@ class DaclDescriptorTests(DescriptorTests): # also make sure the added above non-inheritable ACEs are absent too desc_sddl = self.sd_utils.get_sd_as_sddl(group_dn) self.assertFalse("ID" in desc_sddl) - for x in re.findall("\(.*?\)", mod): + for x in re.findall(r"\(.*?\)", mod): self.assertFalse(x in desc_sddl) self.sd_utils.modify_sd_on_dn(group_dn, "D:" + moded) desc_sddl = self.sd_utils.get_sd_as_sddl(group_dn) self.assertFalse("ID" in desc_sddl) - for x in re.findall("\(.*?\)", mod): + for x in re.findall(r"\(.*?\)", mod): self.assertFalse(x in desc_sddl) def test_203(self):