pcvs.converter.yaml_converter module

pcvs.converter.yaml_converter.check_if_key_matches(key, value, ref_array) tuple[source]

list all matches for the current key in the new YAML description.

pcvs.converter.yaml_converter.compute_new_key(k, v, m) str[source]

replace in ‘k’ any pattern found in ‘m’. ‘k’ is a string with placeholders, while ‘m’ is a match result with groups named after placeholders. This function will also expand the placeholder if ‘call:’ token is used to execute python code on the fly (complex transformation)

pcvs.converter.yaml_converter.flatten(dd, prefix='') dict[source]

make the n-depth dict ‘dd’ a “flat” version, where the successive keys are chained in a tuple. for instance: {‘a’: {‘b’: {‘c’: value}}} –> {(‘a’, ‘b’, ‘c’): value}

pcvs.converter.yaml_converter.print_version(ctx, param, value) None[source]

print converter version number, tied to PCVS version number

pcvs.converter.yaml_converter.process(data, ref_array=None, warn_if_missing=True) dict[source]

Process YAML dict ‘data’ and return a transformed dict

pcvs.converter.yaml_converter.process_modifiers(data)[source]

applies rules in-place for the data dict. Rules are present in the desc_dict[‘first’] sub-dict.

pcvs.converter.yaml_converter.replace_placeholder(tmp, refs) dict[source]

The given TMP should be a dict, where keys contain placeholders, wrapped with “<>”. Each placeholder will be replaced (i.e. key will be changed) by the associated value in refs.

pcvs.converter.yaml_converter.separate_key_and_value(s: str, c: str) tuple[source]

helper to split the key and value from a string

pcvs.converter.yaml_converter.set_with(data, klist, val, append=False)[source]

Add a value to a n-depth dict where the depth is declared as a list of intermediate keys. the ‘append’ flag indicates if the given ‘value’ should be appended or replace the original content