30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Debug script to trace the issue."""
|
|
import re
|
|
from pathlib import Path
|
|
|
|
TODO_PATTERNS = {
|
|
'TODO': re.compile(r'#\s*TODO[:\s]*(.*?)(?:\n|$)', re.IGNORECASE),
|
|
'FIXME': re.compile(r'#\s*FIXME[:\s]*(.*?)(?:\n|$)', re.IGNORECASE),
|
|
'XXX': re.compile(r'#\s*XXX[:\s]*(.*?)(?:\n|$)', re.IGNORECASE),
|
|
'HACK': re.compile(r'#\s*HACK[:\s]*(.*?)(?:\n|$)', re.IGNORECASE),
|
|
}
|
|
|
|
filepath = Path('/root/.hermes/wizard-outputs/spark/test_todos.py')
|
|
print(f"Reading: {filepath}")
|
|
print(f"Exists: {filepath.exists()}")
|
|
|
|
with open(filepath, 'r') as f:
|
|
content = f.read()
|
|
print(f"Content length: {len(content)}")
|
|
print(f"First 200 chars: {content[:200]!r}")
|
|
|
|
print("\n--- Testing regexes on actual lines ---")
|
|
with open(filepath, 'r') as f:
|
|
for line_num, line in enumerate(f, 1):
|
|
if 'TODO' in line or 'FIXME' in line or 'XXX' in line or 'HACK' in line:
|
|
print(f"Line {line_num}: {line!r}")
|
|
for name, regex in TODO_PATTERNS.items():
|
|
m = regex.search(line)
|
|
if m:
|
|
print(f" -> {name} matched: {m.group(1)!r}") |