Skip to content

Commit

Permalink
trim Python2 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
a-detiste committed Jan 6, 2025
1 parent 20d2c69 commit fec9725
Show file tree
Hide file tree
Showing 131 changed files with 303 additions and 303 deletions.
10 changes: 5 additions & 5 deletions integration/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@


@attr.s
class FlogGatherer(object):
class FlogGatherer:
"""
Flog Gatherer process.
"""
Expand Down Expand Up @@ -148,7 +148,7 @@ def cleanup():


@attr.s
class StorageServer(object):
class StorageServer:
"""
Represents a Tahoe Storage Server
"""
Expand Down Expand Up @@ -200,7 +200,7 @@ def create_storage_server(reactor, request, temp_dir, introducer, flog_gatherer,


@attr.s
class Client(object):
class Client:
"""
Represents a Tahoe client
"""
Expand Down Expand Up @@ -328,7 +328,7 @@ def create_client(reactor, request, temp_dir, introducer, flog_gatherer, name, w


@attr.s
class Introducer(object):
class Introducer:
"""
Reprsents a running introducer
"""
Expand Down Expand Up @@ -434,7 +434,7 @@ def clean():


@attr.s
class Grid(object):
class Grid:
"""
Represents an entire Tahoe Grid setup
Expand Down
4 changes: 2 additions & 2 deletions integration/test_streaming_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def got_result(result, which):


@attr.s
class Left(object):
class Left:
value = attr.ib()

@classmethod
Expand All @@ -112,7 +112,7 @@ def pick(cls, left, right):


@attr.s
class Right(object):
class Right:
value = attr.ib()

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion integration/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def _tahoe_runner_optional_coverage(proto, reactor, request, other_args):
)


class TahoeProcess(object):
class TahoeProcess:
"""
A running Tahoe process, with associated information.
"""
Expand Down
2 changes: 1 addition & 1 deletion misc/checkers/check_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def parseArgs(self, nodedir, tahoe):
class CommandFailed(Exception):
pass

class GridTester(object):
class GridTester:
def __init__(self, config):
self.config = config
self.tahoe = config.tahoe
Expand Down
4 changes: 2 additions & 2 deletions misc/operations_helpers/provisioning/reliability.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
MONTH=31*DAY
YEAR=365*DAY

class ReliabilityModel(object):
class ReliabilityModel:
"""Generate a model of system-wide reliability, given several input
parameters.
Expand Down Expand Up @@ -208,7 +208,7 @@ def build_repair_matrix(self, k, N, R):
repair = matrix(new_repair_rows)
return repair

class ReliabilityReport(object):
class ReliabilityReport:
def __init__(self):
self.samples = []

Expand Down
2 changes: 1 addition & 1 deletion misc/operations_helpers/provisioning/test_provisioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from nevow import inevow
from zope.interface import implements

class MyRequest(object):
class MyRequest:
implements(inevow.IRequest)
pass

Expand Down
2 changes: 1 addition & 1 deletion misc/simulators/bench_spans.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
ADD_R=re.compile('_received spans trace .add\(([0-9]*), len=([0-9]*)\)')
INIT_S='_received spans trace = DataSpans'

class B(object):
class B:
def __init__(self, inf):
self.inf = inf

Expand Down
4 changes: 2 additions & 2 deletions misc/simulators/ringsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def make_up_a_file_size(seed):

SERVER_CAPACITY = 10**12

class Server(object):
class Server:
def __init__(self, nodeid, capacity):
self.nodeid = nodeid
self.used = 0
Expand All @@ -74,7 +74,7 @@ def __repr__(self):
else:
return "<%s %s>" % (self.__class__.__name__, self.nodeid)

class Ring(object):
class Ring:
SHOW_MINMAX = False
def __init__(self, numservers, seed, permute):
self.servers = []
Expand Down
2 changes: 1 addition & 1 deletion misc/simulators/simulate_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
def cmp(a, b):
return (a > b) - (a < b)

class Server(object):
class Server:
def __init__(self):
self.si = random.randrange(0, 2**31)
self.used = 0
Expand Down
6 changes: 3 additions & 3 deletions misc/simulators/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def sha(s):
def randomid():
return os.urandom(20)

class Node(object):
class Node:
def __init__(self, nid, introducer, simulator):
self.nid = nid
self.introducer = introducer
Expand Down Expand Up @@ -111,7 +111,7 @@ def delete_file(self):
self.introducer.delete(fileid)
return True

class Introducer(object):
class Introducer:
def __init__(self, simulator):
self.living_files = {}
self.utilization = 0 # total size of all active files
Expand Down Expand Up @@ -148,7 +148,7 @@ def delete(self, fileid):
self.simulator.stamp_utilization(self.utilization)
del self.living_files[fileid]

class Simulator(object):
class Simulator:
NUM_NODES = 1000
EVENTS = ["ADDFILE", "DELFILE", "ADDNODE", "DELNODE"]
RATE_ADDFILE = 1.0 / 10
Expand Down
2 changes: 1 addition & 1 deletion misc/simulators/sizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def charttest():
TiB=1024*GiB
PiB=1024*TiB

class Sizes(object):
class Sizes:
def __init__(self, mode, file_size, arity=2):
MAX_SEGSIZE = 128*KiB
self.mode = mode
Expand Down
2 changes: 1 addition & 1 deletion misc/simulators/storage-overhead.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def roundup(size, blocksize=4096):
return blocksize * mathutil.div_ceil(size, blocksize)


class BigFakeString(object):
class BigFakeString:
def __init__(self, length):
self.length = length
self.fp = 0
Expand Down
4 changes: 2 additions & 2 deletions src/allmydata/blacklist.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(self, reason):
self.reason = reason


class Blacklist(object):
class Blacklist:
def __init__(self, blacklist_fn):
self.blacklist_fn = blacklist_fn
self.last_mtime = None
Expand Down Expand Up @@ -61,7 +61,7 @@ def check_storageindex(self, si):


@implementer(IFileNode)
class ProhibitedNode(object):
class ProhibitedNode:

def __init__(self, wrapped_node, reason):
assert IFilesystemNode.providedBy(wrapped_node), wrapped_node
Expand Down
6 changes: 3 additions & 3 deletions src/allmydata/check_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from allmydata.util import base32

@implementer(ICheckResults)
class CheckResults(object):
class CheckResults:

def __init__(self, uri, storage_index,
healthy, recoverable, count_happiness,
Expand Down Expand Up @@ -153,7 +153,7 @@ def get_servermap(self):
return self._servermap

@implementer(ICheckAndRepairResults)
class CheckAndRepairResults(object):
class CheckAndRepairResults:

def __init__(self, storage_index):
self.storage_index = storage_index
Expand All @@ -175,7 +175,7 @@ def get_post_repair_results(self):
return self.post_repair_results


class DeepResultsBase(object):
class DeepResultsBase:

def __init__(self, root_storage_index):
self.root_storage_index = root_storage_index
Expand Down
2 changes: 1 addition & 1 deletion src/allmydata/cli/grid_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def grid_manager(ctx, config):
signing key) and should be kept safe.
"""

class Config(object):
class Config:
"""
Available to all sub-commands as Click's context.obj
"""
Expand Down
8 changes: 4 additions & 4 deletions src/allmydata/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def _make_secret():
return base32.b2a(os.urandom(hashutil.CRYPTO_VAL_SIZE)) + b"\n"


class SecretHolder(object):
class SecretHolder:
def __init__(self, lease_secret, convergence_secret):
self._lease_secret = lease_secret
self._convergence_secret = convergence_secret
Expand All @@ -170,7 +170,7 @@ def get_cancel_secret(self):
def get_convergence_secret(self):
return self._convergence_secret

class KeyGenerator(object):
class KeyGenerator:
"""I create RSA keys for mutable files. Each call to generate() returns a
single keypair."""

Expand Down Expand Up @@ -314,7 +314,7 @@ def create_client_from_config(config, _client_factory=None, _introducer_factory=


@attr.s
class _StoragePlugins(object):
class _StoragePlugins:
"""
Functionality related to getting storage plugins set up and ready for use.
Expand Down Expand Up @@ -559,7 +559,7 @@ def _register_reference(key, config, tub, referenceable):

@implementer(IAnnounceableStorageServer)
@attr.s
class AnnounceableStorageServer(object):
class AnnounceableStorageServer:
announcement = attr.ib()
storage_server = attr.ib()

Expand Down
4 changes: 2 additions & 2 deletions src/allmydata/codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import zfec

@implementer(ICodecEncoder)
class CRSEncoder(object):
class CRSEncoder:
ENCODER_TYPE = b"crs"

def set_params(self, data_size, required_shares, max_shares):
Expand Down Expand Up @@ -55,7 +55,7 @@ def encode_proposal(self, data, desired_share_ids=None):


@implementer(ICodecDecoder)
class CRSDecoder(object):
class CRSDecoder:

def set_params(self, data_size, required_shares, max_shares):
self.data_size = data_size
Expand Down
2 changes: 1 addition & 1 deletion src/allmydata/deep_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from allmydata.uri import from_string
from allmydata.util import mathutil

class DeepStats(object):
class DeepStats:
"""Deep stats object.
Holds results of the deep-stats operation.
Expand Down
12 changes: 6 additions & 6 deletions src/allmydata/dirnode.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
)


class _OnlyFiles(object):
class _OnlyFiles:
"""Marker for replacement option of only replacing files."""

ONLY_FILES = _OnlyFiles()
Expand Down Expand Up @@ -115,7 +115,7 @@ def update_metadata(metadata, new_metadata, now):
# contents and end by repacking them. It might be better to apply them to
# the unpacked contents.

class Deleter(object):
class Deleter:
def __init__(self, node, namex, must_exist=True, must_be_directory=False, must_be_file=False):
self.node = node
self.name = normalize(namex)
Expand Down Expand Up @@ -143,7 +143,7 @@ def modify(self, old_contents, servermap, first_time):
return new_contents


class MetadataSetter(object):
class MetadataSetter:
def __init__(self, node, namex, metadata, create_readonly_node=None):
self.node = node
self.name = normalize(namex)
Expand All @@ -168,7 +168,7 @@ def modify(self, old_contents, servermap, first_time):
return new_contents


class Adder(object):
class Adder:
def __init__(self, node, entries=None, overwrite=True, create_readonly_node=None):
"""
:param overwrite: Either True (allow overwriting anything existing),
Expand Down Expand Up @@ -300,7 +300,7 @@ def _pack_normalized_children(children, writekey, deep_immutable=False):
return b"".join(entries)

@implementer(IDirectoryNode, ICheckable, IDeepCheckable)
class DirectoryNode(object):
class DirectoryNode:
filenode_class = MutableFileNode

def __init__(self, filenode, nodemaker, uploader):
Expand Down Expand Up @@ -873,7 +873,7 @@ def get_results(self):
}


class DeepChecker(object):
class DeepChecker:
def __init__(self, root, verify, repair, add_lease):
root_si = root.get_storage_index()
if root_si:
Expand Down
4 changes: 2 additions & 2 deletions src/allmydata/frontends/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ class NeedRootcapLookupScheme(Exception):
mechanism to translate name+passwd pairs into a rootcap, either a file of
name/passwd/rootcap tuples, or a server to do the translation."""

class FTPAvatarID(object):
class FTPAvatarID:
def __init__(self, username, rootcap):
self.username = username
self.rootcap = rootcap

@implementer(checkers.ICredentialsChecker)
class AccountFileChecker(object):
class AccountFileChecker:
credentialInterfaces = (credentials.ISSHPrivateKey,)

def __init__(self, client, accountfile):
Expand Down
Loading

0 comments on commit fec9725

Please sign in to comment.