Closed amisadmin closed 2 years ago
Hi,
not sure what you mean by
The type '_T' has been defined as the 'Union[Connection, Engine]' type in the 'Session' class.
_T is a free typevar so it can take any value
Note that I'm not against merging this, since it should not have any unexpected side effect, just trying to understand the rationale
Hi,
not sure what you mean by
The type '_T' has been defined as the 'Union[Connection, Engine]' type in the 'Session' class.
_T is a free typevar so it can take any value
Note that I'm not against merging this, since it should not have any unexpected side effect, just trying to understand the rationale
The Session
class inherits from the _SessionNoIoTypingCommon(Generic[_T])
Generic class. And when we defined _SessionTypingCommon
, we already bound _T
to the Union[Connection, Engine]
type. So, in the _SessionTypingCommon
class and its subclasses, _T
is of type Union[Connection, Engine]
.
I tested the previous source and found that _T
gets the correct inferred type in VSCode
but gets the wrong inferred type in Pycharm
.
I tested the previous source and found that
_T
gets the correct inferred type inVSCode
but gets the wrong inferred type inPycharm
.
Ok, so this is a pycharm quirk. Thanks for clarifying.
The type '_T' has been defined as the 'Union[Connection, Engine]' type in the 'Session' class.
Description
Checklist
This pull request is:
Fixes: #<issue number>
in the commit messageFixes: #<issue number>
in the commit messageHave a nice day!