mirror of
https://github.com/nqrduck/LimeDriver.git
synced 2024-11-22 10:02:25 +00:00
Refactor parameter initialization and display
Simplified the storage of command-line arguments by refactoring how parameters are initialized in the 'limr' class. Removed redundant storage of parameters by opting to keep them as attributes instead of storing them in both attributes and a dictionary. Enhanced the parameter display function by appending the "name" attribute from the parameter dictionary, providing clearer output. This change improves code maintainability and readability, ensuring argument-related data is handled consistently throughout the class. Resolves confusion around parameter storage as flagged in TODO comment.
This commit is contained in:
parent
5f323fea96
commit
a6a6705dba
1 changed files with 5 additions and 4 deletions
|
@ -40,10 +40,11 @@ class limr:
|
|||
in_arg = json.loads(p.stdout.read().decode("utf-8"))
|
||||
|
||||
# initialize the parameters
|
||||
for key, value in in_arg.items():
|
||||
setattr(self, key, value)
|
||||
for key, in in_arg.keys():
|
||||
in_arg[key]["argument"] = []
|
||||
setattr(self, key, [])
|
||||
|
||||
self.parsinp = in_arg # TODO: *Either* store the parameters in a dict or as attributes, not both
|
||||
self.parsinp = in_arg
|
||||
|
||||
# initialize other variables
|
||||
self.parvar = {}
|
||||
|
@ -59,7 +60,7 @@ class limr:
|
|||
for key in sorted(self.parsinp.keys()):
|
||||
val = getattr(self, key)
|
||||
if (val != []) | (allel):
|
||||
print("{:<5}: {:>50} {:<25}".format(key, val, self.parsinp[key]))
|
||||
print("{:<5}: {:>50} {:<25}".format(key, val, self.parsinp[key]["name"]))
|
||||
|
||||
# add parameter variation:
|
||||
# key is the argument to vary
|
||||
|
|
Loading…
Reference in a new issue