jm-vis's picture
Upload GAIA agent implementation files for assessment
c922f8b
Raw History Blame Contribute Delete
1.47 kB
"""
Simple script to check app.py file length and syntax
"""
import os
import sys
import ast
def check_file(file_path):
try:
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()
lines = content.splitlines()
print(f"Total lines in {file_path}: {len(lines)}")
# Try to parse the content to check for syntax errors
try:
ast.parse(content)
print(f"✓ No syntax errors found in {file_path}")
except SyntaxError as e:
print(f"✗ Syntax error in {file_path}:")
print(f" Line {e.lineno}, Column {e.offset}")
print(f" {e.text.strip()}")
print(f" {e}")
# Print context around the error
start_line = max(0, e.lineno - 5)
end_line = min(len(lines), e.lineno + 5)
print("\nContext around error:")
for i in range(start_line, end_line):
line_marker = ">" if i + 1 == e.lineno else " "
print(f"{line_marker} {i+1:4d} | {lines[i]}")
except Exception as e:
print(f"Error reading or parsing {file_path}: {e}")
if __name__ == "__main__":
file_path = "app.py"
if not os.path.exists(file_path):
print(f"File not found: {file_path}")
sys.exit(1)
check_file(file_path)