File: 1427.patch

package info (click to toggle)
tahoe-lafs 1.20.0-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,004 kB
  • sloc: python: 88,832; makefile: 382; sh: 104; lisp: 89; xml: 37
file content (133 lines) | stat: -rw-r--r-- 5,640 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
From a733ba6ef9603536edbcb6ab1d44725408d87b63 Mon Sep 17 00:00:00 2001
From: Florian Sesser <florian@leastauthority.com>
Date: Mon, 13 Jan 2025 21:25:09 +0000
Subject: [PATCH 1/3] Mark a couple of strings with backslashes in them as 'raw
 strings'

Refs [ticket: 4158](https://tahoe-lafs.org/trac/tahoe-lafs/ticket/4158)
---
 src/allmydata/hashtree.py             | 4 ++--
 src/allmydata/interfaces.py           | 2 +-
 src/allmydata/node.py                 | 2 +-
 src/allmydata/test/cli/test_backup.py | 6 +++---
 src/allmydata/test/cli/test_cli.py    | 2 +-
 src/allmydata/test/test_runner.py     | 2 +-
 src/allmydata/test/web/test_web.py    | 2 +-
 src/allmydata/util/i2p_provider.py    | 2 +-
 src/allmydata/web/status.py           | 4 ++--
 9 files changed, 13 insertions(+), 13 deletions(-)

--- a/src/allmydata/hashtree.py
+++ b/src/allmydata/hashtree.py
@@ -70,7 +70,7 @@
 
 
 class CompleteBinaryTreeMixin(object):
-    """
+    r"""
     Adds convenience methods to a complete binary tree.
 
     Assumes the total number of elements in the binary tree may be
@@ -179,7 +179,7 @@
     return tagged_pair_hash(b'Merkle tree internal node', a, b)
 
 class HashTree(CompleteBinaryTreeMixin, list):
-    """
+    r"""
     Compute Merkle hashes at any node in a complete binary tree.
 
     Tree is indexed like so::
--- a/src/allmydata/interfaces.py
+++ b/src/allmydata/interfaces.py
@@ -406,7 +406,7 @@
         """
 
     def put_uri_extension(data):
-        """This block of data contains integrity-checking information (hashes
+        r"""This block of data contains integrity-checking information (hashes
         of plaintext, crypttext, and shares), as well as encoding parameters
         that are necessary to recover the data. This is a serialized dict
         mapping strings to other strings. The hash of this data is kept in
--- a/src/allmydata/node.py
+++ b/src/allmydata/node.py
@@ -90,7 +90,7 @@
     })
 
 # group 1 will be addr (dotted quad string), group 3 if any will be portnum (string)
-ADDR_RE = re.compile("^([1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*)(:([1-9][0-9]*))?$")
+ADDR_RE = re.compile(r"^([1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*)(:([1-9][0-9]*))?$")
 
 # this is put into README in new node-directories (for client and introducers)
 PRIV_README = """
--- a/src/allmydata/test/cli/test_backup.py
+++ b/src/allmydata/test/cli/test_backup.py
@@ -36,9 +36,9 @@
 
     def count_output(self, out):
         mo = re.search(r"(\d)+ files uploaded \((\d+) reused\), "
-                        "(\d)+ files skipped, "
-                        "(\d+) directories created \((\d+) reused\), "
-                        "(\d+) directories skipped", out)
+                        r"(\d)+ files skipped, "
+                        r"(\d+) directories created \((\d+) reused\), "
+                        r"(\d+) directories skipped", out)
         return [int(s) for s in mo.groups()]
 
     def count_output2(self, out):
--- a/src/allmydata/test/cli/test_cli.py
+++ b/src/allmydata/test/cli/test_cli.py
@@ -764,7 +764,7 @@
         # enough shares. The one remaining share might be in either the
         # COMPLETE or the PENDING state.
         in_complete_msg = "ran out of shares: complete=sh0 pending= overdue= unused= need 3"
-        in_pending_msg_regex = "ran out of shares: complete= pending=Share\(.+\) overdue= unused= need 3"
+        in_pending_msg_regex = r"ran out of shares: complete= pending=Share\(.+\) overdue= unused= need 3"
 
         d.addCallback(lambda ign: self.do_cli("get", self.uri_1share))
         def _check1(args):
--- a/src/allmydata/test/test_runner.py
+++ b/src/allmydata/test/test_runner.py
@@ -254,7 +254,7 @@
         # Fail if there is a non-empty line that doesn't end with a
         # punctuation mark.
         for line in err.splitlines():
-            self.failIf(re.search("[\S][^\.!?]$", line), (line,))
+            self.failIf(re.search(r"[\S][^\.!?]$", line), (line,))
 
         # test that the non --basedir form works too
         n2 = os.path.join(basedir, command + "-n2")
--- a/src/allmydata/test/web/test_web.py
+++ b/src/allmydata/test/web/test_web.py
@@ -1968,7 +1968,7 @@
     def test_CSS_FILE(self):
         d = self.GET("/tahoe.css", followRedirect=True)
         def _check(res):
-            CSS_STYLE=re.compile(b'toolbar\s{.+text-align:\scenter.+toolbar-item.+display:\sinline',re.DOTALL)
+            CSS_STYLE=re.compile(b'toolbar\\s{.+text-align:\\scenter.+toolbar-item.+display:\\sinline',re.DOTALL)
             self.failUnless(CSS_STYLE.search(res), res)
         d.addCallback(_check)
         return d
--- a/src/allmydata/util/i2p_provider.py
+++ b/src/allmydata/util/i2p_provider.py
@@ -189,7 +189,7 @@
         privkeyfile = self._get_i2p_config("dest.private_key_file")
         external_port = self._get_i2p_config("dest.port")
         sam_port = self._get_i2p_config("sam.port")
-        escaped_sam_port = sam_port.replace(':', '\:')
+        escaped_sam_port = sam_port.replace(':', r'\:')
         # for now, this returns a string, which then gets passed to
         # endpoints.serverFromString . But it can also return an Endpoint
         # directly, which means we don't need to encode all these options
--- a/src/allmydata/web/status.py
+++ b/src/allmydata/web/status.py
@@ -1556,8 +1556,8 @@
 
         def mangle_name(name):
             return re.sub(
-                u"_(\d\d)_(\d)_percentile",
-                u'{quantile="0.\g<1>\g<2>"}',
+                r"_(\d\d)_(\d)_percentile",
+                r'{quantile="0.\g<1>\g<2>"}',
                 name.replace(u".", u"_")
             )