[2/2] utils: checkstyle.py: Update LogCategoryChecker regexp
diff mbox series

Message ID 20240227121448.656200-3-mzamazal@redhat.com
State Accepted
Commit 51054cef600c4e13c338b05cebf02fcf02b887d6
Headers show
Series
  • Minor fixes of checkstyle.py
Related show

Commit Message

Milan Zamazal Feb. 27, 2024, 12:14 p.m. UTC
The regexp uses obsolete form, update it to mute the warning emitted by Python
3.12:

  SyntaxWarning: invalid escape sequence '\('

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
---
 utils/checkstyle.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Laurent Pinchart Feb. 27, 2024, 12:29 p.m. UTC | #1
Hi Milan,

Thank you for the patch.

On Tue, Feb 27, 2024 at 01:14:47PM +0100, Milan Zamazal wrote:
> The regexp uses obsolete form, update it to mute the warning emitted by Python
> 3.12:
> 
>   SyntaxWarning: invalid escape sequence '\('
> 
> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  utils/checkstyle.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utils/checkstyle.py b/utils/checkstyle.py
> index af553cfd..fb03dc34 100755
> --- a/utils/checkstyle.py
> +++ b/utils/checkstyle.py
> @@ -588,7 +588,7 @@ class IncludeChecker(StyleChecker):
>  
>  
>  class LogCategoryChecker(StyleChecker):
> -    log_regex = re.compile('\\bLOG\((Debug|Info|Warning|Error|Fatal)\)')
> +    log_regex = re.compile(r'\bLOG\((Debug|Info|Warning|Error|Fatal)\)')
>      patterns = ('*.cpp',)
>  
>      def __init__(self, content):
Kieran Bingham Feb. 27, 2024, 1:11 p.m. UTC | #2
Quoting Milan Zamazal (2024-02-27 12:14:47)
> The regexp uses obsolete form, update it to mute the warning emitted by Python
> 3.12:
> 
>   SyntaxWarning: invalid escape sequence '\('
> 
> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  utils/checkstyle.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utils/checkstyle.py b/utils/checkstyle.py
> index af553cfd..fb03dc34 100755
> --- a/utils/checkstyle.py
> +++ b/utils/checkstyle.py
> @@ -588,7 +588,7 @@ class IncludeChecker(StyleChecker):
>  
>  
>  class LogCategoryChecker(StyleChecker):
> -    log_regex = re.compile('\\bLOG\((Debug|Info|Warning|Error|Fatal)\)')
> +    log_regex = re.compile(r'\bLOG\((Debug|Info|Warning|Error|Fatal)\)')
>      patterns = ('*.cpp',)
>  
>      def __init__(self, content):
> -- 
> 2.42.0
>

Patch
diff mbox series

diff --git a/utils/checkstyle.py b/utils/checkstyle.py
index af553cfd..fb03dc34 100755
--- a/utils/checkstyle.py
+++ b/utils/checkstyle.py
@@ -588,7 +588,7 @@  class IncludeChecker(StyleChecker):
 
 
 class LogCategoryChecker(StyleChecker):
-    log_regex = re.compile('\\bLOG\((Debug|Info|Warning|Error|Fatal)\)')
+    log_regex = re.compile(r'\bLOG\((Debug|Info|Warning|Error|Fatal)\)')
     patterns = ('*.cpp',)
 
     def __init__(self, content):