Reformat project

This commit is contained in:
2022-07-21 13:39:59 +01:00
parent 4669096fcb
commit da678617d8
57 changed files with 523 additions and 218 deletions

View File

@@ -1,18 +1,24 @@
import main
from yaml import dump
import main
class RelayCommand:
def __init__(self, *args):
self.relay(*args)
def relay(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length):
def relay(
self, addr, authed, data, obj, spl, success, failure, info, incUsage, length
):
if authed:
if length == 3:
if spl[1] == "add":
if spl[2] in main.network.keys():
id, alias = main.network[spl[2]].add_relay()
success("Successfully created relay %s on network %s with alias %s" % (str(id), spl[2], alias))
success(
"Successfully created relay %s on network %s with alias %s"
% (str(id), spl[2], alias)
)
main.saveConf("network")
return
else:
@@ -35,7 +41,10 @@ class RelayCommand:
failure("Must be a number, not %s" % spl[3])
return
id, alias = main.network[spl[2]].add_relay(int(spl[3]))
success("Successfully created relay %s on network %s with alias %s" % (str(id), spl[2], alias))
success(
"Successfully created relay %s on network %s with alias %s"
% (str(id), spl[2], alias)
)
main.saveConf("network")
return
else:
@@ -52,7 +61,9 @@ class RelayCommand:
failure("No such relay: %s on network %s" % (spl[3], spl[2]))
return
main.network[spl[2]].delete_relay(int(spl[3]))
success("Successfully deleted relay %s on network %s" % (spl[3], spl[2]))
success(
"Successfully deleted relay %s on network %s" % (spl[3], spl[2])
)
main.saveConf("network")
return
else: