# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
-
"""SQL function API, factories, and built-in functions."""
from __future__ import annotations
clause_expr: Grouping[Any]
- def __init__(self, *clauses: _ColumnExpressionOrLiteralArgument[Any]):
+ def __init__(
+ self, *clauses: _ColumnExpressionOrLiteralArgument[Any]
+ ) -> None:
r"""Construct a :class:`.FunctionElement`.
:param \*clauses: list of column expressions that form the arguments
def __init__(
self, fn: FunctionElement[Any], left_index: int, right_index: int
- ):
+ ) -> None:
self.sql_function = fn
self.left_index = left_index
self.right_index = right_index
fn: FunctionElement[_T],
name: str,
type_: Optional[_TypeEngineArgument[_T]] = None,
- ):
+ ) -> None:
self.fn = fn
self.name = name
""" # noqa
- def __init__(self, **opts: Any):
+ def __init__(self, **opts: Any) -> None:
self.__names: List[str] = []
self.opts = opts
@property
def ansifunction(self) -> Type[AnsiFunction[Any]]: ...
- # set ColumnElement[_T] as a separate overload, to appease mypy
- # which seems to not want to accept _T from _ColumnExpressionArgument.
- # this is even if all non-generic types are removed from it, so
- # reasons remain unclear for why this does not work
+ # set ColumnElement[_T] as a separate overload, to appease
+ # mypy which seems to not want to accept _T from
+ # _ColumnExpressionArgument. Seems somewhat related to the covariant
+ # _HasClauseElement as of mypy 1.15
@overload
def array_agg(
@overload
def array_agg(
self,
- col: _ColumnExpressionOrLiteralArgument[_T],
+ col: _T,
*args: _ColumnExpressionOrLiteralArgument[Any],
**kwargs: Any,
) -> array_agg[_T]: ...
@property
def char_length(self) -> Type[char_length]: ...
- # set ColumnElement[_T] as a separate overload, to appease mypy
- # which seems to not want to accept _T from _ColumnExpressionArgument.
- # this is even if all non-generic types are removed from it, so
- # reasons remain unclear for why this does not work
+ # set ColumnElement[_T] as a separate overload, to appease
+ # mypy which seems to not want to accept _T from
+ # _ColumnExpressionArgument. Seems somewhat related to the covariant
+ # _HasClauseElement as of mypy 1.15
@overload
def coalesce(
@overload
def coalesce(
self,
- col: _ColumnExpressionOrLiteralArgument[_T],
+ col: _T,
*args: _ColumnExpressionOrLiteralArgument[Any],
**kwargs: Any,
) -> coalesce[_T]: ...
@property
def localtimestamp(self) -> Type[localtimestamp]: ...
- # set ColumnElement[_T] as a separate overload, to appease mypy
- # which seems to not want to accept _T from _ColumnExpressionArgument.
- # this is even if all non-generic types are removed from it, so
- # reasons remain unclear for why this does not work
+ # set ColumnElement[_T] as a separate overload, to appease
+ # mypy which seems to not want to accept _T from
+ # _ColumnExpressionArgument. Seems somewhat related to the covariant
+ # _HasClauseElement as of mypy 1.15
@overload
def max( # noqa: A001
@overload
def max( # noqa: A001
self,
- col: _ColumnExpressionOrLiteralArgument[_T],
+ col: _T,
*args: _ColumnExpressionOrLiteralArgument[Any],
**kwargs: Any,
) -> max[_T]: ...
**kwargs: Any,
) -> max[_T]: ...
- # set ColumnElement[_T] as a separate overload, to appease mypy
- # which seems to not want to accept _T from _ColumnExpressionArgument.
- # this is even if all non-generic types are removed from it, so
- # reasons remain unclear for why this does not work
+ # set ColumnElement[_T] as a separate overload, to appease
+ # mypy which seems to not want to accept _T from
+ # _ColumnExpressionArgument. Seems somewhat related to the covariant
+ # _HasClauseElement as of mypy 1.15
@overload
def min( # noqa: A001
@overload
def min( # noqa: A001
self,
- col: _ColumnExpressionOrLiteralArgument[_T],
+ col: _T,
*args: _ColumnExpressionOrLiteralArgument[Any],
**kwargs: Any,
) -> min[_T]: ...
@property
def session_user(self) -> Type[session_user]: ...
- # set ColumnElement[_T] as a separate overload, to appease mypy
- # which seems to not want to accept _T from _ColumnExpressionArgument.
- # this is even if all non-generic types are removed from it, so
- # reasons remain unclear for why this does not work
+ # set ColumnElement[_T] as a separate overload, to appease
+ # mypy which seems to not want to accept _T from
+ # _ColumnExpressionArgument. Seems somewhat related to the covariant
+ # _HasClauseElement as of mypy 1.15
@overload
def sum( # noqa: A001
@overload
def sum( # noqa: A001
self,
- col: _ColumnExpressionOrLiteralArgument[_T],
+ col: _T,
*args: _ColumnExpressionOrLiteralArgument[Any],
**kwargs: Any,
) -> sum[_T]: ...
*clauses: _ColumnExpressionOrLiteralArgument[_T],
type_: None = ...,
packagenames: Optional[Tuple[str, ...]] = ...,
- ): ...
+ ) -> None: ...
@overload
def __init__(
*clauses: _ColumnExpressionOrLiteralArgument[Any],
type_: _TypeEngineArgument[_T] = ...,
packagenames: Optional[Tuple[str, ...]] = ...,
- ): ...
+ ) -> None: ...
def __init__(
self,
*clauses: _ColumnExpressionOrLiteralArgument[Any],
type_: Optional[_TypeEngineArgument[_T]] = None,
packagenames: Optional[Tuple[str, ...]] = None,
- ):
+ ) -> None:
"""Construct a :class:`.Function`.
The :data:`.func` construct is normally used to construct
def __init__(
self, *args: _ColumnExpressionOrLiteralArgument[Any], **kwargs: Any
- ):
+ ) -> None:
parsed_args = kwargs.pop("_parsed_args", None)
if parsed_args is None:
parsed_args = [
("sequence", InternalTraversal.dp_named_ddl_element)
]
- def __init__(self, seq: schema.Sequence, **kw: Any):
+ def __init__(self, seq: schema.Sequence, **kw: Any) -> None:
assert isinstance(
seq, schema.Sequence
), "next_value() accepts a Sequence object as input."
inherit_cache = True
- def __init__(self, *args: _ColumnExpressionArgument[Any], **kwargs: Any):
+ def __init__(
+ self, *args: _ColumnExpressionArgument[Any], **kwargs: Any
+ ) -> None:
GenericFunction.__init__(self, *args, **kwargs)
inherit_cache = True
- # set ColumnElement[_T] as a separate overload, to appease mypy which seems
- # to not want to accept _T from _ColumnExpressionArgument. this is even if
- # all non-generic types are removed from it, so reasons remain unclear for
- # why this does not work
+ # set ColumnElement[_T] as a separate overload, to appease
+ # mypy which seems to not want to accept _T from
+ # _ColumnExpressionArgument. Seems somewhat related to the covariant
+ # _HasClauseElement as of mypy 1.15
@overload
def __init__(
col: ColumnElement[_T],
*args: _ColumnExpressionOrLiteralArgument[Any],
**kwargs: Any,
- ): ...
+ ) -> None: ...
@overload
def __init__(
col: _ColumnExpressionArgument[_T],
*args: _ColumnExpressionOrLiteralArgument[Any],
**kwargs: Any,
- ): ...
+ ) -> None: ...
@overload
def __init__(
self,
- col: _ColumnExpressionOrLiteralArgument[_T],
+ col: _T,
*args: _ColumnExpressionOrLiteralArgument[Any],
**kwargs: Any,
- ): ...
+ ) -> None: ...
def __init__(
- self, *args: _ColumnExpressionOrLiteralArgument[Any], **kwargs: Any
- ):
+ self, *args: _ColumnExpressionOrLiteralArgument[_T], **kwargs: Any
+ ) -> None:
fn_args: Sequence[ColumnElement[Any]] = [
coercions.expect(
roles.ExpressionElementRole,
type = sqltypes.Integer()
inherit_cache = True
- def __init__(self, arg: _ColumnExpressionArgument[str], **kw: Any):
+ def __init__(self, arg: _ColumnExpressionArgument[str], **kw: Any) -> None:
# slight hack to limit to just one positional argument
# not sure why this one function has this special treatment
super().__init__(arg, **kw)
_ColumnExpressionArgument[Any], _StarOrOne, None
] = None,
**kwargs: Any,
- ):
+ ) -> None:
if expression is None:
expression = literal_column("*")
super().__init__(expression, **kwargs)
inherit_cache = True
- def __init__(self, *args: _ColumnExpressionArgument[Any], **kwargs: Any):
+ def __init__(
+ self, *args: _ColumnExpressionArgument[Any], **kwargs: Any
+ ) -> None:
fn_args: Sequence[ColumnElement[Any]] = [
coercions.expect(
roles.ExpressionElementRole, c, apply_propagate_attrs=self
_has_args = True
inherit_cache = True
- def __init__(self, clause: _ColumnExpressionArgument[Any], separator: str):
+ def __init__(
+ self, clause: _ColumnExpressionArgument[Any], separator: str
+ ) -> None:
super().__init__(clause, separator)