INNER CODE UNIT · Python
parse_file
lishuangqiang/AI-Meeting · skills/xunzhi-repo-map/scripts/extract_api_index.py:42
def parse_file(path: Path) -> list[ApiRow]:
lines = path.read_text(encoding="utf-8").splitlines()
relative = path.relative_to(ROOT).as_posix()
module_match = PACKAGE_RE.search(relative)
module = module_match.group(1) if module_match else "unknown"
controller = path.stem
base_path = ""
websocket_path = ""
rows: list[ApiRow] = []
pending_annotations: list[str] = []
for index, line in enumerate(lines):
stripped = line.strip()
if stripped.startswith("@RequestMapping") and not base_path:
base_path = parse_path(stripped)
if stripped.startswith("@ServerEndpoint"):
websocket_path = parse_path(stripped)
if stripped.startswith("@"):