MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / write_config

Function write_config

deeplabcut/utils/auxiliaryfunctions.py:243–259  ·  view source on GitHub ↗

Write structured config file.

(configname, cfg)

Source from the content-addressed store, hash-verified

241
242
243def write_config(configname, cfg):
244 """Write structured config file."""
245 with open(configname, "w") as cf:
246 cfg_file, ruamelFile = create_config_template(cfg.get("multianimalproject", False))
247 for key in cfg.keys():
248 cfg_file[key] = cfg[key]
249
250 # Adding default value for variable skeleton and skeleton_color for backward compatibility.
251 if "skeleton" not in cfg.keys():
252 cfg_file["skeleton"] = []
253 cfg_file["skeleton_color"] = "black"
254 # Use a very large width so long strings (e.g., file paths or keys with spaces)
255 # are kept on a single line instead of being wrapped, which can otherwise cause
256 # them to be emitted as complex keys. See also:
257 # https://stackoverflow.com/questions/31197268/pyyaml-yaml-dump-produces-complex-key-for-string-key-122-chars/31199123#31199123
258 ruamelFile.width = 1_000_000
259 ruamelFile.dump(cfg_file, cf)
260
261
262def edit_config(configname, edits, output_name=""):

Callers 2

create_conversion_tableFunction · 0.90
read_configFunction · 0.70

Calls 3

create_config_templateFunction · 0.85
keysMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected