MCPcopy Index your code
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / parse_list

Function parse_list

dzoedepth/utils/config.py:295–303  ·  view source on GitHub ↗

Parse a list of values for the key if the value is a string. The values are separated by a comma. Modifies the config in place.

(config, key, dtype=int)

Source from the content-addressed store, hash-verified

293
294
295def parse_list(config, key, dtype=int):
296 """Parse a list of values for the key if the value is a string. The values are separated by a comma.
297 Modifies the config in place.
298 """
299 if key in config:
300 if isinstance(config[key], str):
301 config[key] = list(map(dtype, config[key].split(',')))
302 assert isinstance(config[key], list) and all([isinstance(e, dtype) for e in config[key]]
303 ), f"{key} should be a list of values dtype {dtype}. Given {config[key]} of type {type(config[key])} with values of type {[type(e) for e in config[key]]}."
304
305
306def get_model_config(model_name, model_version=None):

Callers 1

get_configFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected