Merge pull request #1421 from a-detiste/master
Some checks failed
CI / coverage (macos-14, 3.12) (push) Has been cancelled
CI / coverage (ubuntu-22.04, 3.12) (push) Has been cancelled
CI / coverage (ubuntu-22.04, pypy-3.9) (push) Has been cancelled
CI / coverage (windows-2022, 3.12) (push) Has been cancelled
CI / integration (false, macos-14, 3.11) (push) Has been cancelled
CI / integration (false, ubuntu-20.04, 3.11) (push) Has been cancelled
CI / integration (false, windows-2022, 3.11) (push) Has been cancelled
CI / integration (true, ubuntu-20.04, 3.12) (push) Has been cancelled
CI / packaging (macos-14, 3.9) (push) Has been cancelled
CI / packaging (ubuntu-22.04, 3.9) (push) Has been cancelled
CI / packaging (windows-2022, 3.9) (push) Has been cancelled
CI / finish-coverage-report (push) Has been cancelled

finish removing "future"
This commit is contained in:
meejah 2024-12-21 17:49:05 -07:00 committed by GitHub
commit 1588110f58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 18 additions and 15 deletions

View File

@ -1 +1 @@
remote more usage of deprecated future library remote all usage of deprecated future library

View File

@ -40,7 +40,6 @@ hidden_imports = [
'commands', 'commands',
'Crypto', 'Crypto',
'functools', 'functools',
'future.backports.misc',
'itertools', 'itertools',
'math', 'math',
'packaging.specifiers', 'packaging.specifiers',

View File

@ -117,6 +117,7 @@ dependencies = [
"PyYAML >= 3.11", "PyYAML >= 3.11",
# to be slowly removed from codebase
"six >= 1.10.0", "six >= 1.10.0",
# For 'tahoe invite' and 'tahoe join' # For 'tahoe invite' and 'tahoe join'
@ -133,9 +134,6 @@ dependencies = [
# WebSocket library for twisted and asyncio # WebSocket library for twisted and asyncio
"autobahn >= 22.4.3", "autobahn >= 22.4.3",
# Support for Python 3 transition
"future >= 0.18.2",
# Discover local network configuration # Discover local network configuration
"netifaces", "netifaces",

View File

@ -3,8 +3,6 @@ Functionality related to a lot of the test suite.
""" """
from __future__ import annotations from __future__ import annotations
from past.builtins import chr as byteschr
__all__ = [ __all__ = [
"SyncTestCase", "SyncTestCase",
"AsyncTestCase", "AsyncTestCase",
@ -127,6 +125,9 @@ EMPTY_CLIENT_CONFIG = config_from_string(
"" ""
) )
def byteschr(x):
return bytes([x])
@attr.s @attr.s
class FakeDisk(object): class FakeDisk(object):
""" """

View File

@ -4,8 +4,6 @@ Tests for allmydata.util.base62.
Ported to Python 3. Ported to Python 3.
""" """
from past.builtins import chr as byteschr
import random, unittest import random, unittest
from hypothesis import ( from hypothesis import (
@ -15,6 +13,9 @@ from hypothesis import (
from allmydata.util import base62, mathutil from allmydata.util import base62, mathutil
def byteschr(x):
return bytes([x])
def insecurerandstr(n): def insecurerandstr(n):
return bytes(list(map(random.randrange, [0]*n, [256]*n))) return bytes(list(map(random.randrange, [0]*n, [256]*n)))

View File

@ -2,8 +2,6 @@
Ported to Python 3. Ported to Python 3.
""" """
from past.builtins import chr as byteschr
from zope.interface import implementer from zope.interface import implementer
from twisted.trial import unittest from twisted.trial import unittest
from twisted.internet import defer from twisted.internet import defer
@ -20,6 +18,9 @@ from allmydata.test.no_network import GridTestMixin
class LostPeerError(Exception): class LostPeerError(Exception):
pass pass
def byteschr(x):
return bytes([x])
def flip_bit(good): # flips the last bit def flip_bit(good): # flips the last bit
return good[:-1] + byteschr(ord(good[-1]) ^ 0x01) return good[:-1] + byteschr(ord(good[-1]) ^ 0x01)

View File

@ -3,7 +3,6 @@ Ported to Python 3.
""" """
from __future__ import annotations from __future__ import annotations
from past.builtins import chr as byteschr
from six import ensure_text from six import ensure_text
import os, re, sys, time, json import os, re, sys, time, json
@ -47,6 +46,8 @@ from .web.common import (
from .common_system import SystemTestMixin from .common_system import SystemTestMixin
from .common_util import run_cli_unicode from .common_util import run_cli_unicode
def byteschr(x):
return bytes([x])
class RunBinTahoeMixin(object): class RunBinTahoeMixin(object):
def run_bintahoe(self, args, stdin=None, python_options:Optional[list[str]]=None, env=None): def run_bintahoe(self, args, stdin=None, python_options:Optional[list[str]]=None, env=None):

View File

@ -7,14 +7,15 @@ Ported to Python 3.
maketrans = bytes.maketrans maketrans = bytes.maketrans
translate = bytes.translate translate = bytes.translate
from past.builtins import chr as byteschr
from allmydata.util.mathutil import log_ceil, log_floor from allmydata.util.mathutil import log_ceil, log_floor
chars = b"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" chars = b"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
BASE62CHAR = b'[' + chars + b']' BASE62CHAR = b'[' + chars + b']'
def byteschr(x):
return bytes([x])
vals = b''.join([byteschr(i) for i in range(62)]) vals = b''.join([byteschr(i) for i in range(62)])
c2vtranstable = maketrans(chars, vals) c2vtranstable = maketrans(chars, vals)
v2ctranstable = maketrans(vals, chars) v2ctranstable = maketrans(vals, chars)

View File

@ -4,7 +4,8 @@ Hashing utilities.
Ported to Python 3. Ported to Python 3.
""" """
from past.builtins import chr as byteschr def byteschr(x):
return bytes([x])
import os import os
import hashlib import hashlib