64 lines
1.8 KiB
Python
64 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Search for response_format usage in all Python files
|
|
"""
|
|
|
|
import os
|
|
import re
|
|
from pathlib import Path
|
|
|
|
def search_response_format(root_dir):
|
|
"""Search for response_format in all Python files"""
|
|
root_path = Path(root_dir)
|
|
|
|
print(f"🔍 Searching for 'response_format' in: {root_path}")
|
|
|
|
# Find all Python files
|
|
py_files = list(root_path.rglob("*.py"))
|
|
|
|
found_files = []
|
|
|
|
for py_file in py_files:
|
|
try:
|
|
with open(py_file, 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
# Search for response_format (case insensitive)
|
|
lines = content.split('\n')
|
|
matches = []
|
|
|
|
for line_num, line in enumerate(lines, 1):
|
|
if 'response_format' in line.lower():
|
|
matches.append((line_num, line.strip()))
|
|
|
|
if matches:
|
|
found_files.append((py_file, matches))
|
|
print(f"\n📁 {py_file}")
|
|
for line_num, line in matches:
|
|
print(f" Line {line_num}: {line}")
|
|
|
|
except Exception as e:
|
|
print(f"❌ Error reading {py_file}: {e}")
|
|
|
|
if not found_files:
|
|
print("✅ No 'response_format' found in any Python files")
|
|
else:
|
|
print(f"\n⚠️ Found 'response_format' in {len(found_files)} files")
|
|
|
|
return found_files
|
|
|
|
if __name__ == "__main__":
|
|
script_dir = Path(__file__).parent
|
|
print("=" * 60)
|
|
print("GPTEdit response_format Search")
|
|
print("=" * 60)
|
|
|
|
found = search_response_format(script_dir)
|
|
|
|
print("\n" + "=" * 60)
|
|
if found:
|
|
print("❌ ACTION REQUIRED: Remove response_format from found files")
|
|
else:
|
|
print("✅ NO ACTION NEEDED: response_format not found")
|
|
print("=" * 60)
|