From ba017b4f9d90ee30e409034b4a32af71e3136a7f Mon Sep 17 00:00:00 2001 From: Mike FABIAN Date: Thu, 14 Sep 2023 18:20:57 +0200 Subject: [PATCH] Fix regexp syntax warnings in localedata/unicode-gen/ctype_compatibility.py Fix these: $ python -m py_compile ./ctype_compatibility.py ./ctype_compatibility.py:146: SyntaxWarning: invalid escape sequence '\)' Reviewed-by: Carlos O'Donell --- localedata/unicode-gen/ctype_compatibility.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/localedata/unicode-gen/ctype_compatibility.py b/localedata/unicode-gen/ctype_compatibility.py index a22ea2b..09eac2f 100755 --- a/localedata/unicode-gen/ctype_compatibility.py +++ b/localedata/unicode-gen/ctype_compatibility.py @@ -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'^[0-9A-F]{4,8})>' - +'\.\.'+ - '[0-9A-F]{4,8})>$', + r'\.\.' + r'[0-9A-F]{4,8})>$', code_points) if match: # .. for codepoint in range( @@ -128,8 +128,8 @@ def process_chars(char_class_list, code_point_line): continue match = re.match( r'^[0-9A-F]{4,8})>' - +'\.\.\(2\)\.\.'+ - '[0-9A-F]{4,8})>$', + r'\.\.\(2\)\.\.' + r'[0-9A-F]{4,8})>$', code_points) if match: # ..(2).. for codepoint in range( @@ -140,10 +140,10 @@ def process_chars(char_class_list, code_point_line): continue match = re.match( r'^\(' - +'[0-9A-F]{4,8})>' - +','+ - '[0-9A-F]{4,8})>' - +'\)$', + r'[0-9A-F]{4,8})>' + r',' + r'[0-9A-F]{4,8})>' + r'\)$', code_points) if match: # (,) char_class_list.append(( -- 2.7.4