Prevent missing regex_patterns (#15)

This commit is contained in:
Johan 2026-01-10 17:51:12 +02:00 committed by GitHub
parent 599fd6209f
commit 783609d2e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
195 changed files with 1617 additions and 562 deletions

View file

@ -0,0 +1,29 @@
import json
import os
def iterate_json_files(input_dir):
"""
Generator that yields (file_path, file_stem, data) tuples for all JSON files
in the input directory and its subdirectories.
Args:
input_dir: Directory to search for JSON files
Yields:
Tuple of (file_path, file_stem, data) where:
- file_path: Full path to the JSON file
- file_stem: Filename without extension
- data: Parsed JSON data
"""
for root, _, files in os.walk(input_dir):
for filename in sorted(files):
if not filename.endswith(".json"):
continue
file_path = os.path.join(root, filename)
file_stem = os.path.splitext(filename)[0]
with open(file_path, encoding="utf-8") as f:
data = json.load(f)
yield file_path, file_stem, data