Closed semberal closed 2 years ago
This package provides no type annotations, so pylance is attempting to infer type information from the sources through static analysis. A static analyzer won't be able to predict dynamic behaviors like the one you described above. The library appears to be dynamically manipulating the global variables in its module namespace.
If this library is important to you, I recommend contacting the maintainers and encouraging them to provide type annotations. This will improve the developer experience for users of the library. Library maintainers can refer to this guidance.
To fix this particular issue, a minimal type annotation on open
would suffice.
def open(*args, **kwargs) -> typing.Any: ...
Hello,
valid code using the foundationdb module is being marked as unreachable by Pylance:
fdb.open()
by default raises an error untilfdb.api_version(version)
is called, which modifies the behavior of some global methods likeopen()
. Pylance seems not to understand this and marks all code belowopen()
as unreachable.Versions
Pylance extension: v2022.1.3 Python extension: v2021.12.1559732655 Python: 3.9.9
foundationdb
pip package: 6.3.23