Fix variable placement

This commit is contained in:
Mark Veidemanis 2022-08-15 00:27:16 +01:00
parent e77c046965
commit a9592a85d0
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 7 additions and 5 deletions

View File

@ -302,10 +302,11 @@ def keepChannels(net, listinfo, mean, sigrelay, relay):
# newNums = modules.provision.provisionMultipleRelays(net, needed) # newNums = modules.provision.provisionMultipleRelays(net, needed)
# else: # else:
# newNums = [] # newNums = []
flist = [i[0] for i in listinfo]
if len(flist) > max_chans: if len(flist) > max_chans:
max_chans = len(flist) - 1 max_chans = len(flist) - 1
chosen = sorted(flist, reverse=True, key=lambda x: x[1])[:max_chans] chosen = sorted(flist, reverse=True, key=lambda x: x[1])[:max_chans]
flist = [i[0] for i in listinfo]
debug(f"keepChannels() {net}: joining {len(chosen)}/{len(flist)} channels") debug(f"keepChannels() {net}: joining {len(chosen)}/{len(flist)} channels")
trace(f"keepChannels() {net}: joining:{chosen}") trace(f"keepChannels() {net}: joining:{chosen}")
populateChans(net, chosen) populateChans(net, chosen)
@ -317,10 +318,11 @@ def keepChannels(net, listinfo, mean, sigrelay, relay):
# else: # else:
# newNums = [] # newNums = []
siglist = [i for i in listinfo if int(i[1]) > mean] siglist = [i for i in listinfo if int(i[1]) > mean]
chosen = sorted(siglist, reverse=True, key=lambda x: x[1])[:max_chans]
siglist = [i[0] for i in siglist]
if len(siglist) > max_chans: if len(siglist) > max_chans:
max_chans = len(siglist) - 1 max_chans = len(siglist) - 1
chosen = sorted(siglist, reverse=True, key=lambda x: x[1])[:max_chans]
siglist = [i[0] for i in siglist]
debug(f"keepChannels() {net}: siglist:{siglist} max_chans:{max_chans} len_sig:{len(siglist)}") debug(f"keepChannels() {net}: siglist:{siglist} max_chans:{max_chans} len_sig:{len(siglist)}")
debug(f"keepChannels() {net}: joining {len(chosen)}/{len(siglist)} channels") debug(f"keepChannels() {net}: joining {len(chosen)}/{len(siglist)} channels")
trace(f"keepChannels() {net}: joining:{chosen}") trace(f"keepChannels() {net}: joining:{chosen}")