Skip to content

Commit

Permalink
Use more precise type for formparser.MultiPartParser.parse return
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
adamtheturtle authored and pgjones committed Feb 29, 2024
1 parent 6eafc0e commit ccf4255
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
.. currentmodule:: werkzeug

Version 3.0.2
-------------

- Make the return type of ``MultiPartParser.parse`` more precise. :issue:`2840`

Version 3.0.1
-------------

Expand Down
2 changes: 1 addition & 1 deletion src/werkzeug/formparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def start_file_streaming(

def parse(
self, stream: t.IO[bytes], boundary: bytes, content_length: int | None
) -> tuple[MultiDict, MultiDict]:
) -> tuple[MultiDict[str, str], MultiDict[str, FileStorage]]:
current_part: Field | File
container: t.IO[bytes] | list[bytes]
_write: t.Callable[[bytes], t.Any]
Expand Down

0 comments on commit ccf4255

Please sign in to comment.