]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
apply pep-612 to hybrid_method; accept SQLCoreOperations
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 15 Jan 2023 03:24:36 +0000 (22:24 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 15 Jan 2023 03:36:22 +0000 (22:36 -0500)
commit67c1c018f571fbbcf070c4e0637f36d9533c86d7
tree61ef98ec5b20447713ec36a740fb0f5f0d7c0351
parente07130c597422d5f9a5d734e1411d8fef0c2deff
apply pep-612 to hybrid_method; accept SQLCoreOperations

Fixes to the annotations within the ``sqlalchemy.ext.hybrid`` extension for
more effective typing of user-defined methods. The typing now uses
:pep:`612` features, now supported by recent versions of Mypy, to maintain
argument signatures for :class:`.hybrid_method`. Return values for hybrid
methods are accepted as SQL expressions in contexts such as
:meth:`_sql.Select.where` while still supporting SQL methods.

Fixes: #9096
Change-Id: Id4e3a38ec50e415220dfc5f022281b11bb262469
doc/build/changelog/unreleased_20/9096.rst [new file with mode: 0644]
lib/sqlalchemy/ext/hybrid.py
lib/sqlalchemy/sql/_typing.py
test/ext/mypy/plain_files/hybrid_one.py