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
The type of function's parameters and return will normally display (screenshot from util.pyi):
Actual behavior
The type of function's parameters and return displayed Unknown, unless the Pylance deduced them type from the code, like this (screenshot from util.py):
@nukemiko you get Unknown in verify_readable because you put IO which is generic type without type argument.
ex) def verify_readable(fileobj: IO[str], is_binaryio: bool = ...) -> None:
in non-strict mode, we will implicitly put Any as type argument, ex) IO[Any], but in strict mode, we won't do such implicit thing for you, so that's why you get "Unknown"
also, the reason you get unknown from utils.py is because it doesn't have type annotation. we don't merge type info even if you have pyi file for associated py file.
ex) utils.pyi type info won't be merged to utils.py.
the type info in utils.pyi will be used when symbols in utils are used in other file.
ex) foo.py using utils by "import utils"
if you want the effect of merging, best way is just inlining type annotation in utils.py rather than having separate pyi file.
Environment data
Expected behavior
util.pyi
):Actual behavior
Unknown
, unless the Pylance deduced them type from the code, like this (screenshot fromutil.py
):Logs
I put it in the pastebin: https://pst.klgrth.io/paste/hogqcwwcfej7jjdg3yhr5bbf
Code Snippet / Additional information
utils.py
:utils.pyi
:And the project files: test-project.zip
The text was updated successfully, but these errors were encountered: