mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-03 11:44:11 +00:00
flake8
This commit is contained in:
parent
4665617818
commit
2cf36cf884
@ -31,13 +31,11 @@ from allmydata.util.abbreviate import parse_abbreviated_size
|
|||||||
from allmydata.util.time_format import parse_duration, parse_date
|
from allmydata.util.time_format import parse_duration, parse_date
|
||||||
from allmydata.util.i2p_provider import create as create_i2p_provider
|
from allmydata.util.i2p_provider import create as create_i2p_provider
|
||||||
from allmydata.util.tor_provider import create as create_tor_provider
|
from allmydata.util.tor_provider import create as create_tor_provider
|
||||||
from allmydata.util.base32 import a2b, b2a
|
|
||||||
from allmydata.stats import StatsProvider
|
from allmydata.stats import StatsProvider
|
||||||
from allmydata.history import History
|
from allmydata.history import History
|
||||||
from allmydata.interfaces import IStatsProducer, SDMF_VERSION, MDMF_VERSION, DEFAULT_MAX_SEGMENT_SIZE
|
from allmydata.interfaces import IStatsProducer, SDMF_VERSION, MDMF_VERSION, DEFAULT_MAX_SEGMENT_SIZE
|
||||||
from allmydata.nodemaker import NodeMaker
|
from allmydata.nodemaker import NodeMaker
|
||||||
from allmydata.blacklist import Blacklist
|
from allmydata.blacklist import Blacklist
|
||||||
from allmydata import node
|
|
||||||
|
|
||||||
|
|
||||||
KiB=1024
|
KiB=1024
|
||||||
|
@ -72,7 +72,7 @@ class AddGridManagerCertOptions(BaseOptions):
|
|||||||
"Must provide --filename option"
|
"Must provide --filename option"
|
||||||
)
|
)
|
||||||
if self['filename'] == '-':
|
if self['filename'] == '-':
|
||||||
print >>self.parent.parent.stderr, "reading certificate from stdin"
|
print("reading certificate from stdin", file=self.parent.parent.stderr)
|
||||||
data = sys.stdin.read()
|
data = sys.stdin.read()
|
||||||
if len(data) == 0:
|
if len(data) == 0:
|
||||||
raise usage.UsageError(
|
raise usage.UsageError(
|
||||||
@ -82,7 +82,7 @@ class AddGridManagerCertOptions(BaseOptions):
|
|||||||
try:
|
try:
|
||||||
self.certificate_data = parse_grid_manager_data(data)
|
self.certificate_data = parse_grid_manager_data(data)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
print >>self.parent.parent.stderr, "Error parsing certificate: {}".format(e)
|
print("Error parsing certificate: {}".format(e), file=self.parent.parent.stderr)
|
||||||
self.certificate_data = None
|
self.certificate_data = None
|
||||||
else:
|
else:
|
||||||
with open(self['filename'], 'r') as f:
|
with open(self['filename'], 'r') as f:
|
||||||
@ -118,10 +118,10 @@ def add_grid_manager_cert(options):
|
|||||||
cert_fname = "{}.cert".format(options['name'])
|
cert_fname = "{}.cert".format(options['name'])
|
||||||
cert_path = config.get_config_path(cert_fname)
|
cert_path = config.get_config_path(cert_fname)
|
||||||
cert_bytes = json.dumps(options.certificate_data, indent=4) + '\n'
|
cert_bytes = json.dumps(options.certificate_data, indent=4) + '\n'
|
||||||
cert_name = options['name']
|
# cert_name = options['name']
|
||||||
|
|
||||||
if exists(cert_path):
|
if exists(cert_path):
|
||||||
print >>options.parent.parent.stderr, "Already have file '{}'".format(cert_path)
|
print("Already have file '{}'".format(cert_path), file=options.parent.parent.stderr)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
cfg = config.config # why aren't methods we call on cfg in _Config itself?
|
cfg = config.config # why aren't methods we call on cfg in _Config itself?
|
||||||
@ -141,7 +141,7 @@ def add_grid_manager_cert(options):
|
|||||||
cfg.write(f)
|
cfg.write(f)
|
||||||
# print("wrote {}".format(config_fname))
|
# print("wrote {}".format(config_fname))
|
||||||
|
|
||||||
print >>options.parent.parent.stderr, "There are now {} certificates".format(len(gm_certs))
|
print("There are now {} certificates".format(len(gm_certs)), file=options.parent.parent.stderr)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
|
@ -43,7 +43,6 @@ from pycryptopp.publickey import ed25519 # perhaps NaCl instead? other code use
|
|||||||
|
|
||||||
from allmydata.interfaces import IStorageBroker, IDisplayableServer, IServer
|
from allmydata.interfaces import IStorageBroker, IDisplayableServer, IServer
|
||||||
from allmydata.util import log, base32, connection_status
|
from allmydata.util import log, base32, connection_status
|
||||||
from allmydata.util import keyutil
|
|
||||||
from allmydata.util.assertutil import precondition
|
from allmydata.util.assertutil import precondition
|
||||||
from allmydata.util.observer import ObserverList
|
from allmydata.util.observer import ObserverList
|
||||||
from allmydata.util.rrefutil import add_version_to_remote_reference
|
from allmydata.util.rrefutil import add_version_to_remote_reference
|
||||||
@ -304,7 +303,7 @@ def parse_grid_manager_data(gm_data):
|
|||||||
k,
|
k,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
for k in allowed_keys:
|
for k in required_keys:
|
||||||
if k not in js:
|
if k not in js:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Grid Manager certificate JSON must contain '{}'".format(
|
"Grid Manager certificate JSON must contain '{}'".format(
|
||||||
|
Loading…
Reference in New Issue
Block a user