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,6 +27,7 @@ import argparse
|
|||||||
|
|
||||||
from RNS._version import __version__
|
from RNS._version import __version__
|
||||||
|
|
||||||
|
|
||||||
def size_str(num, suffix='B'):
|
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'
|
last_unit = 'Y'
|
||||||
@ -46,6 +47,7 @@ def size_str(num, suffix='B'):
|
|||||||
|
|
||||||
return "%.2f%s%s" % (num, last_unit, suffix)
|
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):
|
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)
|
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:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if stats != None:
|
if stats is None:
|
||||||
|
print("Could not get RNS status")
|
||||||
|
return
|
||||||
|
|
||||||
if json:
|
if json:
|
||||||
import json
|
import json
|
||||||
for s in stats:
|
for s in stats:
|
||||||
@ -216,9 +221,6 @@ def program_setup(configdir, dispall=False, verbosity=0, name_filter=None, json=
|
|||||||
|
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
else:
|
|
||||||
print("Could not get RNS status")
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
try:
|
try:
|
||||||
parser = argparse.ArgumentParser(description="Reticulum Network Stack Status")
|
parser = argparse.ArgumentParser(description="Reticulum Network Stack Status")
|
||||||
|
Loading…
Reference in New Issue
Block a user