You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using Python 3.9, mypy will complain about static_folder being Optional[str] and not accepting a pathlib.Path.
note: Revealed type is "pathlib.Path*" # This is what I'm feeding it
Revealed type is "Union[builtins.str, None]" # this is reveal_path() for app.static_folder
error: Incompatible types in assignment (expression has type "Path", variable has type "Optional[str]")
Found 1 error in 1 file (checked 1 source file)
davidism
changed the title
flask 2.0.1 with Python 3.9 shows static_folder as str type, not pathlib.Path
static_folder shows str type, not pathlib.Path
Aug 6, 2021
Using Python 3.9, mypy will complain about static_folder being
Optional[str]
and not accepting apathlib.Path
.Not sure why Python 3.8 doesn't do this.
I think maybe here: https://github.com/pallets/flask/blob/main/src/flask/scaffold.py#L80
I think this needs to be
_static_folder: t.Union[t.Optional[str], Path] = None
Or maybe...
_static_folder: t.Optional[t.Union[str, Path]] = None
And at the top:
from pathlib import Path
Thank you!
The text was updated successfully, but these errors were encountered: