pdf: remove StickyHeaderTable tags before PDF generation (#22970)#22998
Conversation
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a new helper function 'remove_sticky_header_table' in 'scripts/merge_by_toc.py' to strip '' tags for PDF output. The review feedback suggests refactoring the list and string empty checks in this function to be more idiomatic and compliant with PEP 8 guidelines.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| prev_blank = len(result) > 0 and result[-1].strip() == '' | ||
| next_blank = i + 1 < len(lines) and lines[i + 1].strip() == '' |
There was a problem hiding this comment.
In Python, empty sequences are implicitly false. We can simplify len(result) > 0 to just result. Additionally, checking if a string is empty after stripping can be written more idiomatically using not string.strip() per PEP 8 guidelines.
| prev_blank = len(result) > 0 and result[-1].strip() == '' | |
| next_blank = i + 1 < len(lines) and lines[i + 1].strip() == '' | |
| prev_blank = result and not result[-1].strip() | |
| next_blank = i + 1 < len(lines) and not lines[i + 1].strip() |
References
- PEP 8: For sequences, (strings, lists, tuples), use the fact that empty sequences are false. (link)
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: qiancai The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This is an automated cherry-pick of #22970
What is changed, added or deleted? (Required)
<StickyHeaderTable>and</StickyHeaderTable>lines before PDF generation.Which TiDB version(s) do your changes apply to? (Required)
What is the related PR or file link(s)?
Do your changes match any of the following descriptions?