-
Notifications
You must be signed in to change notification settings - Fork 1.5k
MAINT: Enforce PLW2901 (avoid loop/context var overwrite) #3513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 11 commits
ff2509a
12353fd
6da4f06
b1bee72
ca1e7ef
e33d82a
e385405
66157a2
412599b
bdbabf1
320d53d
04f1365
e79a99f
a63fb4c
a233371
d1e8189
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -760,27 +760,28 @@ def decode_stream_data(stream: Any) -> bytes: | |
| if not data: | ||
| return data | ||
| for filter_name, params in zip(filters, decode_parms): | ||
| if isinstance(params, NullObject): | ||
| params = {} | ||
| params_typed: Optional[DictionaryObject] = None | ||
|
||
| if not isinstance(params, NullObject): | ||
| params_typed = cast(Optional[DictionaryObject], params) | ||
| if filter_name in (FT.ASCII_HEX_DECODE, FTA.AHx): | ||
| data = ASCIIHexDecode.decode(data) | ||
| elif filter_name in (FT.ASCII_85_DECODE, FTA.A85): | ||
| data = ASCII85Decode.decode(data) | ||
| elif filter_name in (FT.LZW_DECODE, FTA.LZW): | ||
| data = LZWDecode.decode(data, params) | ||
| data = LZWDecode.decode(data, params_typed) | ||
| elif filter_name in (FT.FLATE_DECODE, FTA.FL): | ||
| data = FlateDecode.decode(data, params) | ||
| data = FlateDecode.decode(data, params_typed) | ||
| elif filter_name in (FT.RUN_LENGTH_DECODE, FTA.RL): | ||
| data = RunLengthDecode.decode(data) | ||
| elif filter_name == FT.CCITT_FAX_DECODE: | ||
| height = stream.get(IA.HEIGHT, ()) | ||
| data = CCITTFaxDecode.decode(data, params, height) | ||
| data = CCITTFaxDecode.decode(data, params_typed, height) | ||
| elif filter_name == FT.DCT_DECODE: | ||
| data = DCTDecode.decode(data) | ||
| elif filter_name == FT.JPX_DECODE: | ||
| data = JPXDecode.decode(data) | ||
| elif filter_name == FT.JBIG2_DECODE: | ||
| data = JBIG2Decode.decode(data, params) | ||
| data = JBIG2Decode.decode(data, params_typed) | ||
| elif filter_name == "/Crypt": | ||
| if "/Name" in params or "/Type" in params: | ||
| raise NotImplementedError( | ||
|
|
||
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.
Why do we need this change?
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.
mypy flagged "dict[Any, Any]" has no attribute "get_object".
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.
Then you should probably make this a
DictionaryObjectorPdfObject.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.
Okay, added PdfObject for that