Skip to content
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

TypeConversionDict.get has incomplete type annotations #2169

Closed
teskje opened this issue Jun 22, 2021 · 0 comments
Closed

TypeConversionDict.get has incomplete type annotations #2169

teskje opened this issue Jun 22, 2021 · 0 comments
Labels
Milestone

Comments

@teskje
Copy link
Contributor

teskje commented Jun 22, 2021

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
@davidism davidism added this to the 2.0.2 milestone Aug 6, 2021
@davidism davidism added the typing label Aug 6, 2021
@davidism davidism closed this as completed Aug 6, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants