File: fix-re-syntax-warnings

package info (click to toggle)
yotta 0.20.5-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,880 kB
  • sloc: python: 11,279; makefile: 32
file content (82 lines) | stat: -rw-r--r-- 3,041 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Description: Handle "SyntaxWarning: invalid escape sequence" RE warnings
Author: Nick Morrott <nickm@debian.org>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1087196
Forwarded: not-needed
Last-Update: 2025-02-08
---
--- a/yotta/init.py
+++ b/yotta/init.py
@@ -23,9 +23,9 @@
     'bsd-3-clause': 'BSD-3-Clause'
 }
 
-Git_Repo_RE = re.compile("^(git[+a-zA-Z-]*:.*|.*\.git|.*git@.*github\.com.*)$")
-HG_Repo_RE  = re.compile("^(hg[+a-zA-Z-]*:.*|.*\.hg)$")
-SVN_Repo_RE = re.compile("^svn[+a-zA-Z-]*:.*$")
+Git_Repo_RE = re.compile(r"^(git[+a-zA-Z-]*:.*|.*\.git|.*git@.*github\.com.*)$")
+HG_Repo_RE  = re.compile(r"^(hg[+a-zA-Z-]*:.*|.*\.hg)$")
+SVN_Repo_RE = re.compile(r"^svn[+a-zA-Z-]*:.*$")
 
 
 
--- a/yotta/lib/pack.py
+++ b/yotta/lib/pack.py
@@ -45,7 +45,7 @@
     '.yotta.json'
 ]
 
-Readme_Regex = re.compile('^readme(?:\.md)', re.IGNORECASE)
+Readme_Regex = re.compile(r'^readme(?:\.md)', re.IGNORECASE)
 
 Ignore_List_Fname = '.yotta_ignore'
 Shrinkwrap_Fname  = 'yotta-shrinkwrap.json'
--- a/yotta/lib/registry_access.py
+++ b/yotta/lib/registry_access.py
@@ -43,7 +43,7 @@
 
 Registry_Base_URL = 'https://registry.yottabuild.org'
 Website_Base_URL  = 'https://yottabuild.org'
-_OpenSSH_Keyfile_Strip = re.compile(b"^(ssh-[a-z0-9]*\s+)|(\s+.+\@.+)|\n", re.MULTILINE)
+_OpenSSH_Keyfile_Strip = re.compile(r"^(ssh-[a-z0-9]*\s+)|(\s+.+\@.+)|\n", re.MULTILINE)
 
 logger = logging.getLogger('access')
 
--- a/yotta/lib/validate.py
+++ b/yotta/lib/validate.py
@@ -10,10 +10,10 @@
 
 
 
-Source_Dir_Regex = re.compile('^[a-z0-9_-]*$')
-Source_Dir_Invalid_Regex = re.compile('[^a-z0-9_-]*')
-Component_Name_Replace_With_Dash = re.compile('[^a-z0-9]+')
-Looks_Like_An_Email = re.compile('^[^@]+@[^@]+\.[^@]+$')
+Source_Dir_Regex = re.compile(r'^[a-z0-9_-]*$')
+Source_Dir_Invalid_Regex = re.compile(r'[^a-z0-9_-]*')
+Component_Name_Replace_With_Dash = re.compile(r'[^a-z0-9]+')
+Looks_Like_An_Email = re.compile(r'^[^@]+@[^@]+\.[^@]+$')
 
 Component_Name_Regex = r'^[a-z]+[a-z0-9-]*$'
 Target_Name_Regex = r'^[a-z]+[a-z0-9+-]*$'
--- a/yotta/lib/version.py
+++ b/yotta/lib/version.py
@@ -165,7 +165,7 @@
         #  ~1.2.3 := >=1.2.3-0 <1.3.0-0
         #  ^1.2.3 := >=1.2.3-0 <2.0.0-0
         #  ^0.1.2 := 0.1.2 exactly (for 0.x.x versions)
-        elif re.match('^\^', version_spec):
+        elif re.match(r'^\^', version_spec):
             v = semantic_version.Version(version_spec[1:])
             if v.major == 0:
                 # for 0. releases, ^ means exact version only
--- a/yotta/test_subcommand.py
+++ b/yotta/test_subcommand.py
@@ -49,7 +49,7 @@
     # seems to be to parse the CTestTestfile.cmake files, which kinda sucks,
     # but works... Patches welcome.
     tests = []
-    add_test_re = re.compile('add_test\\(([^" ]*)\s*"(.*)"\\)', flags=re.IGNORECASE)
+    add_test_re = re.compile(r'add_test\\(([^" ]*)\s*"(.*)"\\)', flags=re.IGNORECASE)
     for root, dirs, files in os.walk(builddir, topdown=True):
         if not recurse_yotta_modules:
             dirs = [d for d in dirs if d != 'ym']