Skip to content

pyright in strict mode errors when using formparser.MultiPartParser.parse #2840

@adamtheturtle

Description

@adamtheturtle

I have a file which includes code like:

from werkzeug.formparser import MultiPartParser

parser = MultiPartParser()
fields, files = parser.parse(
    stream=io.BytesIO(b"foo"),
    boundary=boundary.encode("utf-8"),
    content_length=len(b"foo"),
 )

I have the following configuration in pyproject.toml:

[tool.pyright]
typeCheckingMode = "strict"

pyright reports:

error: Type of "fields" is partially unknown
    Type of "fields" is "MultiDict[Unknown, Unknown]" (reportUnknownVariableType)

Environment:

  • Python version: 3.12
  • Werkzeug version: 3.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions