File: 1421.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 (156 lines) | stat: -rw-r--r-- 3,807 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
From 168532de07b5142513310d9008023fb1bccbf9d4 Mon Sep 17 00:00:00 2001
From: Alexandre Detiste <alexandre.detiste@gmail.com>
Date: Sat, 21 Dec 2024 19:03:57 +0100
Subject: [PATCH 1/2] finish removing "future"

---
 newsfragments/4152.other          | 2 +-
 pyinstaller.spec                  | 1 -
 pyproject.toml                    | 4 +---
 src/allmydata/test/common.py      | 5 +++--
 src/allmydata/test/test_base62.py | 5 +++--
 src/allmydata/test/test_encode.py | 5 +++--
 src/allmydata/test/test_system.py | 3 ++-
 src/allmydata/util/base62.py      | 5 +++--
 src/allmydata/util/hashutil.py    | 3 ++-
 9 files changed, 18 insertions(+), 15 deletions(-)

--- a/newsfragments/4152.other
+++ b/newsfragments/4152.other
@@ -1 +1 @@
-remote more usage of deprecated future library
+remote all usage of deprecated future library
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -117,6 +117,7 @@
 
     "PyYAML >= 3.11",
 
+    # to be slowly removed from codebase
     "six >= 1.10.0",
 
     # For 'tahoe invite' and 'tahoe join'
@@ -133,9 +134,6 @@
     # WebSocket library for twisted and asyncio
     "autobahn >= 22.4.3",
 
-    # Support for Python 3 transition
-    "future >= 0.18.2",
-
     # Discover local network configuration
     "netifaces",
 
--- a/src/allmydata/test/common.py
+++ b/src/allmydata/test/common.py
@@ -3,8 +3,6 @@
 """
 from __future__ import annotations
 
-from past.builtins import chr as byteschr
-
 __all__ = [
     "SyncTestCase",
     "AsyncTestCase",
@@ -127,6 +125,9 @@
     ""
 )
 
+def byteschr(x):
+    return bytes([x])
+
 @attr.s
 class FakeDisk(object):
     """
--- a/src/allmydata/test/test_base62.py
+++ b/src/allmydata/test/test_base62.py
@@ -4,8 +4,6 @@
 Ported to Python 3.
 """
 
-from past.builtins import chr as byteschr
-
 import random, unittest
 
 from hypothesis import (
@@ -15,6 +13,9 @@
 
 from allmydata.util import base62, mathutil
 
+def byteschr(x):
+    return bytes([x])
+
 def insecurerandstr(n):
     return bytes(list(map(random.randrange, [0]*n, [256]*n)))
 
--- a/src/allmydata/test/test_encode.py
+++ b/src/allmydata/test/test_encode.py
@@ -2,8 +2,6 @@
 Ported to Python 3.
 """
 
-from past.builtins import chr as byteschr
-
 from zope.interface import implementer
 from twisted.trial import unittest
 from twisted.internet import defer
@@ -20,6 +18,9 @@
 class LostPeerError(Exception):
     pass
 
+def byteschr(x):
+    return bytes([x])
+
 def flip_bit(good): # flips the last bit
     return good[:-1] + byteschr(ord(good[-1]) ^ 0x01)
 
--- a/src/allmydata/test/test_system.py
+++ b/src/allmydata/test/test_system.py
@@ -3,7 +3,6 @@
 """
 from __future__ import annotations
 
-from past.builtins import chr as byteschr
 from six import ensure_text
 
 import os, re, sys, time, json
@@ -47,6 +46,8 @@
 from .common_system import SystemTestMixin
 from .common_util import run_cli_unicode
 
+def byteschr(x):
+    return bytes([x])
 
 class RunBinTahoeMixin(object):
     def run_bintahoe(self, args, stdin=None, python_options:Optional[list[str]]=None, env=None):
--- a/src/allmydata/util/base62.py
+++ b/src/allmydata/util/base62.py
@@ -7,14 +7,15 @@
 maketrans = bytes.maketrans
 translate = bytes.translate
 
-from past.builtins import chr as byteschr
-
 from allmydata.util.mathutil import log_ceil, log_floor
 
 chars = b"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
 
 BASE62CHAR = b'[' + chars + b']'
 
+def byteschr(x):
+    return bytes([x])
+
 vals = b''.join([byteschr(i) for i in range(62)])
 c2vtranstable = maketrans(chars, vals)
 v2ctranstable = maketrans(vals, chars)
--- a/src/allmydata/util/hashutil.py
+++ b/src/allmydata/util/hashutil.py
@@ -4,7 +4,8 @@
 Ported to Python 3.
 """
 
-from past.builtins import chr as byteschr
+def byteschr(x):
+    return bytes([x])
 
 import os
 import hashlib