-
Notifications
You must be signed in to change notification settings - Fork 73
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
connect
& connect_async
typing
#438
Comments
Thanks for the details. I'll let @cjbj comment on whether he would like your assistance with this issue. Can you, however, share some details on how the current code fails? A quick test with mypy doesn't reveal any concerns, so I must be missing something! |
Two points:
|
Hello @anthony-tuininga, here is a minimal script: from typing import TYPE_CHECKING, Any
import oracledb
def get_connection() -> oracledb.Connection:
conn_params: dict[str, Any] = {}
return oracledb.connect(**conn_params)
def get_async_connection() -> oracledb.AsyncConnection:
conn_params: dict[str, Any] = {}
return oracledb.connect_async(**conn_params)
if TYPE_CHECKING:
reveal_type(oracledb.connect)
reveal_type(oracledb.connect_async) The output of
Using
@cjbj I have just signed the OCA, it is marked as "Under review" :) |
Actually, testing in local there is no need for |
Hello, when using the methods
connect
orconnect_async
, the return types are lost because of the untyped decorators_async_connection_factory
and_connection_factory
.The fix includes the adding of a
TypeVar
and aParamSpec
to make them coherent with the wrapped callables. This will be usable for all platforms and Python versions >=3.8, usingtyping_extensions
for python < 3.10.I can tackle the issue if needed :)
The text was updated successfully, but these errors were encountered: