-
Notifications
You must be signed in to change notification settings - Fork 626
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
Add type hints to psycopg
#3067
base: main
Are you sure you want to change the base?
Conversation
Is it a docstring error? |
ConnectionT = TypeVar( | ||
"ConnectionT", psycopg.Connection, psycopg.AsyncConnection | ||
) | ||
CursorT = TypeVar("CursorT", psycopg.Cursor, psycopg.AsyncCursor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to make sure that the output value of a function that accepts ConnectionT
is also a ConnectionT
... Doing what I'm doing here, I'm telling the type checker if the class is a psycopg.Connection
, the output will be a psycopg.Connection
. That's why we don't use Union
s here.
Anything I can do to speed up the review process here? @xrmx |
opentelemetry-instrumentation-psycopg
claims to work for async queries, but doesn't record time #2486.