Use the loaded variable since we have it assigned, not just for error detection.
This commit is contained in:
parent
3f07ec3d73
commit
e486dbab04
1 changed files with 2 additions and 1 deletions
|
@ -355,6 +355,7 @@ def parse_yaml(data, path_hint=None):
|
||||||
''' convert a yaml string to a data structure. Also supports JSON, ssssssh!!!'''
|
''' convert a yaml string to a data structure. Also supports JSON, ssssssh!!!'''
|
||||||
|
|
||||||
data = data.lstrip()
|
data = data.lstrip()
|
||||||
|
loaded = None
|
||||||
if data.startswith("{") or data.startswith("["):
|
if data.startswith("{") or data.startswith("["):
|
||||||
# since the line starts with { or [ we can infer this is a JSON document.
|
# since the line starts with { or [ we can infer this is a JSON document.
|
||||||
try:
|
try:
|
||||||
|
@ -368,7 +369,7 @@ def parse_yaml(data, path_hint=None):
|
||||||
# else this is pretty sure to be a YAML document
|
# else this is pretty sure to be a YAML document
|
||||||
loaded = yaml.safe_load(data)
|
loaded = yaml.safe_load(data)
|
||||||
|
|
||||||
return smush_ds(yaml.safe_load(data))
|
return smush_ds(loaded)
|
||||||
|
|
||||||
def process_common_errors(msg, probline, column):
|
def process_common_errors(msg, probline, column):
|
||||||
replaced = probline.replace(" ","")
|
replaced = probline.replace(" ","")
|
||||||
|
|
Loading…
Reference in a new issue