diff prompt.py @ 165:03886f17beef

Fix warnings about bad regex escaping in prompt
author IBBoard <dev@ibboard.co.uk>
date Fri, 30 Aug 2024 16:12:04 +0100
parents 8bf9fc90ce51
children
line wrap: on
line diff
--- a/prompt.py	Sat May 25 15:58:34 2024 +0100
+++ b/prompt.py	Fri Aug 30 16:12:04 2024 +0100
@@ -404,51 +404,51 @@
 
     patterns = {
         b'bookmark': _bookmark,
-        b'branch(\|quiet)?': _branch,
-        b'closed(\|quiet)?': _closed,
-        b'count(\|[^%b]*?)?' % brackets[-1:]: _count,
+        rb'branch(\|quiet)?': _branch,
+        rb'closed(\|quiet)?': _closed,
+        rb'count(\|[^%b]*?)?' % brackets[-1:]: _count,
         b'node(?:'
-            b'(\|short)'
-            b'|(\|merge)'
+            rb'(\|short)'
+            rb'|(\|merge)'
             b')*': _node,
         b'patch(?:'
-            b'(\|topindex)'
-            b'|(\|applied)'
-            b'|(\|unapplied)'
-            b'|(\|count)'
-            b'|(\|quiet)'
+            rb'(\|topindex)'
+            rb'|(\|applied)'
+            rb'|(\|unapplied)'
+            rb'|(\|count)'
+            rb'|(\|quiet)'
             b')*': _patch,
         b'patches(?:' +
-            b'(\|join\([^%b]*?\))' % brackets[-1:] +
-            b'|(\|reverse)' +
-            b'|(\|hide_applied)' +
-            b'|(\|hide_unapplied)' +
-            b'|(\|pre_applied\([^%b]*?\))' % brackets[-1:] +
-            b'|(\|post_applied\([^%b]*?\))' % brackets[-1:] +
-            b'|(\|pre_unapplied\([^%b]*?\))' % brackets[-1:] +
-            b'|(\|post_unapplied\([^%b]*?\))' % brackets[-1:] +
+            rb'(\|join\([^%b]*?\))' % brackets[-1:] +
+            rb'|(\|reverse)' +
+            rb'|(\|hide_applied)' +
+            rb'|(\|hide_unapplied)' +
+            rb'|(\|pre_applied\([^%b]*?\))' % brackets[-1:] +
+            rb'|(\|post_applied\([^%b]*?\))' % brackets[-1:] +
+            rb'|(\|pre_unapplied\([^%b]*?\))' % brackets[-1:] +
+            rb'|(\|post_unapplied\([^%b]*?\))' % brackets[-1:] +
             b')*': _patches,
         b'queue': _queue,
-        b'rev(\|merge)?': _rev,
+        rb'rev(\|merge)?': _rev,
         b'root': _root,
-        b'root\|basename': _basename,
+        rb'root\|basename': _basename,
         b'status(?:'
-            b'(\|modified)'
-            b'|(\|unknown)'
+            rb'(\|modified)'
+            rb'|(\|unknown)'
             b')*': _status,
         b'tags(?:' +
-            b'(\|quiet)' +
-            b'|(\|[^%b]*?)' % brackets[-1:] +
+            rb'(\|quiet)' +
+            rb'|(\|[^%b]*?)' % brackets[-1:] +
             b')*': _tags,
         b'task': _task,
         b'tip(?:'
-            b'(\|node)'
-            b'|(\|short)'
+            rb'(\|node)'
+            rb'|(\|short)'
             b')*': _tip,
         b'update': _update,
 
-        b'incoming(\|count)?': _remote(b'incoming'),
-        b'outgoing(\|count)?': _remote(b'outgoing'),
+        rb'incoming(\|count)?': _remote(b'incoming'),
+        rb'outgoing(\|count)?': _remote(b'outgoing'),
         b'inout': _inout,
     }