MAINT: Enforce PLW2901 (avoid loop/context var overwrite)#3513
MAINT: Enforce PLW2901 (avoid loop/context var overwrite)#3513dev-KingMaster wants to merge 16 commits intopy-pdf:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3513 +/- ##
=======================================
Coverage 97.11% 97.11%
=======================================
Files 57 57
Lines 9713 9714 +1
Branches 1758 1756 -2
=======================================
+ Hits 9433 9434 +1
Misses 168 168
Partials 112 112 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
stefan6419846
left a comment
There was a problem hiding this comment.
Thanks for the PR. I have left some remarks for specific changes and some general ones.
|
Hi @stefan6419846 I addressed all the comments. |
| if isinstance(params, NullObject): | ||
| params = {} | ||
| for filter_name, params_untyped in zip(filters, decode_parms): | ||
| params_typed: Optional[DictionaryObject] = None |
There was a problem hiding this comment.
Why not params directly to reduce the diff?
There was a problem hiding this comment.
It seems like you misunderstood me here: I meant to use params_untyped as the loop variable and params as the name for the typed one.
There was a problem hiding this comment.
Ah, got it. Fixed this now
|
Resolved all comments. @stefan6419846 |
| # CID fonts have a /W array mapping character codes to widths stashed in /DescendantFonts | ||
| if "/DescendantFonts" in self.font_dictionary: | ||
| d_font: dict[Any, Any] | ||
| d_font: Any |
There was a problem hiding this comment.
Why do we need this change?
There was a problem hiding this comment.
mypy flagged "dict[Any, Any]" has no attribute "get_object".
There was a problem hiding this comment.
Then you should probably make this a DictionaryObject or PdfObject.
There was a problem hiding this comment.
Okay, added PdfObject for that
|
Addressed comments. @stefan6419846 |
| data = JBIG2Decode.decode(data, params) | ||
| elif filter_name == "/Crypt": | ||
| if "/Name" in params or "/Type" in params: | ||
| if "/Name" in params_untyped or "/Type" in params_untyped: |
There was a problem hiding this comment.
Why untyped? Couldn't we just keep params here, which makes it even more obvious as it is a dictionary object?
Summary
Contribution by Gittensor, learn more at https://gittensor.io/