File: python3.12-SyntaxWarnings.patch

package info (click to toggle)
dblatex 0.3.12py3-6
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 12,880 kB
  • sloc: xml: 102,889; python: 8,274; makefile: 117; sh: 48
file content (78 lines) | stat: -rw-r--r-- 2,659 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
71
72
73
74
75
76
77
78
Description: Fix several SyntaxWarnings
 Use raw strings to avoid invalid escape sequence
Author: Graham Inggs <ginggs@debian.org>
Last-Update: 2024-01-22

--- a/lib/dbtexmf/dblatex/grubber/texparser.py
+++ b/lib/dbtexmf/dblatex/grubber/texparser.py
@@ -31,7 +31,7 @@
         # Make a "foo|bar\*stub" list
         hooklist = [x.replace("*", "\\*") for x in self.hooks]
 
-        pattern = "\\\\(?P<name>%s)\*?"\
+        pattern = r"\\\\(?P<name>%s)\*?"\
                   " *(\\[(?P<opt>[^\\]]*)\\])?"\
                   " *({(?P<arg>[^{}]*)}|(?=[^A-Za-z]))"
 
--- a/lib/dbtexmf/dblatex/texcodec.py
+++ b/lib/dbtexmf/dblatex/texcodec.py
@@ -26,7 +26,7 @@
             l.append(unient.unicode_map[ord(c)])
         except KeyError:
             print("Missing character &#x%x;" % ord(c))
-            l.append("\&\#x%x;" % ord(c))
+            l.append(r"\&\#x%x;" % ord(c))
         if post: l.append(post)
         n = n + 1
     tex_handler_counter[name] = n
--- a/lib/dbtexmf/dblatex/texhyphen.py
+++ b/lib/dbtexmf/dblatex/texhyphen.py
@@ -20,7 +20,7 @@
     """
     def __init__(self, codec=None):
         self.codec = codec
-        self.hyphenchar = b"\-"
+        self.hyphenchar = r"\-"
 
     def hyphenate(self, text):
         if self.codec: text = self.codec.decode(text)
@@ -32,7 +32,7 @@
 
 
 class UrlHyphenator(Hyphenator):
-    """
+    r"""
     Hyphenates <text> so that cutting is easier on URL separators.
     The hyphen chars are expected to be void to prevent from spurious
     characters in displayed filenames or URLs.
@@ -51,7 +51,7 @@
     existing latex styles.
     """
     def __init__(self, codec=None,
-                 h_sep=b"\penalty0{}", h_char=b"\penalty5000{}",
+                 h_sep=r"\penalty0{}", h_char=r"\penalty5000{}",
                  h_start=3, h_stop=3):
         self.codec = codec
         self.seps = r":/\@=?#;-."
--- a/lib/dbtexmf/dblatex/xetex/fcmanager.py
+++ b/lib/dbtexmf/dblatex/xetex/fcmanager.py
@@ -48,7 +48,7 @@
             if i: self._buildattr(i)
         
         # Check the consistency
-        if self.family != self.name.replace("\-", "-"):
+        if self.family != self.name.replace(r"\-", "-"):
             raise ValueError("Unknown font '%s' vs '%s'" % (self.name,
             self.family))
 
--- a/lib/dbtexmf/dblatex/xetex/fontspec.py
+++ b/lib/dbtexmf/dblatex/xetex/fontspec.py
@@ -195,7 +195,7 @@
         """
         s = ''
         for type, font in fonts.items():
-            s += '\switch%sfont{%s}' % (type, font)
+            s += r'\switch%sfont{%s}' % (type, font)
         if s:
             s = r"\savefamily" + s + r"\loadfamily{}"
         return s