mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-26 15:30:18 +00:00
refactor(if/else/return): Remove indentation
This may seems like a lot, but the only think that I change here was the if/else block. I move the else statement at the beginning and if that condition is true, will exit the function. This is just for code clarity, I think that this change should not improve the speed or performance of the code. Signed-off-by: nothingbutlucas <69118979+nothingbutlucas@users.noreply.github.com>
This commit is contained in:
parent
541d3cde48
commit
059c2381b5
@ -27,13 +27,14 @@ import argparse
|
||||
|
||||
from RNS._version import __version__
|
||||
|
||||
|
||||
def size_str(num, suffix='B'):
|
||||
units = ['','K','M','G','T','P','E','Z']
|
||||
units = ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z']
|
||||
last_unit = 'Y'
|
||||
|
||||
if suffix == 'b':
|
||||
num *= 8
|
||||
units = ['','K','M','G','T','P','E','Z']
|
||||
units = ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z']
|
||||
last_unit = 'Y'
|
||||
|
||||
for unit in units:
|
||||
@ -46,6 +47,7 @@ def size_str(num, suffix='B'):
|
||||
|
||||
return "%.2f%s%s" % (num, last_unit, suffix)
|
||||
|
||||
|
||||
def program_setup(configdir, dispall=False, verbosity=0, name_filter=None, json=False, astats=False, sorting=None, sort_reverse=False):
|
||||
reticulum = RNS.Reticulum(configdir = configdir, loglevel = 3+verbosity)
|
||||
|
||||
@ -55,7 +57,10 @@ def program_setup(configdir, dispall=False, verbosity=0, name_filter=None, json=
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
if stats != None:
|
||||
if stats is None:
|
||||
print("Could not get RNS status")
|
||||
return
|
||||
|
||||
if json:
|
||||
import json
|
||||
for s in stats:
|
||||
@ -216,9 +221,6 @@ def program_setup(configdir, dispall=False, verbosity=0, name_filter=None, json=
|
||||
|
||||
print("")
|
||||
|
||||
else:
|
||||
print("Could not get RNS status")
|
||||
|
||||
def main():
|
||||
try:
|
||||
parser = argparse.ArgumentParser(description="Reticulum Network Stack Status")
|
||||
|
Loading…
Reference in New Issue
Block a user