Coverage for src/qdrant_loader/connectors/base.py: 94%
17 statements
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-04 05:50 +0000
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-04 05:50 +0000
1from abc import ABC, abstractmethod
3from qdrant_loader.config.source_config import SourceConfig
4from qdrant_loader.core.document import Document
5from qdrant_loader.core.file_conversion import FileConversionConfig
8class BaseConnector(ABC):
9 """Base class for all connectors."""
11 def __init__(self, config: SourceConfig):
12 self.config = config
13 self._initialized = False
15 async def __aenter__(self):
16 """Async context manager entry."""
17 self._initialized = True
18 return self
20 async def __aexit__(self, exc_type, exc_val, exc_tb):
21 """Async context manager exit."""
22 self._initialized = False
24 def set_file_conversion_config(
25 self, file_conversion_config: FileConversionConfig
26 ) -> None:
27 """Set file conversion configuration.
29 This is a default implementation that does nothing.
30 Subclasses that support file conversion should override this method.
32 Args:
33 file_conversion_config: Global file conversion configuration
34 """
35 pass
37 @abstractmethod
38 async def get_documents(self) -> list[Document]:
39 """Get documents from the source."""