Skip to content

Commit 70ad4d6

Browse files
adamtheturtlepgjones
authored andcommitted
Use more precise type for formparser.MultiPartParser.parse return
Without this change, `pyright` with `typeCheckingMode` set to `strict` reports: ``` error: Type of "fields" is partially unknown Type of "fields" is "MultiDict[Unknown, Unknown]" (reportUnknownVariableType) ``` when I use this method.
1 parent 6eafc0e commit 70ad4d6

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGES.rst

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
.. currentmodule:: werkzeug
22

3+
Version 3.0.2
4+
-------------
5+
6+
Unreleased
7+
8+
- Make the return type of ``MultiPartParser.parse`` more
9+
precise. :issue:`2840`
10+
311
Version 3.0.1
412
-------------
513

src/werkzeug/formparser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def start_file_streaming(
352352

353353
def parse(
354354
self, stream: t.IO[bytes], boundary: bytes, content_length: int | None
355-
) -> tuple[MultiDict, MultiDict]:
355+
) -> tuple[MultiDict[str, str], MultiDict[str, FileStorage]]:
356356
current_part: Field | File
357357
container: t.IO[bytes] | list[bytes]
358358
_write: t.Callable[[bytes], t.Any]

0 commit comments

Comments
 (0)