File: Fix-SyntaxWarning

package info (click to toggle)
jube 2.7.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,640 kB
  • sloc: python: 8,415; xml: 838; sh: 180; makefile: 14
file content (46 lines) | stat: -rw-r--r-- 2,310 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
Description: Fix SyntaxWarning in regex patterns by using raw strings
 The package emitted SyntaxWarnings ("invalid escape sequence") during piuparts tests.
 This patch adds the 'r' prefix to the regex patterns in jube/benchmark.py and
 jube/util/util.py, ensuring that backslashes are treated as literal characters.
 .
 jube (2.7.1-3) unstable; urgency=low
 .
   * Fix SyntaxWarning in regex patterns by adding raw strings.
Author: Gonzalo Silvalde <gonzalo.silvalde@gmail.com>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1085657
---
The information above should follow the Patch Tagging Guidelines, please
checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>)
Bug: <upstream-bugtracker-url>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: (no|not-needed|<patch-forwarded-url>)
Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>)
Reviewed-By: <name and email of someone who approved/reviewed the patch>
Last-Update: 2025-03-12

--- jube-2.7.1.orig/jube/benchmark.py
+++ jube-2.7.1/jube/benchmark.py
@@ -680,7 +680,7 @@ class Benchmark(object):
                 filenames = [file for file in os.listdir(self.bench_dir)
                              if file.startswith(log_fname.split('.')[0]) and
                              file != log_fname]
-                filenames.sort(key=lambda o: int(re.split('_|\.', o)[1]))
+                filenames.sort(key=lambda o: int(re.split(r'_|\.', o)[1]))
                 with open(current_logfile_name, 'a') as outfile:
                     for fname in filenames:
                         with open(os.path.join(self.bench_dir, fname), 'r') as infile:
--- jube-2.7.1.orig/jube/util/util.py
+++ jube-2.7.1/jube/util/util.py
@@ -244,7 +244,7 @@ def substitution(text, substitution_dict
         text = new_text
     # Final substitution to remove $$
     tmp = string.Template(text)
-    return re.sub("\$(?=([\s]|$))","$$",tmp.safe_substitute(str_substitution_dict))
+    return re.sub(r"\$(?=([\s]|$))","$$",tmp.safe_substitute(str_substitution_dict))
 
 
 def convert_type(name, value_type, value, stop=True):