aboutsummaryrefslogtreecommitdiff
path: root/R2R/r2r/base/parsers/base_parser.py
blob: f1bb49d7f8eb060aabfa29612ad1108c81dc33c2 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
"""Abstract base class for parsers."""

from abc import ABC, abstractmethod
from typing import AsyncGenerator, Generic, TypeVar

from ..abstractions.document import DataType

T = TypeVar("T")


class AsyncParser(ABC, Generic[T]):
    @abstractmethod
    async def ingest(self, data: T) -> AsyncGenerator[DataType, None]:
        pass