band-aider-pub/band_aider/judgement/code_parser.py
2026-10-17 11:57:37 -07:00

39 lines
1 KiB
Python

# SPDX-FileCopyrightText: 2026 Art Sea LLC
#
# SPDX-License-Identifier: AGPL-3.0-only
from __future__ import annotations
from typing import Protocol, TextIO, runtime_checkable
from band_aider.context.class_meta import ClassMeta, ContentType
@runtime_checkable
class CodeParser(Protocol):
"""CodeParser converts files and streams into ClassMeta metadata."""
def parse_file(
self,
file_name: str,
prompt: str,
content_type: ContentType = ContentType.Source,
) -> ClassMeta:
"""Parse one file path into ClassMeta metadata."""
def parse_stream(
self,
file_name: str,
stream: TextIO,
prompt: str,
content_type: ContentType = ContentType.Source,
) -> ClassMeta:
"""Parse one readable stream into ClassMeta metadata."""
def parse_files(
self,
file_names: list[str],
prompt: str,
content_type: ContentType = ContentType.Source,
) -> list[ClassMeta]:
"""Parse multiple file paths into ClassMeta metadata."""