This repository has been archived by the owner on Oct 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: sync testing and tools dir with sdk master (#453)
- Loading branch information
1 parent
aca7948
commit 448ffac
Showing
11 changed files
with
292 additions
and
181 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,37 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import collections | ||
import difflib | ||
import os.path | ||
import json | ||
import os | ||
import fnmatch | ||
import sys | ||
|
||
|
||
framework_dir = os.getcwd() + "/" | ||
path_list = list() | ||
for path, subdirs, files in os.walk(framework_dir): | ||
for name in files: | ||
filtered_path = fnmatch.filter( | ||
[os.path.join(path, name)], "*" + sys.argv[1] + "*universe*.json" | ||
) | ||
if len(filtered_path) > 0: | ||
path_list.extend(filtered_path) | ||
|
||
for path in path_list: | ||
with open(path, "r") as source: | ||
raw_data = [l.rstrip("\n") for l in source.readlines()] | ||
formatted_data = [ | ||
l | ||
for l in json.dumps( | ||
json.loads("".join(raw_data), object_pairs_hook=collections.OrderedDict), indent=2 | ||
).split("\n") | ||
] | ||
diff = list( | ||
difflib.unified_diff(raw_data, formatted_data, fromfile=path, tofile="formatted") | ||
) | ||
if diff: | ||
print("\n" + ("\n".join(diff))) | ||
print("{} is not formatted correctly, see diff above".format(path)) | ||
exit(1) |
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
Oops, something went wrong.