lol
This commit is contained in:
@@ -117,6 +117,7 @@ _NUMERIC = Union[float, Decimal]
|
||||
_NUMBER = Union[float, int, Decimal]
|
||||
|
||||
_T = TypeVar("_T", bound="Any")
|
||||
_T_co = TypeVar("_T_co", bound=Any, covariant=True)
|
||||
_OPT = TypeVar("_OPT", bound="Any")
|
||||
_NT = TypeVar("_NT", bound="_NUMERIC")
|
||||
|
||||
@@ -804,7 +805,7 @@ class CompilerColumnElement(
|
||||
# SQLCoreOperations should be suiting the ExpressionElementRole
|
||||
# and ColumnsClauseRole. however the MRO issues become too elaborate
|
||||
# at the moment.
|
||||
class SQLCoreOperations(Generic[_T], ColumnOperators, TypingOnly):
|
||||
class SQLCoreOperations(Generic[_T_co], ColumnOperators, TypingOnly):
|
||||
__slots__ = ()
|
||||
|
||||
# annotations for comparison methods
|
||||
@@ -873,7 +874,7 @@ class SQLCoreOperations(Generic[_T], ColumnOperators, TypingOnly):
|
||||
def __or__(self, other: Any) -> BooleanClauseList:
|
||||
...
|
||||
|
||||
def __invert__(self) -> ColumnElement[_T]:
|
||||
def __invert__(self) -> ColumnElement[_T_co]:
|
||||
...
|
||||
|
||||
def __lt__(self, other: Any) -> ColumnElement[bool]:
|
||||
@@ -882,6 +883,13 @@ class SQLCoreOperations(Generic[_T], ColumnOperators, TypingOnly):
|
||||
def __le__(self, other: Any) -> ColumnElement[bool]:
|
||||
...
|
||||
|
||||
# declare also that this class has an hash method otherwise
|
||||
# it may be assumed to be None by type checkers since the
|
||||
# object defines __eq__ and python sets it to None in that case:
|
||||
# https://docs.python.org/3/reference/datamodel.html#object.__hash__
|
||||
def __hash__(self) -> int:
|
||||
...
|
||||
|
||||
def __eq__(self, other: Any) -> ColumnElement[bool]: # type: ignore[override] # noqa: E501
|
||||
...
|
||||
|
||||
@@ -900,7 +908,7 @@ class SQLCoreOperations(Generic[_T], ColumnOperators, TypingOnly):
|
||||
def __ge__(self, other: Any) -> ColumnElement[bool]:
|
||||
...
|
||||
|
||||
def __neg__(self) -> UnaryExpression[_T]:
|
||||
def __neg__(self) -> UnaryExpression[_T_co]:
|
||||
...
|
||||
|
||||
def __contains__(self, other: Any) -> ColumnElement[bool]:
|
||||
@@ -961,7 +969,7 @@ class SQLCoreOperations(Generic[_T], ColumnOperators, TypingOnly):
|
||||
def bitwise_and(self, other: Any) -> BinaryExpression[Any]:
|
||||
...
|
||||
|
||||
def bitwise_not(self) -> UnaryExpression[_T]:
|
||||
def bitwise_not(self) -> UnaryExpression[_T_co]:
|
||||
...
|
||||
|
||||
def bitwise_lshift(self, other: Any) -> BinaryExpression[Any]:
|
||||
@@ -1074,22 +1082,22 @@ class SQLCoreOperations(Generic[_T], ColumnOperators, TypingOnly):
|
||||
) -> ColumnElement[str]:
|
||||
...
|
||||
|
||||
def desc(self) -> UnaryExpression[_T]:
|
||||
def desc(self) -> UnaryExpression[_T_co]:
|
||||
...
|
||||
|
||||
def asc(self) -> UnaryExpression[_T]:
|
||||
def asc(self) -> UnaryExpression[_T_co]:
|
||||
...
|
||||
|
||||
def nulls_first(self) -> UnaryExpression[_T]:
|
||||
def nulls_first(self) -> UnaryExpression[_T_co]:
|
||||
...
|
||||
|
||||
def nullsfirst(self) -> UnaryExpression[_T]:
|
||||
def nullsfirst(self) -> UnaryExpression[_T_co]:
|
||||
...
|
||||
|
||||
def nulls_last(self) -> UnaryExpression[_T]:
|
||||
def nulls_last(self) -> UnaryExpression[_T_co]:
|
||||
...
|
||||
|
||||
def nullslast(self) -> UnaryExpression[_T]:
|
||||
def nullslast(self) -> UnaryExpression[_T_co]:
|
||||
...
|
||||
|
||||
def collate(self, collation: str) -> CollationClause:
|
||||
@@ -1100,7 +1108,7 @@ class SQLCoreOperations(Generic[_T], ColumnOperators, TypingOnly):
|
||||
) -> BinaryExpression[bool]:
|
||||
...
|
||||
|
||||
def distinct(self: _SQO[_T]) -> UnaryExpression[_T]:
|
||||
def distinct(self: _SQO[_T_co]) -> UnaryExpression[_T_co]:
|
||||
...
|
||||
|
||||
def any_(self) -> CollectionAggregate[Any]:
|
||||
@@ -1128,19 +1136,11 @@ class SQLCoreOperations(Generic[_T], ColumnOperators, TypingOnly):
|
||||
) -> ColumnElement[str]:
|
||||
...
|
||||
|
||||
@overload
|
||||
def __add__(self, other: Any) -> ColumnElement[Any]:
|
||||
...
|
||||
|
||||
def __add__(self, other: Any) -> ColumnElement[Any]:
|
||||
...
|
||||
|
||||
@overload
|
||||
def __radd__(self: _SQO[_NT], other: Any) -> ColumnElement[_NT]:
|
||||
...
|
||||
|
||||
@overload
|
||||
def __radd__(self: _SQO[int], other: Any) -> ColumnElement[int]:
|
||||
def __radd__(self: _SQO[_NMT], other: Any) -> ColumnElement[_NMT]:
|
||||
...
|
||||
|
||||
@overload
|
||||
@@ -1282,7 +1282,7 @@ class SQLCoreOperations(Generic[_T], ColumnOperators, TypingOnly):
|
||||
|
||||
|
||||
class SQLColumnExpression(
|
||||
SQLCoreOperations[_T], roles.ExpressionElementRole[_T], TypingOnly
|
||||
SQLCoreOperations[_T_co], roles.ExpressionElementRole[_T_co], TypingOnly
|
||||
):
|
||||
"""A type that may be used to indicate any SQL column element or object
|
||||
that acts in place of one.
|
||||
@@ -1613,12 +1613,12 @@ class ColumnElement(
|
||||
*other: Any,
|
||||
**kwargs: Any,
|
||||
) -> ColumnElement[Any]:
|
||||
return op(self.comparator, *other, **kwargs) # type: ignore[return-value,no-any-return] # noqa: E501
|
||||
return op(self.comparator, *other, **kwargs) # type: ignore[no-any-return] # noqa: E501
|
||||
|
||||
def reverse_operate(
|
||||
self, op: operators.OperatorType, other: Any, **kwargs: Any
|
||||
) -> ColumnElement[Any]:
|
||||
return op(other, self.comparator, **kwargs) # type: ignore[return-value,no-any-return] # noqa: E501
|
||||
return op(other, self.comparator, **kwargs) # type: ignore[no-any-return] # noqa: E501
|
||||
|
||||
def _bind_param(
|
||||
self,
|
||||
@@ -3132,7 +3132,7 @@ class BooleanClauseList(ExpressionClauseList[bool]):
|
||||
}, *args)'.""",
|
||||
version="1.4",
|
||||
)
|
||||
return cls._construct_raw(operator) # type: ignore[no-any-return]
|
||||
return cls._construct_raw(operator)
|
||||
|
||||
lcc, convert_clauses = cls._process_clauses_for_boolean(
|
||||
operator,
|
||||
@@ -3162,7 +3162,7 @@ class BooleanClauseList(ExpressionClauseList[bool]):
|
||||
assert lcc
|
||||
# just one element. return it as a single boolean element,
|
||||
# not a list and discard the operator.
|
||||
return convert_clauses[0] # type: ignore[no-any-return] # noqa: E501
|
||||
return convert_clauses[0]
|
||||
|
||||
@classmethod
|
||||
def _construct_for_whereclause(
|
||||
@@ -4182,7 +4182,7 @@ class Over(ColumnElement[_T]):
|
||||
|
||||
element: ColumnElement[_T]
|
||||
"""The underlying expression object to which this :class:`.Over`
|
||||
object refers towards."""
|
||||
object refers."""
|
||||
|
||||
range_: Optional[typing_Tuple[int, int]]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user