-
Notifications
You must be signed in to change notification settings - Fork 1.5k
STY: Remove variable check_crlf_space #3096
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3096 +/- ##
==========================================
- Coverage 96.60% 96.60% -0.01%
==========================================
Files 53 53
Lines 8979 8974 -5
Branches 1659 1659
==========================================
- Hits 8674 8669 -5
Misses 183 183
Partials 122 122 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Doesn't this decrease readability/overview? |
Whether to |
pypdf/_page.py
Outdated
@@ -2043,7 +2041,7 @@ def process_operation(operator: bytes, operands: List[Any]) -> None: | |||
else: | |||
return | |||
|
|||
if check_crlf_space: | |||
if operator in ( b"Td", b"Tm", b"T*", b"Tj"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a superfluous whitespace here. Additionally: Will operator
always be a primitive type which would allow converting the right-hand side to a set for faster lookups?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from this line they are always bytes literals:
Line 2143 in 3c72462
process_operation(operator, operands) |
operator
comes from content.operations
:
Line 2068 in 3c72462
for operands, operator in content.operations: |
content
comes from:
Lines 1863 to 1867 in 3c72462
content = ( | |
obj[content_key].get_object() if isinstance(content_key, str) else obj | |
) | |
if not isinstance(content, ContentStream): | |
content = ContentStream(content, pdf, "bytes") |
operator is stored as bytes in ContentStream
:
pypdf/pypdf/generic/_data_structures.py
Line 1166 in 3c72462
self._operations: List[Tuple[Any, bytes]] = [] |
So operator
will always be a primitive type (bytes).
No description provided.