-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3124 from pnorbert/profiling_pretty_print
Added adios2_json_pp pretty print python script ...
- Loading branch information
Showing
6 changed files
with
78 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python3 | ||
import json | ||
import argparse | ||
from os.path import exists | ||
|
||
|
||
def SetupArgs(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--indent", "-i", type=int, default=2, | ||
help="indent size, default=2") | ||
parser.add_argument("FILE", help="Name of the JSON file") | ||
args = parser.parse_args() | ||
|
||
# print(args) | ||
return args | ||
|
||
|
||
def CheckFileName(args): | ||
if not exists(args.FILE): | ||
print("ERROR: File " + args.FILE + " does not exist", flush=True) | ||
exit(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
args = SetupArgs() | ||
CheckFileName(args) | ||
|
||
with open(args.FILE) as jsonfile: | ||
parsed = json.load(jsonfile) | ||
|
||
print(json.dumps(parsed, indent=args.indent, sort_keys=False)) |