pcvs.converter.yaml_converter module

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

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

Return type:

tuple

pcvs.converter.yaml_converter.compute_new_key(k, v, m)[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)

Return type:

str

pcvs.converter.yaml_converter.flatten(dd, prefix='')[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}

Return type:

dict

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

print converter version number, tied to PCVS version number

Return type:

None

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

Process YAML dict ‘data’ and return a transformed dict

Return type:

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)[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.

Return type:

dict

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

helper to split the key and value from a string

Return type:

tuple

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