File: syntax-warning.patch

package info (click to toggle)
srst2 0.2.0-14
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,072 kB
  • sloc: python: 3,115; sh: 50; makefile: 25
file content (69 lines) | stat: -rw-r--r-- 3,166 bytes parent folder | download | duplicates (2)
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
Description: fix Python SyntaxWarning.
Author: Étienne Mollier <emollier@debian.org>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1087097
Forwarded: no
Last-Update: 2024-12-05
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- srst2.orig/database_clustering/VFDB_cdhit_to_csv.py
+++ srst2/database_clustering/VFDB_cdhit_to_csv.py
@@ -50,7 +50,7 @@
 	for record in SeqIO.parse(open(args.infile, "r"), "fasta"):
 		full_name = record.description
 		genus = full_name.split("[")[-1].split()[0]
-		in_brackets = re.findall('\((.*?)\)', full_name)
+		in_brackets = re.findall(r'\((.*?)\)', full_name)
 		seqID = full_name.split("(")[0]
 		if in_brackets[0].startswith('gi:'):
 			gene = in_brackets[1]
--- srst2.orig/database_clustering/align_plot_tree_min3.py
+++ srst2/database_clustering/align_plot_tree_min3.py
@@ -25,7 +25,7 @@
         #alignment()
 
 
-r('''
+r(r'''
         require(ape, quietly=TRUE)
 
         all_files = list.files("/home/UNIMELB/hdashnow/resistance_database/by_gene",
--- srst2.orig/scripts/getmlst.py
+++ srst2/scripts/getmlst.py
@@ -178,7 +178,7 @@
 
 	print("\n  For SRST2, remember to check what separator is being used in this allele database")
 	head = os.popen('head -n 1 ' + species_all_fasta_filename).read().rstrip()
-	m = re.match('>(.*)([_-])(\d*)',head).groups()
+	m = re.match(r'>(.*)([_-])(\d*)',head).groups()
 	if len(m)==3:
 		print()
 		print("  Looks like --mlst_delimiter '" + m[1] + "'")
--- srst2.orig/scripts/srst2.py
+++ srst2/scripts/srst2.py
@@ -87,7 +87,7 @@
 
 	# Mapping parameters for bowtie2
 	parser.add_argument('--stop_after', type=str, required=False, help='Stop mapping after this number of reads have been mapped (otherwise map all)')
-	parser.add_argument('--other', type=str, help='Other arguments to pass to bowtie2 (must be escaped, e.g. "\--no-mixed".', required=False)
+	parser.add_argument('--other', type=str, help=r'Other arguments to pass to bowtie2 (must be escaped, e.g. "\--no-mixed".', required=False)
 
 	# Filtering parameters for initial SAM file
 	parser.add_argument('--max_unaligned_overlap', type=int, default=10, help='Read discarded from alignment if either of its ends has unaligned '+\
@@ -96,7 +96,7 @@
 	# Samtools parameters
 	parser.add_argument('--mapq', type=int, default=1, help='Samtools -q parameter (default 1)')
 	parser.add_argument('--baseq', type=int, default=20, help='Samtools -Q parameter (default 20)')
-	parser.add_argument('--samtools_args', type=str, help='Other arguments to pass to samtools mpileup (must be escaped, e.g. "\-A").', required=False)
+	parser.add_argument('--samtools_args', type=str, help=r'Other arguments to pass to samtools mpileup (must be escaped, e.g. "\-A").', required=False)
 
 	# Reporting options
 	parser.add_argument('--output', type=str, required=True, help='Prefix for srst2 output files')
@@ -238,7 +238,7 @@
 					continue
 				flag = int(fields[1])
 				flag = (flag - 256) if (flag & 256) else flag
-				m = re.search("NM:i:(\d+)\s",line)
+				m = re.search(r"NM:i:(\d+)\s",line)
 				if m != None:
 					num_mismatch = m.group(1)
 					if int(num_mismatch) <= int(max_mismatch):