forked from snigdhachoudhury/Codebase-Explainer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_extract.py
More file actions
22 lines (18 loc) · 752 Bytes
/
test_extract.py
File metadata and controls
22 lines (18 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import traceback
try:
from core_parser.cloner import clone_repo
from core_parser.file_tree import get_code_files
from core_parser.extractor import extract_metadata
print("Starting test...")
repo, tmp = clone_repo('https://github.com/pallets/flask')
print(f"Cloned to: {tmp}")
files = get_code_files(tmp)
print(f"Found {len(files)} files")
print(f"Extracting metadata from: {files[0]}")
result = extract_metadata(files[0], tmp)
print('file:', result.path)
print('functions:', [f.name for f in result.functions])
print('classes:', [c.name for c in result.classes])
print('imports:', result.imports[:3] if result.imports else [])
except Exception as e:
traceback.print_exc()