vendor cmp()

This commit is contained in:
Alexandre Detiste 2024-12-21 14:57:09 +01:00
parent 5105112475
commit 4ac60c5c86
2 changed files with 6 additions and 5 deletions

View File

@ -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..' setup.py run_with_pythonpath -p -c 'misc/make-canary-files.py ARGS..'
""" """
from past.builtins import cmp
import os, hashlib import os, hashlib
from twisted.python import usage from twisted.python import usage
from allmydata.immutable import upload from allmydata.immutable import upload
from allmydata.util import base32 from allmydata.util import base32
def cmp(a, b):
return (a > b) - (a < b)
class Options(usage.Options): class Options(usage.Options):
optParameters = [ optParameters = [
("convergence", "c", None, "path to NODEDIR/private/convergence"), ("convergence", "c", None, "path to NODEDIR/private/convergence"),

View File

@ -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?) # 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 import random
SERVER_CAPACITY = 10**12 SERVER_CAPACITY = 10**12
def cmp(a, b):
return (a > b) - (a < b)
class Server(object): class Server(object):
def __init__(self): def __init__(self):
self.si = random.randrange(0, 2**31) self.si = random.randrange(0, 2**31)