Spaces:
Sleeping
Sleeping
Download src/gaia/utils/check_app.py from jm-vis/Final_Assignment_GAIAAgent: direct link, hf CLI and curl.
- Browser
- Download file 1.47 kB
-
https://huggingface.co/spaces/jm-vis/Final_Assignment_GAIAAgent/resolve/main/src/gaia/utils/check_app.py
- Command line
-
hf download hf://spaces/jm-vis/Final_Assignment_GAIAAgent/src/gaia/utils/check_app.py
-
curl -L -o check_app.py https://huggingface.co/spaces/jm-vis/Final_Assignment_GAIAAgent/resolve/main/src/gaia/utils/check_app.py
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) |