[1/3] Fix regexp syntax warnings in localedata/unicode-gen/ctype_compatibility.py

Message ID 20230915094038.1178807-1-mfabian@redhat.com
State Committed
Commit ba017b4f9d90ee30e409034b4a32af71e3136a7f
Delegated to: Mike Fabian
Headers
Series [1/3] Fix regexp syntax warnings in localedata/unicode-gen/ctype_compatibility.py |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 warning Patch is already merged
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 warning Patch is already merged
linaro-tcwg-bot/tcwg_glibc_build--master-arm warning Patch is already merged
linaro-tcwg-bot/tcwg_glibc_check--master-arm warning Patch is already merged

Commit Message

Mike FABIAN Sept. 15, 2023, 9:40 a.m. UTC
  Fix these:

$ python -m py_compile ./ctype_compatibility.py
./ctype_compatibility.py:146: SyntaxWarning: invalid escape sequence '\)'
---
 localedata/unicode-gen/ctype_compatibility.py | 26 +++++++++----------
 1 file changed, 13 insertions(+), 13 deletions(-)
  

Comments

Carlos O'Donell Sept. 15, 2023, 11:51 a.m. UTC | #1
On 9/15/23 05:40, Mike FABIAN wrote:
> Fix these:

LGTM. Please commit.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> $ python -m py_compile ./ctype_compatibility.py
> ./ctype_compatibility.py:146: SyntaxWarning: invalid escape sequence '\)'
> ---
>  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 a22ea2bbc9..09eac2fbc3 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'^<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((
  

Patch

diff --git a/localedata/unicode-gen/ctype_compatibility.py b/localedata/unicode-gen/ctype_compatibility.py
index a22ea2bbc9..09eac2fbc3 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'^<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((