def from_params(cls: Type, params: Dict, **kwargs) -> Type["T"]:
config_params = {}
for sp in params.keys():
try:
if sp != "name":
config_params[sp] = params[sp]
except KeyError:
print("Using default value for parameter `{}`.".format(sp))
After Change
def from_params(cls: Type, params: Dict, **kwargs) -> Type["T"]:
config_params = {k: v for k, v in params.items() if k != "name"}
for param_name, subcl_params in config_params.items():
if isinstance(subcl_params, dict):