trim usage of to-be-removed "future" library

This commit is contained in:
Alexandre Detiste 2024-12-21 02:07:01 +01:00
parent 7a8ce2e750
commit f9a65f82c0
5 changed files with 14 additions and 8 deletions

View File

@ -2,8 +2,6 @@
Ported to Python 3. Ported to Python 3.
""" """
from future.utils import bchr
import struct, time, os, sys import struct, time, os, sys
from twisted.python import usage, failure from twisted.python import usage, failure
@ -22,6 +20,9 @@ from allmydata.util import base32
from allmydata.util.encodingutil import quote_output from allmydata.util.encodingutil import quote_output
from allmydata.scripts.types_ import SubCommands from allmydata.scripts.types_ import SubCommands
def bchr(s):
return bytes([s])
class DumpOptions(BaseOptions): class DumpOptions(BaseOptions):
def getSynopsis(self): def getSynopsis(self):
return "Usage: tahoe [global-options] debug dump-share SHARE_FILENAME" return "Usage: tahoe [global-options] debug dump-share SHARE_FILENAME"

View File

@ -2,7 +2,6 @@
Ported to Python 3. Ported to Python 3.
""" """
from future.utils import bchr
from io import BytesIO from io import BytesIO
import attr import attr
@ -20,6 +19,9 @@ from ..common import (
EMPTY_CLIENT_CONFIG, EMPTY_CLIENT_CONFIG,
) )
def bchr(s):
return bytes([s])
def eventuaaaaaly(res=None): def eventuaaaaaly(res=None):
d = fireEventually(res) d = fireEventually(res)
d.addCallback(fireEventually) d.addCallback(fireEventually)

View File

@ -2,8 +2,6 @@
Ported to Python 3. Ported to Python 3.
""" """
from future.utils import bchr
# system-level upload+download roundtrip test, but using shares created from # system-level upload+download roundtrip test, but using shares created from
# a previous run. This asserts that the current code is capable of decoding # a previous run. This asserts that the current code is capable of decoding
# shares from a previous version. # shares from a previous version.
@ -29,6 +27,9 @@ from allmydata.immutable.downloader.fetcher import SegmentFetcher
from allmydata.codec import CRSDecoder from allmydata.codec import CRSDecoder
from foolscap.eventual import eventually, fireEventually, flushEventualQueue from foolscap.eventual import eventually, fireEventually, flushEventualQueue
def bchr(s):
return bytes([s])
plaintext = b"This is a moderate-sized file.\n" * 10 plaintext = b"This is a moderate-sized file.\n" * 10
mutable_plaintext = b"This is a moderate-sized mutable file.\n" * 10 mutable_plaintext = b"This is a moderate-sized mutable file.\n" * 10

View File

@ -10,8 +10,6 @@ indexes.
from __future__ import annotations from __future__ import annotations
from future.utils import bchr
from random import Random from random import Random
from unittest import SkipTest from unittest import SkipTest
@ -31,6 +29,8 @@ from allmydata.storage.server import StorageServer # not a IStorageServer!!
# are run in the same order. # are run in the same order.
_RANDOM = Random(0) _RANDOM = Random(0)
def bchr(s):
return bytes([s])
def _randbytes(length): def _randbytes(length):
# type: (int) -> bytes # type: (int) -> bytes

View File

@ -5,7 +5,6 @@ Ported to Python 3.
""" """
from __future__ import annotations from __future__ import annotations
from future.utils import bchr
from six import ensure_str from six import ensure_str
from io import ( from io import (
@ -20,6 +19,9 @@ import shutil
from functools import partial from functools import partial
from uuid import uuid4 from uuid import uuid4
def bchr(s):
return bytes([s])
from testtools.matchers import ( from testtools.matchers import (
Equals, Equals,
NotEquals, NotEquals,