mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-03 03:36:44 +00:00
various fixes (flake8, errors)
This commit is contained in:
parent
3f1a8d64d8
commit
2031b723b8
@ -15,7 +15,6 @@ from twisted.application.internet import TimerService
|
||||
from twisted.python.filepath import FilePath
|
||||
from twisted.python.failure import Failure
|
||||
from pycryptopp.publickey import rsa
|
||||
from pycryptopp.publickey import ed25519
|
||||
|
||||
import allmydata
|
||||
from allmydata.storage.server import StorageServer
|
||||
|
@ -9,17 +9,11 @@ from pycryptopp.publickey import ed25519 # perhaps NaCl instead? other code use
|
||||
|
||||
from allmydata.scripts.common import BasedirOptions
|
||||
from allmydata.util.abbreviate import abbreviate_time
|
||||
from twisted.scripts import twistd
|
||||
from twisted.python import usage
|
||||
from twisted.python.reflect import namedAny
|
||||
from twisted.python.filepath import FilePath
|
||||
from allmydata.scripts.default_nodedir import _default_nodedir
|
||||
from allmydata.util import fileutil
|
||||
from allmydata.util import base32
|
||||
from allmydata.util import keyutil
|
||||
from allmydata.node import read_config
|
||||
from allmydata.util.encodingutil import listdir_unicode, quote_local_unicode_path
|
||||
from twisted.application.service import Service
|
||||
from twisted.internet.defer import inlineCallbacks, returnValue
|
||||
|
||||
|
||||
@ -178,7 +172,7 @@ class _GridManager(object):
|
||||
if 'private_key' not in config:
|
||||
raise ValueError(
|
||||
"Grid Manager config from '{}' requires a 'private_key'".format(
|
||||
config_config
|
||||
config_location,
|
||||
)
|
||||
)
|
||||
|
||||
@ -406,7 +400,6 @@ def _list(gridoptions, options):
|
||||
else:
|
||||
print(" {}: expired ({})".format(cert_count, abbreviate_time(delta)))
|
||||
cert_count += 1
|
||||
certs = ' ({} certificates)'.format(cert_count)
|
||||
|
||||
|
||||
def _sign(gridoptions, options):
|
||||
@ -428,7 +421,6 @@ def _sign(gridoptions, options):
|
||||
print(certificate_data)
|
||||
if fp is not None:
|
||||
next_serial = 0
|
||||
p = fp.child('{}.cert'.format(options['name'])).path
|
||||
while fp.child("{}.cert.{}".format(options['name'], next_serial)).exists():
|
||||
next_serial += 1
|
||||
with fp.child('{}.cert.{}'.format(options['name'], next_serial)).open('w') as f:
|
||||
|
@ -33,6 +33,7 @@ import re
|
||||
import time
|
||||
import hashlib
|
||||
import json
|
||||
from datetime import datetime
|
||||
|
||||
from zope.interface import implementer
|
||||
from twisted.internet import defer
|
||||
@ -41,6 +42,7 @@ from twisted.application import service
|
||||
from foolscap.api import eventually
|
||||
from allmydata.interfaces import IStorageBroker, IDisplayableServer, IServer
|
||||
from allmydata.util import log, base32, connection_status
|
||||
from allmydata.util import keyutil
|
||||
from allmydata.util.assertutil import precondition
|
||||
from allmydata.util.observer import ObserverList
|
||||
from allmydata.util.rrefutil import add_version_to_remote_reference
|
||||
|
@ -171,7 +171,7 @@ class NoNetworkServer(object):
|
||||
|
||||
@implementer(IStorageBroker)
|
||||
class NoNetworkStorageBroker(object):
|
||||
def get_servers_for_psi(self, peer_selection_index):
|
||||
def get_servers_for_psi(self, peer_selection_index, for_upload=True):
|
||||
def _permuted(server):
|
||||
seed = server.get_permutation_seed()
|
||||
return permute_server_hash(peer_selection_index, seed)
|
||||
|
@ -41,7 +41,7 @@ class WebResultsRendering(unittest.TestCase, WebRenderingMixin):
|
||||
"my-version": "ver",
|
||||
"oldest-supported": "oldest",
|
||||
}
|
||||
s = NativeStorageServer(server_id, ann, None, None)
|
||||
s = NativeStorageServer(server_id, ann, None, None, {}, None)
|
||||
sb.test_add_server(server_id, s)
|
||||
c = FakeClient()
|
||||
c.storage_broker = sb
|
||||
|
@ -40,7 +40,7 @@ class TestNativeStorageServer(unittest.TestCase):
|
||||
ann = {"anonymous-storage-FURL": "pb://w2hqnbaa25yw4qgcvghl5psa3srpfgw3@tcp:127.0.0.1:51309/vucto2z4fxment3vfxbqecblbf6zyp6x",
|
||||
"permutation-seed-base32": "w2hqnbaa25yw4qgcvghl5psa3srpfgw3",
|
||||
}
|
||||
nss = NativeStorageServer("server_id", ann, None, {})
|
||||
nss = NativeStorageServer("server_id", ann, None, {}, {}, None)
|
||||
self.assertEqual(nss.get_nickname(), "")
|
||||
|
||||
class TestStorageFarmBroker(unittest.TestCase):
|
||||
|
@ -96,7 +96,7 @@ class HumanReadable(unittest.TestCase):
|
||||
def test_abbrev_time_future_5_minutes(self):
|
||||
diff = timedelta(minutes=-5)
|
||||
s = abbreviate.abbreviate_time(diff)
|
||||
self.assertEqual('5 minutes in the future', s)
|
||||
self.assertEqual('5 minutes from now', s)
|
||||
|
||||
def test_abbrev_time_hours(self):
|
||||
diff = timedelta(hours=4)
|
||||
|
@ -26,7 +26,7 @@ class RenderServiceRow(unittest.TestCase):
|
||||
ann = {"anonymous-storage-FURL": "pb://w2hqnbaa25yw4qgcvghl5psa3srpfgw3@tcp:127.0.0.1:51309/vucto2z4fxment3vfxbqecblbf6zyp6x",
|
||||
"permutation-seed-base32": "w2hqnbaa25yw4qgcvghl5psa3srpfgw3",
|
||||
}
|
||||
s = NativeStorageServer("server_id", ann, None, {})
|
||||
s = NativeStorageServer("server_id", ann, None, {}, {}, None)
|
||||
cs = ConnectionStatus(False, "summary", {}, 0, 0)
|
||||
s.get_connection_status = lambda: cs
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user