- Create Economist SubmissionTracking package correctly: * mainArticle = full blog post content * coverLetter = 216-word SIR— letter * Links to blog post via blogPostId - Archive 'Letter to The Economist' from blog posts (it's the cover letter) - Fix date display on article cards (use published_at) - Target publication already displaying via blue badge Database changes: - Make blogPostId optional in SubmissionTracking model - Economist package ID: 68fa85ae49d4900e7f2ecd83 - Le Monde package ID: 68fa2abd2e6acd5691932150 Next: Enhanced modal with tabs, validation, export 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
62 lines
1.5 KiB
Python
62 lines
1.5 KiB
Python
"""Helpers for working with PDF types."""
|
|
|
|
from pathlib import Path
|
|
from typing import IO, Any, Dict, List, Optional, Tuple, Union
|
|
|
|
try:
|
|
# Python 3.8+: https://peps.python.org/pep-0586
|
|
from typing import Protocol # type: ignore[attr-defined]
|
|
except ImportError:
|
|
from typing_extensions import Protocol # type: ignore[misc]
|
|
|
|
from ._utils import StrByteType
|
|
|
|
|
|
class PdfObjectProtocol(Protocol):
|
|
indirect_reference: Any
|
|
|
|
def clone(
|
|
self,
|
|
pdf_dest: Any,
|
|
force_duplicate: bool = False,
|
|
ignore_fields: Union[Tuple[str, ...], List[str], None] = (),
|
|
) -> Any:
|
|
...
|
|
|
|
def _reference_clone(self, clone: Any, pdf_dest: Any) -> Any:
|
|
...
|
|
|
|
def get_object(self) -> Optional["PdfObjectProtocol"]:
|
|
...
|
|
|
|
|
|
class PdfReaderProtocol(Protocol): # pragma: no cover
|
|
@property
|
|
def pdf_header(self) -> str:
|
|
...
|
|
|
|
@property
|
|
def strict(self) -> bool:
|
|
...
|
|
|
|
@property
|
|
def xref(self) -> Dict[int, Dict[int, Any]]:
|
|
...
|
|
|
|
@property
|
|
def pages(self) -> List[Any]:
|
|
...
|
|
|
|
def get_object(self, indirect_reference: Any) -> Optional[PdfObjectProtocol]:
|
|
...
|
|
|
|
|
|
class PdfWriterProtocol(Protocol): # pragma: no cover
|
|
_objects: List[Any]
|
|
_id_translated: Dict[int, Dict[int, int]]
|
|
|
|
def get_object(self, indirect_reference: Any) -> Optional[PdfObjectProtocol]:
|
|
...
|
|
|
|
def write(self, stream: Union[Path, StrByteType]) -> Tuple[bool, IO]:
|
|
...
|