Reformat helpers

This commit is contained in:
Mark Veidemanis 2022-08-11 20:09:14 +01:00
parent 0666c4a153
commit ba4b8c7501
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 4 additions and 2 deletions

View File

@ -1,6 +1,7 @@
import main import main
from modules import chankeep from modules import chankeep
def get_first_relay(net): def get_first_relay(net):
""" """
Get the first relay in the network. Get the first relay in the network.
@ -9,7 +10,7 @@ def get_first_relay(net):
:return: IRCPool instance for the IRC bot :return: IRCPool instance for the IRC bot
""" """
cur_relay = 0 cur_relay = 0
max_relay = len(main.network[net].relays.keys())+1 max_relay = len(main.network[net].relays.keys()) + 1
activeRelays = chankeep.getActiveRelays(net) activeRelays = chankeep.getActiveRelays(net)
while cur_relay != max_relay: while cur_relay != max_relay:
cur_relay += 1 cur_relay += 1
@ -20,6 +21,7 @@ def get_first_relay(net):
return main.IRCPool[name] return main.IRCPool[name]
return None return None
def is_first_relay(net, num): def is_first_relay(net, num):
""" """
Determine if we are the first relay for the network. Determine if we are the first relay for the network.
@ -32,4 +34,4 @@ def is_first_relay(net, num):
while cur_relay > max_relay: while cur_relay > max_relay:
name = net + str(cur_relay) name = net + str(cur_relay)
if name in main.IRCPool.keys(): if name in main.IRCPool.keys():
return cur_relay == num return cur_relay == num