"""Opens a file and parses it using the YAML sintax
:param fileName: name of the file
:type fileName: ``string``
:return: parsed data
:rtype: ``dict``
"""
data={}
try:
withopen(fileName,'r')asstream:
try:
data=yaml.load(stream,Loader=yaml.SafeLoader)
except:
print("Cannot parse file")
except:
print("Cannot open file : ",fileName)
#
returndata
defprint_bar(prefix="",nmarks=92):
"""Prints bar.
:param prefix: prefix
:type prefix: ``string``
:param nmarks: number of marks
:type nmarks: ``int``
"""
#
s=prefix
foriinrange(nmarks):
s+="-"
print(s)
defcheck_dict(parsed_data={},default_data={}):
"""Check data: returns a dictionary with the same keys of default_data. If keys are matching, values of default_data are replaced with those of parsed_data.