Skip to content

Commit

Permalink
Adds code to debug reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
catusf authored Dec 6, 2024
1 parent f8e60dc commit c48152f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release_all_external.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- name: Build all dictionaries
run: |
python ./bin/convert_all.py --input_folder=$INPUT_DIR --output_folder=$OUTPUT_DIR --extension=tab
python ./bin/convert_all.py --input_folder=$INPUT_DIR --output_folder=$OUTPUT_DIR --extension=tab --filter=Hero
- name: Report the results
run: |
Expand Down
14 changes: 10 additions & 4 deletions bin/dict_summary.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import json
import argparse
from languagecodes import languag

DOWNLOAD_TAG = "v4.0" # Set the GitHub tag version that asscociates with the release

Expand Down Expand Up @@ -136,10 +137,12 @@ def generate_summary(dict_dir):
})

# Save the list of dictionaries as a JSON file
with open(os.path.join(dict_dir, "dict_summary.json"), 'w', encoding='utf-8') as json_file:
json_path = os.path.join(dict_dir, "dict_summary.json")
with open(json_path, 'w', encoding='utf-8') as json_file:
json.dump(data, json_file, ensure_ascii=False, indent=4)

print("JSON file 'dict_summary.json' has been generated.")
print(f"Data file writtend to '{json_path}'.")

return data

def generate_markdown_table(data, extensions, columns):
Expand Down Expand Up @@ -239,15 +242,18 @@ def main():
if read_only == "no":
data = generate_summary(dict_dir)
else:
with open(os.path.join(dict_dir, "dict_summary.json"), 'r', encoding='utf-8') as json_file:
json_path = os.path.join(dict_dir, "dict_summary.json")
with open(json_path, 'r', encoding='utf-8') as json_file:
data = json.load(json_file)

# Generate the markdown table from the JSON data
markdown_table = generate_markdown_table(data, extensions, columns)

# Save the markdown table to a .md file
with open(os.path.join(dict_dir, outfile), 'w', encoding='utf-8') as file:
markdown_file = os.path.join(dict_dir, outfile)
with open(markdown_file, 'w', encoding='utf-8') as file:
file.write(markdown_table)
print(f"Data file written to: {markdown_file}")

print(f"Summary markdown file '{outfile}' has been generated.")

Expand Down

0 comments on commit c48152f

Please sign in to comment.