1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-06-05 09:53:33 +03:00

Made json output easier to work with

This commit is contained in:
A_D 2021-06-06 12:35:31 +02:00
parent dbea29194b
commit 0c5806e12c
No known key found for this signature in database
GPG Key ID: 4BE9EB7DF45076C4

View File

@ -128,18 +128,19 @@ if __name__ == '__main__':
print(f"No longer used: {old}") print(f"No longer used: {old}")
elif args.json: elif args.json:
to_print = json.dumps({ to_print_data = [
str(path): [{ {
"path": str(path),
"string": get_arg(c), "string": get_arg(c),
"reconstructed": ast.unparse(c), "reconstructed": ast.unparse(c),
"start_line": c.lineno, "start_line": c.lineno,
"start_offset": c.col_offset, "start_offset": c.col_offset,
"end_line": c.end_lineno, "end_line": c.end_lineno,
"end_offset": c.end_col_offset, "end_offset": c.end_col_offset,
} for c in calls] for (path, calls) in res.items() if len(calls) > 0 } for (path, calls) in res.items() for c in calls
}, indent=2) ]
print(to_print) print(json.dumps(to_print_data, indent=2))
elif args.lang: elif args.lang:
for path, calls in res.items(): for path, calls in res.items():