1- from typing import TYPE_CHECKING , Any
1+ from __future__ import annotations
22
3- from .. attributes import BroadcastValue
3+ from typing import Any
44
5- if TYPE_CHECKING :
6- from ..encode import RTFDocument
5+ from rtflite import RTFDocument
76
7+ from ..attributes import BroadcastValue
88from ..pagination .processor import PageFeatureProcessor
99from ..pagination .strategies import PageContext , PaginationContext , StrategyRegistry
1010from ..pagination .strategies .defaults import DefaultPaginationStrategy
@@ -42,7 +42,7 @@ def encode(self, document: Any) -> str:
4242 # 1. Figure-only handling
4343 if document .df is None :
4444 # Reuse the logic from previous implementation, adapted slightly
45- # For now, we can't easily unify figure-only documents into the same pipeline
45+ # Unifying figure-only documents into one pipeline is not straightforward.
4646 # without a "FigurePaginationStrategy".
4747 # So we defer to a helper method similar to the old one.
4848 return self ._encode_figure_only (document )
@@ -114,7 +114,7 @@ def encode(self, document: Any) -> str:
114114
115115 # Handle case where no pages are generated (e.g. empty dataframe)
116116 if not pages :
117- # Create a single empty page to ensure document structure (title, etc.) is rendered
117+ # Create empty page to ensure document structure (title, etc.) is rendered.
118118 # We use processed_df which might be empty but has correct schema
119119 pages = [
120120 PageContext (
@@ -130,7 +130,7 @@ def encode(self, document: Any) -> str:
130130 ]
131131
132132 # Post-pagination fixup: Replace data with processed data (sliced correctly)
133- # The strategy used original_df for calculation , but we want to render processed_df
133+ # Strategy used original_df, but we render processed_df.
134134 # (which has removed columns).
135135 if is_single_body (document .rtf_body ):
136136 self ._apply_data_post_processing (pages , processed_df , document .rtf_body )
@@ -208,11 +208,11 @@ def _apply_data_post_processing(self, pages, processed_df, rtf_body):
208208 p .data = restored .slice (curr , rows )
209209 curr += rows
210210
211- def _encode_figure_only (self , document ):
211+ def _encode_figure_only (self , document : RTFDocument ):
212212 # (Legacy support for figure only)
213213 # For brevity, I will rely on the existing FigureService logic if possible
214214 # or just reproduce the simple loop.
215- # ... (Implementation omitted for brevity, would match PaginatedStrategy._encode_figure_only_document_with_pagination)
215+ # Matches PaginatedStrategy._encode_figure_only_document_with_pagination.
216216 # Since the user wants a WORKING system, I must implement it.
217217 from copy import deepcopy
218218
@@ -322,7 +322,7 @@ def _encode_figure_only(self, document):
322322 parts .append ("\n \n }" )
323323 return "" .join ([p for p in parts if p ])
324324
325- def _encode_multi_section (self , document : " RTFDocument" ) -> str :
325+ def _encode_multi_section (self , document : RTFDocument ) -> str :
326326 """Encode a multi-section document where sections are concatenated row by row.
327327
328328 Args:
0 commit comments