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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
From 61a8a0e7ca53fdb3297bfbdba780494998ad3a79 Mon Sep 17 00:00:00 2001
From: zer0def <zer0def@zer0def.0>
Date: Fri, 3 Jan 2025 21:01:54 +0100
Subject: [PATCH] Drop python-future as all dependent py-vers are EOL
---
main.py | 5 +----
matrix/bar_items.py | 2 --
matrix/buffer.py | 2 --
matrix/colors.py | 2 --
matrix/commands.py | 3 +--
matrix/completion.py | 2 --
matrix/globals.py | 2 --
matrix/message_renderer.py | 1 -
matrix/server.py | 2 --
matrix/uploads.py | 2 --
matrix/utf.py | 2 --
matrix/utils.py | 8 ++++++--
pyproject.toml | 1 -
requirements.txt | 1 -
tests/buffer_test.py | 2 --
tests/color_test.py | 2 --
16 files changed, 8 insertions(+), 31 deletions(-)
diff --git a/main.py b/main.py
index 765043a..b32ee05 100644
--- a/main.py
+++ b/main.py
@@ -15,8 +15,6 @@
# CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-from __future__ import unicode_literals
-
import os
# See if there is a `venv` directory next to our script, and use that if
@@ -41,7 +39,6 @@ from typing import Any, AnyStr, Deque, Dict, List, Optional, Set, Text, Tuple
import logbook
import json
import OpenSSL.crypto as crypto
-from future.utils import bytes_to_native_str as n
from logbook import Logger, StreamHandler
try:
@@ -96,7 +93,7 @@ from matrix.server import (MatrixServer, create_default_server,
matrix_config_server_write_cb, matrix_timer_cb,
send_cb, matrix_load_users_cb)
from matrix.utf import utf8_decode
-from matrix.utils import server_buffer_prnt, server_buffer_set_title
+from matrix.utils import server_buffer_prnt, server_buffer_set_title, bytes_to_native_str as n
from matrix.uploads import UploadsBuffer, upload_cb
diff --git a/matrix/bar_items.py b/matrix/bar_items.py
index 23e6fc9..b3b185c 100644
--- a/matrix/bar_items.py
+++ b/matrix/bar_items.py
@@ -14,8 +14,6 @@
# CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-from __future__ import unicode_literals
-
from . import globals as G
from .globals import SERVERS, W
from .utf import utf8_decode
diff --git a/matrix/buffer.py b/matrix/buffer.py
index ce981b1..7e20511 100644
--- a/matrix/buffer.py
+++ b/matrix/buffer.py
@@ -15,8 +15,6 @@
# CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-from __future__ import unicode_literals
-
import time
import attr
import pprint
diff --git a/matrix/colors.py b/matrix/colors.py
index c00bc0d..270b811 100644
--- a/matrix/colors.py
+++ b/matrix/colors.py
@@ -17,8 +17,6 @@
# CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-from __future__ import unicode_literals
-
import html
import re
import textwrap
diff --git a/matrix/commands.py b/matrix/commands.py
index 598f859..cabff4a 100644
--- a/matrix/commands.py
+++ b/matrix/commands.py
@@ -15,15 +15,14 @@
# CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-from __future__ import unicode_literals
import argparse
import os
import re
import shlex
from builtins import str
-from future.moves.itertools import zip_longest
from collections import defaultdict
from functools import partial
+from itertools import zip_longest
from nio import EncryptionError, LocalProtocolError
from . import globals as G
diff --git a/matrix/completion.py b/matrix/completion.py
index a1ac559..9cea035 100644
--- a/matrix/completion.py
+++ b/matrix/completion.py
@@ -14,8 +14,6 @@
# CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-from __future__ import unicode_literals
-
from typing import List, Optional
from matrix.globals import SERVERS, W, SCRIPT_NAME
from matrix.utf import utf8_decode
diff --git a/matrix/globals.py b/matrix/globals.py
index c3e099e..fde8fe9 100644
--- a/matrix/globals.py
+++ b/matrix/globals.py
@@ -14,8 +14,6 @@
# CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-from __future__ import unicode_literals
-
import sys
from typing import Any, Dict, Optional
from logbook import Logger
diff --git a/matrix/message_renderer.py b/matrix/message_renderer.py
index 8a6f544..5a929d0 100644
--- a/matrix/message_renderer.py
+++ b/matrix/message_renderer.py
@@ -17,7 +17,6 @@
"""Module for rendering matrix messages in Weechat."""
-from __future__ import unicode_literals
from nio import Api
from .globals import W
from .colors import Formatted
diff --git a/matrix/server.py b/matrix/server.py
index 0f34c1e..72075a4 100644
--- a/matrix/server.py
+++ b/matrix/server.py
@@ -14,8 +14,6 @@
# CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-from __future__ import unicode_literals
-
import os
import pprint
import socket
diff --git a/matrix/uploads.py b/matrix/uploads.py
index 05beb1c..25cff88 100644
--- a/matrix/uploads.py
+++ b/matrix/uploads.py
@@ -16,8 +16,6 @@
"""Module implementing upload functionality."""
-from __future__ import unicode_literals
-
import attr
import time
import json
diff --git a/matrix/utf.py b/matrix/utf.py
index 4d71987..45d63a1 100644
--- a/matrix/utf.py
+++ b/matrix/utf.py
@@ -22,8 +22,6 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-from __future__ import unicode_literals
-
import sys
# pylint: disable=redefined-builtin
diff --git a/matrix/utils.py b/matrix/utils.py
index ce5f9d1..98db643 100644
--- a/matrix/utils.py
+++ b/matrix/utils.py
@@ -15,8 +15,7 @@
# CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-from __future__ import unicode_literals, division
-
+import sys
import time
from typing import Any, Dict, List
@@ -26,6 +25,11 @@ if False:
from .server import MatrixServer
+def bytes_to_native_str(b, encoding='utf-8' if sys.version_info[0] >= 3 else None):
+ return b.decode(encoding) if sys.version_info[0] >= 3 else (
+ b.__native__() if hasattr(b, '__native__') else b)
+
+
def key_from_value(dictionary, value):
# type: (Dict[str, Any], Any) -> str
return list(dictionary.keys())[list(dictionary.values()).index(value)]
diff --git a/pyproject.toml b/pyproject.toml
index 709adf1..18fb197 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -15,7 +15,6 @@ python = "^3.6"
pyOpenSSL = "^19.1.0"
webcolors = "^1.11.1"
atomicwrites = "^1.3.0"
-future = { version = "^0.18.2", python = "<3.2" }
attrs = "^19.3.0"
logbook = "^1.5.3"
pygments = "^2.6.1"
diff --git a/requirements.txt b/requirements.txt
index ca7ed5b..1b7d74e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,7 +1,6 @@
pyOpenSSL
typing ; python_version < "3.5"
webcolors
-future; python_version < "3.2"
atomicwrites
attrs
logbook
diff --git a/tests/buffer_test.py b/tests/buffer_test.py
index 0ba5697..bbde553 100644
--- a/tests/buffer_test.py
+++ b/tests/buffer_test.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from matrix.buffer import WeechatChannelBuffer
from matrix.utils import parse_redact_args
diff --git a/tests/color_test.py b/tests/color_test.py
index 79b5a28..20df212 100644
--- a/tests/color_test.py
+++ b/tests/color_test.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
import webcolors
from collections import OrderedDict
from hypothesis import given
--
2.47.1
|