Skip to content

Commit 51d2bc0

Browse files
committed
fix linting issues identified by ruff
1 parent 1859a1e commit 51d2bc0

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

src/rtflite/encoding/strategies.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,8 @@ def encode(self, document: "RTFDocument") -> str:
10251025
page_elements.extend(header_elements)
10261026

10271027
# Add page_by spanning table row after headers if specified
1028-
# Only if pageby_row is not 'column' (which keeps the column instead of spanning row)
1028+
# Only if pageby_row is not 'column'
1029+
# (which keeps the column instead of spanning row)
10291030
# OR if not new_page (legacy behavior implies spanning rows)
10301031
if page_info.get("pageby_header_info") and (
10311032
not document.rtf_body.new_page

src/rtflite/services/document_service.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,8 @@ def apply_pagination_borders(
329329
and document.rtf_body.border_first
330330
):
331331
# Apply border_first to first data row, respecting per-column settings
332-
# Only use border_top if it has non-empty values; empty means use border_first
332+
# Only use border_top if it has non-empty values;
333+
# empty means use border_first
333334
if isinstance(document.rtf_body.border_first, list):
334335
border_first_row = document.rtf_body.border_first[0]
335336
has_border_top = (
@@ -345,7 +346,8 @@ def apply_pagination_borders(
345346
else:
346347
border_style = border_first_row[0]
347348

348-
# Only override with border_top if it has a non-empty value for this column
349+
# Only override with border_top if it has a non-empty value
350+
# for this column
349351
if (
350352
has_border_top
351353
and col_idx < len(document.rtf_body.border_top[0])
@@ -370,8 +372,10 @@ def apply_pagination_borders(
370372

371373
# Apply page-level borders for non-first/last pages
372374
if not page_info["is_first_page"] and document.rtf_body.border_first:
373-
# Apply border_first to first row of non-first pages, respecting per-column settings
374-
# Only use border_top if it has non-empty values; empty means use border_first
375+
# Apply border_first to first row of non-first pages,
376+
# respecting per-column settings
377+
# Only use border_top if it has non-empty values;
378+
# empty means use border_first
375379
if isinstance(document.rtf_body.border_first, list):
376380
border_first_row = document.rtf_body.border_first[0]
377381
has_border_top = (
@@ -387,7 +391,8 @@ def apply_pagination_borders(
387391
else:
388392
border_style = border_first_row[0]
389393

390-
# Only override with border_top if it has a non-empty value for this column
394+
# Only override with border_top if it has a non-empty value
395+
# for this column
391396
if (
392397
has_border_top
393398
and col_idx < len(document.rtf_body.border_top[0])

src/rtflite/services/encoding_service.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,13 @@ def prepare_dataframe_for_body_encoding(self, df, rtf_attrs):
368368

369369
# Remove page_by columns from table display
370370
# page_by columns are shown as spanning rows, not as table columns
371-
# The new_page flag only controls whether to force page breaks at group boundaries
371+
# The new_page flag only controls whether to force page breaks
372+
# at group boundaries
372373
if rtf_attrs.page_by is not None:
373374
# Restore previous behavior:
374375
# - If new_page=True: Respect pageby_row (default 'column' -> keep column)
375-
# - If new_page=False: Always remove columns (legacy behavior implies spanning rows)
376+
# - If new_page=False: Always remove columns (legacy behavior
377+
# implies spanning rows)
376378
if rtf_attrs.new_page:
377379
pageby_row = getattr(rtf_attrs, "pageby_row", "column")
378380
if pageby_row != "column":
@@ -389,12 +391,12 @@ def prepare_dataframe_for_body_encoding(self, df, rtf_attrs):
389391

390392
# Handle attribute slicing for removed columns
391393
# We need to slice list-based attributes to match the new column structure
392-
from copy import deepcopy
393394
from ..attributes import BroadcastValue
394395

395396
# Create a copy of attributes to modify
396397
# We use deepcopy to ensure nested lists are copied
397-
# model_copy(deep=True) is not sufficient for nested lists in Pydantic v2 sometimes
398+
# model_copy(deep=True) is not sufficient for nested lists in
399+
# Pydantic v2 sometimes
398400
processed_attrs = rtf_attrs.model_copy(deep=True)
399401

400402
# Get indices of removed columns in the original dataframe

0 commit comments

Comments
 (0)