Skip to content

TypeConversionDict.get has incomplete type annotations #2169

@teskje

Description

@teskje

The following code should successfully type check:

from werkzeug.datastructures import TypeConversionDict

d: TypeConversionDict[str, str] = TypeConversionDict()
x: int = d.get("a", default=1, type=int)

However, mypy gives an error:

$ mypy test.py
test.py:4: error: Incompatible types in assignment (expression has type "Optional[int]", variable has type "int")
Found 1 error in 1 file (checked 1 source file)

Environment:

  • Python version: 3.8.5
  • Werkzeug version: 2.1.0.dev0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions