]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix regexp syntax warnings in localedata/unicode-gen/ctype_compatibility.py
authorMike FABIAN <mfabian@redhat.com>
Thu, 14 Sep 2023 16:20:57 +0000 (18:20 +0200)
committerMike FABIAN <mfabian@redhat.com>
Sat, 16 Sep 2023 06:37:02 +0000 (08:37 +0200)
Fix these:

$ python -m py_compile ./ctype_compatibility.py
./ctype_compatibility.py:146: SyntaxWarning: invalid escape sequence '\)'

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
localedata/unicode-gen/ctype_compatibility.py

index a22ea2bbc9af75669986d9c27954f28bc6f5a1b5..09eac2fbc361a731204997f0527dfcc345624a3c 100755 (executable)
@@ -89,12 +89,12 @@ def extract_character_classes(filename):
                 'tolower',
                 'totitle']:
             match = re.match(r'^('
-                             +'(?:(?:class|map)\s+")'
+                             r'(?:(?:class|map)\s+")'
                              +re.escape(char_class)+
-                             '(?:";)\s+'
-                             +'|'
-                             +re.escape(char_class)+'\s+'
-                             +')', line)
+                             r'(?:";)\s+'
+                             r'|'
+                             +re.escape(char_class)+r'\s+'+
+                             r')', line)
             if match:
                 if char_class not in ctype_dict:
                     ctype_dict[char_class] = []
@@ -117,8 +117,8 @@ def process_chars(char_class_list, code_point_line):
             continue
         match = re.match(
             r'^<U(?P<codepoint1>[0-9A-F]{4,8})>'
-            +'\.\.'+
-            '<U(?P<codepoint2>[0-9A-F]{4,8})>$',
+            r'\.\.'
+            r'<U(?P<codepoint2>[0-9A-F]{4,8})>$',
             code_points)
         if match: # <Uxxxx>..<Uxxxx>
             for codepoint in range(
@@ -128,8 +128,8 @@ def process_chars(char_class_list, code_point_line):
             continue
         match = re.match(
             r'^<U(?P<codepoint1>[0-9A-F]{4,8})>'
-            +'\.\.\(2\)\.\.'+
-            '<U(?P<codepoint2>[0-9A-F]{4,8})>$',
+            r'\.\.\(2\)\.\.'
+            r'<U(?P<codepoint2>[0-9A-F]{4,8})>$',
             code_points)
         if match: # <Uxxxx>..(2)..<Uxxxx>
             for codepoint in range(
@@ -140,10 +140,10 @@ def process_chars(char_class_list, code_point_line):
             continue
         match = re.match(
             r'^\('
-            +'<U(?P<codepoint1>[0-9A-F]{4,8})>'
-            +','+
-            '<U(?P<codepoint2>[0-9A-F]{4,8})>'
-            +'\)$',
+            r'<U(?P<codepoint1>[0-9A-F]{4,8})>'
+            r','
+            r'<U(?P<codepoint2>[0-9A-F]{4,8})>'
+            r'\)$',
             code_points)
         if match: # (<Uxxxx>,<Uxxxx>)
             char_class_list.append((