mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-09 20:01:23 +00:00
Merge pull request #1420 from a-detiste/master
Some checks are pending
CI / coverage (macos-14, 3.12) (push) Waiting to run
CI / coverage (ubuntu-22.04, 3.12) (push) Waiting to run
CI / coverage (ubuntu-22.04, pypy-3.9) (push) Waiting to run
CI / coverage (windows-2022, 3.12) (push) Waiting to run
CI / finish-coverage-report (push) Blocked by required conditions
CI / integration (false, macos-14, 3.11) (push) Waiting to run
CI / integration (false, ubuntu-20.04, 3.11) (push) Waiting to run
CI / integration (false, windows-2022, 3.11) (push) Waiting to run
CI / integration (true, ubuntu-20.04, 3.12) (push) Waiting to run
CI / packaging (macos-14, 3.9) (push) Waiting to run
CI / packaging (ubuntu-22.04, 3.9) (push) Waiting to run
CI / packaging (windows-2022, 3.9) (push) Waiting to run
Some checks are pending
CI / coverage (macos-14, 3.12) (push) Waiting to run
CI / coverage (ubuntu-22.04, 3.12) (push) Waiting to run
CI / coverage (ubuntu-22.04, pypy-3.9) (push) Waiting to run
CI / coverage (windows-2022, 3.12) (push) Waiting to run
CI / finish-coverage-report (push) Blocked by required conditions
CI / integration (false, macos-14, 3.11) (push) Waiting to run
CI / integration (false, ubuntu-20.04, 3.11) (push) Waiting to run
CI / integration (false, windows-2022, 3.11) (push) Waiting to run
CI / integration (true, ubuntu-20.04, 3.12) (push) Waiting to run
CI / packaging (macos-14, 3.9) (push) Waiting to run
CI / packaging (ubuntu-22.04, 3.9) (push) Waiting to run
CI / packaging (windows-2022, 3.9) (push) Waiting to run
trim usage of to-be-removed "future" library
This commit is contained in:
commit
60019ba955
@ -51,13 +51,14 @@ system where Tahoe is installed, or in a source tree with setup.py like this:
|
||||
setup.py run_with_pythonpath -p -c 'misc/make-canary-files.py ARGS..'
|
||||
"""
|
||||
|
||||
from past.builtins import cmp
|
||||
|
||||
import os, hashlib
|
||||
from twisted.python import usage
|
||||
from allmydata.immutable import upload
|
||||
from allmydata.util import base32
|
||||
|
||||
def cmp(a, b):
|
||||
return (a > b) - (a < b)
|
||||
|
||||
class Options(usage.Options):
|
||||
optParameters = [
|
||||
("convergence", "c", None, "path to NODEDIR/private/convergence"),
|
||||
|
@ -2,13 +2,13 @@
|
||||
|
||||
# WARNING. There is a bug in this script so that it does not simulate the actual Tahoe Two server selection algorithm that it was intended to simulate. See http://allmydata.org/trac/tahoe-lafs/ticket/302 (stop permuting peerlist, use SI as offset into ring instead?)
|
||||
|
||||
|
||||
from past.builtins import cmp
|
||||
|
||||
import random
|
||||
|
||||
SERVER_CAPACITY = 10**12
|
||||
|
||||
def cmp(a, b):
|
||||
return (a > b) - (a < b)
|
||||
|
||||
class Server(object):
|
||||
def __init__(self):
|
||||
self.si = random.randrange(0, 2**31)
|
||||
|
1
newsfragments/4152.other
Normal file
1
newsfragments/4152.other
Normal file
@ -0,0 +1 @@
|
||||
remote more usage of deprecated future library
|
@ -2,8 +2,6 @@
|
||||
Ported to Python 3.
|
||||
"""
|
||||
|
||||
from future.utils import bchr
|
||||
|
||||
import struct, time, os, sys
|
||||
|
||||
from twisted.python import usage, failure
|
||||
@ -22,6 +20,9 @@ from allmydata.util import base32
|
||||
from allmydata.util.encodingutil import quote_output
|
||||
from allmydata.scripts.types_ import SubCommands
|
||||
|
||||
def bchr(s):
|
||||
return bytes([s])
|
||||
|
||||
class DumpOptions(BaseOptions):
|
||||
def getSynopsis(self):
|
||||
return "Usage: tahoe [global-options] debug dump-share SHARE_FILENAME"
|
||||
|
@ -2,8 +2,6 @@
|
||||
Ported to Python 3.
|
||||
"""
|
||||
|
||||
from six import ensure_text
|
||||
|
||||
import os
|
||||
import tempfile
|
||||
from io import BytesIO, StringIO
|
||||
@ -139,18 +137,18 @@ class CommandStatus(unittest.TestCase):
|
||||
|
||||
def test_no_operations(self):
|
||||
values = [
|
||||
StringIO(ensure_text(json.dumps({
|
||||
StringIO(json.dumps({
|
||||
"active": [],
|
||||
"recent": [],
|
||||
}))),
|
||||
StringIO(ensure_text(json.dumps({
|
||||
})),
|
||||
StringIO(json.dumps({
|
||||
"counters": {
|
||||
"bytes_downloaded": 0,
|
||||
},
|
||||
"stats": {
|
||||
"node.uptime": 0,
|
||||
}
|
||||
}))),
|
||||
})),
|
||||
]
|
||||
def do_http(*args, **kw):
|
||||
return values.pop(0)
|
||||
|
@ -2,7 +2,6 @@
|
||||
Ported to Python 3.
|
||||
"""
|
||||
|
||||
from future.utils import bchr
|
||||
|
||||
from io import BytesIO
|
||||
import attr
|
||||
@ -20,6 +19,9 @@ from ..common import (
|
||||
EMPTY_CLIENT_CONFIG,
|
||||
)
|
||||
|
||||
def bchr(s):
|
||||
return bytes([s])
|
||||
|
||||
def eventuaaaaaly(res=None):
|
||||
d = fireEventually(res)
|
||||
d.addCallback(fireEventually)
|
||||
|
@ -2,8 +2,6 @@
|
||||
Ported to Python 3.
|
||||
"""
|
||||
|
||||
from future.utils import bchr
|
||||
|
||||
# system-level upload+download roundtrip test, but using shares created from
|
||||
# a previous run. This asserts that the current code is capable of decoding
|
||||
# shares from a previous version.
|
||||
@ -29,6 +27,9 @@ from allmydata.immutable.downloader.fetcher import SegmentFetcher
|
||||
from allmydata.codec import CRSDecoder
|
||||
from foolscap.eventual import eventually, fireEventually, flushEventualQueue
|
||||
|
||||
def bchr(s):
|
||||
return bytes([s])
|
||||
|
||||
plaintext = b"This is a moderate-sized file.\n" * 10
|
||||
mutable_plaintext = b"This is a moderate-sized mutable file.\n" * 10
|
||||
|
||||
|
@ -10,8 +10,6 @@ indexes.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from future.utils import bchr
|
||||
|
||||
from random import Random
|
||||
from unittest import SkipTest
|
||||
|
||||
@ -31,6 +29,8 @@ from allmydata.storage.server import StorageServer # not a IStorageServer!!
|
||||
# are run in the same order.
|
||||
_RANDOM = Random(0)
|
||||
|
||||
def bchr(s):
|
||||
return bytes([s])
|
||||
|
||||
def _randbytes(length):
|
||||
# type: (int) -> bytes
|
||||
|
@ -5,7 +5,6 @@ Ported to Python 3.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from future.utils import bchr
|
||||
from six import ensure_str
|
||||
|
||||
from io import (
|
||||
@ -20,6 +19,9 @@ import shutil
|
||||
from functools import partial
|
||||
from uuid import uuid4
|
||||
|
||||
def bchr(s):
|
||||
return bytes([s])
|
||||
|
||||
from testtools.matchers import (
|
||||
Equals,
|
||||
NotEquals,
|
||||
|
Loading…
x
Reference in New Issue
Block a user