Skip to content

Conversation

@braboj
Copy link
Owner

@braboj braboj commented Jun 16, 2025

Summary

  • load acronyms.json using the script directory
  • cache loaded acronyms and reference the cache in to_title

Testing

  • pytest -q

https://chatgpt.com/codex/tasks/task_e_6850525c0650832483bb6116876d6b14

Copilot AI review requested due to automatic review settings June 16, 2025 17:23
@braboj braboj added the codex Agent from OpenAI label Jun 16, 2025 — with ChatGPT Codex Connector
@netlify
Copy link

netlify bot commented Jun 16, 2025

Deploy Preview for tutorial-python failed. Why did it fail? →

Name Link
🔨 Latest commit b39ef84
🔍 Latest deploy log https://app.netlify.com/projects/tutorial-python/deploys/6850531f4369d90008fb85c0

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR caches the acronyms from acronyms.json by loading them once at module import instead of reloading on every function call.

  • Load acronyms.json once at module level
  • Replace inline file reading in to_title with a cached variable

Comment on lines +23 to +24
with ACRONYMS_PATH.open("r", encoding="utf-8") as json_data:
USER_ACRONYMS = json.load(json_data)
Copy link

Copilot AI Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding error handling (e.g., try/except) around the file read to gracefully handle cases when acronyms.json is missing or invalid.

Suggested change
with ACRONYMS_PATH.open("r", encoding="utf-8") as json_data:
USER_ACRONYMS = json.load(json_data)
try:
with ACRONYMS_PATH.open("r", encoding="utf-8") as json_data:
USER_ACRONYMS = json.load(json_data)
except FileNotFoundError:
print(f"Warning: {ACRONYMS_PATH} not found. Using an empty acronym list.")
USER_ACRONYMS = {}
except json.JSONDecodeError as e:
print(f"Error: Failed to parse {ACRONYMS_PATH}: {e}. Using an empty acronym list.")
USER_ACRONYMS = {}

Copilot uses AI. Check for mistakes.
@braboj braboj merged commit a378a79 into main Jun 17, 2025
0 of 4 checks passed
@braboj braboj deleted the codex/refactor-gen_markdown_chapters.py-for-file-handling branch June 17, 2025 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex Agent from OpenAI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant