typ = kwargs.get("type", str)
default = ranked_default.value if ranked_default else None
if default is None:
return None, "None"
if is_list_option(kwargs):
member_type = kwargs.get("member_type", str)
if inspect.isclass(member_type) and issubclass(member_type, Enum):
default = []
def member_str(val):
return f""{val}"" if member_type == str else str(val)
default_str = (
f"\"[{", ".join(member_str(val) for val in default)}]\"" if default else "[]"
)
elif is_dict_option(kwargs):
if default:
items_str = ", ".join(f""{k}": {v}" for k, v in default.items())
default_str = f"{{ {items_str} }}"
else:
default_str = "{}"
elif typ == str:
default_str = default.replace("\n", " ")
elif inspect.isclass(typ) and issubclass(typ, Enum):
default_str = default.value
else:
default_str = str(default)
After Change
f"\"[{", ".join(member_str(val) for val in default)}]\"" if default else "[]"
)
elif is_dict_option(kwargs):
default = ranked_default.value if ranked_default else {}
if default:
items_str = ", ".join(f""{k}": {v}" for k, v in default.items())
default_str = f"{{ {items_str} }}"
else: