Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A few changes to the
json_cleaner.py
file to ensure it works properly.I noticed that #21 also exists to do something similar using Nim.
for file in glob.glob("**/*.json"):
->for file in glob.glob("**/*.json", recursive=True):
BP/manifest.json
,RP/sounds.json
, etc. Addingrecursive=True
finds all files in the subfolders as well.json_data = get_json_from_file(fh)
->json_data = get_json_from_file(fh.read())
fh.read()
to send a string as arguments, mainly to be used in theexcept
section of the function.json_data = json.load(fh)
->return json.loads(fh)
json.loads
instead ofjson.load
, because the argument is now a string instead of a file.json_data
variable declaration was unused, so that was removed.try
condition passes, without thereturn
statement, the python object in which to convert to json isNone
ornull
. Hence, the files are written withnull
replacing everything. Thereturn
statement ensures a python object is returned.for line in fh:
->for line in fh.splitlines():
.splitlines()
splits the string into each line, allowing for the following lines to function.