def override_config_dict()

in torchbiggraph/config.py [0:0]


def override_config_dict(config_dict: Any, overrides: Optional[List[List[str]]]) -> Any:
    for override in chain.from_iterable(overrides or ()):
        try:
            key, _, value = override.rpartition("=")
            path = key.split(".")
            param_type = extract_nested_type(ConfigSchema, path)
            # this is a bit of a hack; we should do something better
            # but this is convenient for specifying lists of strings
            # e.g. edge_paths
            if has_origin(param_type, list):
                value = value.split(",")
            # Convert numbers (caution: ignore bools, which are ints)
            if (
                isinstance(param_type, type)
                and issubclass(param_type, (int, float))
                and not issubclass(param_type, bool)
            ):
                value = param_type(value)
            inject_nested_value(config_dict, path, value)
        except Exception as err:
            raise RuntimeError("Can't parse override: %s" % override) from err
    return config_dict