File: python3.12-syntax.patch

package info (click to toggle)
presto 0.7.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 944 kB
  • sloc: python: 7,686; sh: 85; makefile: 14
file content (70 lines) | stat: -rw-r--r-- 2,877 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
70
Description: Fix Python3.12 string syntax
Bug-Debian: https://bugs.debian.org/1085789
Author: Andreas Tille <tille@debian.org>
Last-Update: 2024-06-09

--- a/presto/Annotation.py
+++ b/presto/Annotation.py
@@ -290,7 +290,7 @@ def convertGenericHeader(desc, delimiter
       dict: a dictionary of header field and value pairs.
     """
     # Replace whitespace and delimiter characters
-    sub_regex = '[%s\s]+' % re.escape(''.join(delimiter))
+    sub_regex = r'[%s\s]+' % re.escape(''.join(delimiter))
     conv = re.sub(sub_regex, '_', desc)
     try:
         # Check if modified header is valid
@@ -365,7 +365,7 @@ def convertGenbankHeader(desc, delimiter
         >gi|568336023|gb|CM000663.2| Homo sapiens chromosome 1, GRCh38 reference primary assembly
     """
     # Define special characters to replace
-    sub_regex = '[%s\s]+' % re.escape(''.join(delimiter[1:]))
+    sub_regex = r'[%s\s]+' % re.escape(''.join(delimiter[1:]))
 
     # Split description and assign field names
     try:
@@ -488,10 +488,10 @@ def convertIMGTHeader(desc, simple=False
         header['ID'] = fields[1]
 
         if not simple:
-            header['SPECIES'] = re.sub('\s', '_', fields[2])
+            header['SPECIES'] = re.sub(r'\s', '_', fields[2])
             header['REGION'] = fields[4]
-            header['FUNCTIONALITY'] = re.sub('[\(\)\[\]]', '', fields[3])
-            header['PARTIAL'] = 'FALSE' if re.sub('\s', '', fields[13]) == '' else 'TRUE'
+            header['FUNCTIONALITY'] = re.sub(r'[\(\)\[\]]', '', fields[3])
+            header['PARTIAL'] = 'FALSE' if re.sub(r'\s', '', fields[13]) == '' else 'TRUE'
             header['ACCESSION'] = fields[0]
 
         # Position and length data
--- a/presto/Applications.py
+++ b/presto/Applications.py
@@ -58,7 +58,7 @@ def getMuscleVersion(exec=default_muscle
     # stdout_str='muscle 5.1.linux64 [12f0e2]\nBuilt Jan 13 2022 23:17:13\n\n'
     version = stdout_str.split()[1]
     version = re.sub('^v','',version)
-    version = re.sub('\.linux.*$','',version)
+    version = re.sub(r'\.linux.*$','',version)
 
     return version
 
@@ -285,7 +285,7 @@ def runCDHit(seq_list, ident=default_clu
     #   0	17nt, >S12|BARCODE=TTTTTTTTTTTTTTTTT... *
     # Parsing regex
     block_regex = re.compile('>Cluster [0-9]+')
-    id_regex = re.compile('([0-9]+\t[0-9]+nt, \>)(.+)(\.\.\.)')
+    id_regex = re.compile(r'([0-9]+\t[0-9]+nt, \>)(.+)(\.\.\.)')
 
     # Parse .clstr file
     cluster_dict = {}
--- a/presto/IO.py
+++ b/presto/IO.py
@@ -31,7 +31,7 @@ def readPrimerFile(primer_file, replace_
     Returns:
       dict: Dictionary mapping primer ID to sequence.
     """
-    if replace_special:  parse_id = lambda x: re.sub('[\s,=|]+', '_', x)
+    if replace_special:  parse_id = lambda x: re.sub(r'[\s,=|]+', '_', x)
     else:  parse_id = lambda x: x
 
     with open(primer_file, 'r') as primer_handle: