MCPcopy Index your code
hub / github.com/StackStorm/st2 / json_2_yaml_convert

Function json_2_yaml_convert

tools/json2yaml.py:48–61  ·  view source on GitHub ↗
(filename)

Source from the content-addressed store, hash-verified

46
47
48def json_2_yaml_convert(filename):
49 data = None
50 try:
51 with open(filename, "r") as json_file:
52 data = json.load(json_file)
53 except:
54 PRINT("Failed on {}".format(filename))
55 traceback.print_exc()
56 return (filename, "")
57 new_filename = os.path.splitext(filename)[0] + ".yaml"
58 with open(new_filename, "w") as yaml_file:
59 yaml_file.write(YAML_HEADER + "\n")
60 yaml_file.write(yaml.safe_dump(data, default_flow_style=False))
61 return (filename, new_filename)
62
63
64def git_rm(filename):

Callers 1

mainFunction · 0.85

Calls 3

loadMethod · 0.80
writeMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected