Commit f6af4e11 authored by Gyanendra Mishra's avatar Gyanendra Mishra

a bit better

parent 5ee77216
...@@ -21,20 +21,20 @@ def replace_with_defaults(input_args): ...@@ -21,20 +21,20 @@ def replace_with_defaults(input_args):
result = {} result = {}
for attr in dir(input_args): for attr in dir(input_args):
value = getattr(input_args, attr) value = getattr(input_args, attr)
if type(attr) == "int" and value == 0: if type(value) == "int" and value == 0:
result[attr] = default_input[attr] result[attr] = default_input[attr]
elif type(attr) == "str" and value == "": elif type(value) == "string" and value == "":
result[attr] = default_input[attr] result[attr] = default_input[attr]
elif attr == "network_params": elif attr == "network_params":
result["network_params"] = {} result["network_params"] = {}
for attr_ in dir(input_args.network_params): for attr_ in dir(input_args.network_params):
value_ = getattr(input_args.network_params, attr_) value_ = getattr(input_args.network_params, attr_)
if type(attr_) == "int" and value_ == 0: if type(value_) == "int" and value_ == 0:
result["network_params"][attr_] = default_input["network_params"][attr_] result["network_params"][attr_] = default_input["network_params"][attr_]
elif type(attr_) == "str" and value_ == "": elif type(value_) == "string" and value_ == "":
result["network_params"][attr_] = default_input["network_params"][attr_] result["network_params"][attr_] = default_input["network_params"][attr_]
elif attr_ != "descriptor": elif attr_ != "descriptor":
result["network_params"][attr_] = default_input["network_params"][attr_] result["network_params"][attr_] = value_
elif attr == "participants" and value == []: elif attr == "participants" and value == []:
result["participant"] = [default_input["participants"][0]] result["participant"] = [default_input["participants"][0]]
elif attr == "participants": elif attr == "participants":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment