Refactor dictionary iteration and output formatting

Standardized the iteration over dictionary keys in `limr.py` to directly call `.keys()` method for clarity. Additionally, streamlined the output formatting by removing redundant data in `print_params()` method, resulting in cleaner output without extraneous details. This enhances code readability and maintains a tidy console display.
This commit is contained in:
Kumi 2024-02-05 13:07:43 +01:00
parent 99e20dbf9d
commit 83f3221162
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -56,10 +56,10 @@ class limr:
# print the arguments that have been set
def print_params(self, allel=False):
for key in sorted(self.parsinp):
for key in sorted(self.parsinp.keys()):
val = getattr(self, key)
if (val != []) | (allel):
print("{:<5}: {:>50} {:<25}".format(key, val, self.parsinp[key][1]))
print("{:<5}: {:>50} {:<25}".format(key, val, self.parsinp[key]))
# add parameter variation:
# key is the argument to vary
@ -282,7 +282,7 @@ class limr:
str2call = self.Cprog
for key in self.parsinp:
for key in self.parsinp.keys():
vals = getattr(self, key)
if vals == []:
continue # ignore arguments that are not set