]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
typing updates
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 19 Jan 2023 20:34:46 +0000 (15:34 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 20 Jan 2023 14:13:58 +0000 (09:13 -0500)
commitd1eeef5e67fa4632f88a894f0c5cf4445f04ba2b
tree30f2ad05dbf45bb2aa5dc33502a24cbdc5281097
parente82a5f19e1606500ad4bf6a456c2558d74df24bf
typing updates

The :meth:`_sql.ColumnOperators.in_` and
:meth:`_sql.ColumnOperators.not_in_` are typed to include
``Iterable[Any]`` rather than ``Sequence[Any]`` for more flexibility in
argument type.

The :func:`_sql.or_` and :func:`_sql.and_` from a typing perspective
require the first argument to be present, however these functions still
accept zero arguments which will emit a deprecation warning at runtime.
Typing is also added to support sending the fixed literal ``False`` for
:func:`_sql.or_` and ``True`` for :func:`_sql.and_` as the first argument
only, however the documentation now indicates sending the
:func:`_sql.false` and :func:`_sql.true` constructs in these cases as a
more explicit approach.

Fixed typing issue where iterating over a :class:`_orm.Query` object
was not correctly typed.

Fixes: #9122
Fixes: #9123
Fixes: #9125
Change-Id: I500e3e1b826717b3dd49afa1e682c3c8279c9226
doc/build/changelog/unreleased_20/more_typing.rst [new file with mode: 0644]
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/sql/_elements_constructors.py
lib/sqlalchemy/sql/coercions.py
lib/sqlalchemy/sql/elements.py
test/ext/mypy/plain_files/session.py
test/ext/mypy/plain_files/sql_operations.py
test/sql/test_deprecations.py
test/sql/test_operators.py