google styled doc

This commit is contained in:
2026-03-08 00:29:25 +05:30
parent a188e78283
commit 5842e6a227
12 changed files with 304 additions and 203 deletions

View File

@@ -1,6 +1,10 @@
"""
PDF client abstractions for OmniRead.
---
## Summary
This module defines the **client layer** responsible for retrieving raw PDF
bytes from a concrete backing store.
@@ -24,10 +28,10 @@ class BasePDFClient(ABC):
Abstract client responsible for retrieving PDF bytes
from a specific backing store (filesystem, S3, FTP, etc.).
Implementations must:
- Accept a source identifier appropriate to the backing store
- Return the full PDF binary payload
- Raise retrieval-specific errors on failure
Notes:
**Responsibilities:**
- Implementations must accept a source identifier appropriate to the backing store, return the full PDF binary payload, and raise retrieval-specific errors on failure
"""
@abstractmethod
@@ -36,14 +40,16 @@ class BasePDFClient(ABC):
Fetch raw PDF bytes from the given source.
Args:
source: Identifier of the PDF location, such as a file path,
object storage key, or remote reference.
source (Any):
Identifier of the PDF location, such as a file path, object storage key, or remote reference.
Returns:
Raw PDF bytes.
bytes:
Raw PDF bytes.
Raises:
Exception: Retrieval-specific errors defined by the implementation.
Exception:
Retrieval-specific errors defined by the implementation.
"""
raise NotImplementedError
@@ -52,8 +58,10 @@ class FileSystemPDFClient(BasePDFClient):
"""
PDF client that reads from the local filesystem.
This client reads PDF files directly from the disk and returns their raw
binary contents.
Notes:
**Guarantees:**
- This client reads PDF files directly from the disk and returns their raw binary contents
"""
def fetch(self, path: Path) -> bytes:
@@ -61,14 +69,18 @@ class FileSystemPDFClient(BasePDFClient):
Read a PDF file from the local filesystem.
Args:
path: Filesystem path to the PDF file.
path (Path):
Filesystem path to the PDF file.
Returns:
Raw PDF bytes.
bytes:
Raw PDF bytes.
Raises:
FileNotFoundError: If the path does not exist.
ValueError: If the path exists but is not a file.
FileNotFoundError:
If the path does not exist.
ValueError:
If the path exists but is not a file.
"""
if not path.exists():