Debian Codegraph @

debian/patches/Fix-SyntaxWarning

raw
1 Description: Fix SyntaxWarning in regex patterns by using raw strings
2 The package emitted SyntaxWarnings ("invalid escape sequence") during piuparts tests.
3 This patch adds the 'r' prefix to the regex patterns in jube/benchmark.py and
4 jube/util/util.py, ensuring that backslashes are treated as literal characters.
5 .
6 jube (2.7.1-3) unstable; urgency=low
7 .
8 * Fix SyntaxWarning in regex patterns by adding raw strings.
9 Author: Gonzalo Silvalde <[email protected]>
10 Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1085657
11 ---
12 The information above should follow the Patch Tagging Guidelines, please
13 checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here
14 are templates for supplementary fields that you might want to add:
15
16 Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>)
17 Bug: <upstream-bugtracker-url>
18 Bug-Debian: https://bugs.debian.org/<bugnumber>
19 Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
20 Forwarded: (no|not-needed|<patch-forwarded-url>)
21 Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>)
22 Reviewed-By: <name and email of someone who approved/reviewed the patch>
23 Last-Update: 2025-03-12
24
25 --- jube-2.7.1.orig/jube/benchmark.py
26 +++ jube-2.7.1/jube/benchmark.py
27 @@ -680,7 +680,7 @@ class Benchmark(object):
28 filenames = [file for file in os.listdir(self.bench_dir)
29 if file.startswith(log_fname.split('.')[0]) and
30 file != log_fname]
31 - filenames.sort(key=lambda o: int(re.split('_|\.', o)[1]))
32 + filenames.sort(key=lambda o: int(re.split(r'_|\.', o)[1]))
33 with open(current_logfile_name, 'a') as outfile:
34 for fname in filenames:
35 with open(os.path.join(self.bench_dir, fname), 'r') as infile:
36 --- jube-2.7.1.orig/jube/util/util.py
37 +++ jube-2.7.1/jube/util/util.py
38 @@ -244,7 +244,7 @@ def substitution(text, substitution_dict
39 text = new_text
40 # Final substitution to remove $$
41 tmp = string.Template(text)
42 - return re.sub("\$(?=([\s]|$))","$$",tmp.safe_substitute(str_substitution_dict))
43 + return re.sub(r"\$(?=([\s]|$))","$$",tmp.safe_substitute(str_substitution_dict))
44
45
46 def convert_type(name, value_type, value, stop=True):