]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
implement basic typing for lambda elements
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 19 Jan 2023 17:09:29 +0000 (12:09 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 19 Jan 2023 22:04:59 +0000 (17:04 -0500)
commitbe0831fea83247451628bc6643d5b130c63f6011
tree97036e708f073e91d7de6fc490cba06d14c1b142
parente82a5f19e1606500ad4bf6a456c2558d74df24bf
implement basic typing for lambda elements

These weren't working at all, so fixed things up and
added a test suite.   Keeping things very basic with Any
returns etc. as having more specific return types
starts making it too cumbersome to write end-user code.

Corrected the type passed for "lambda statements" so that a plain lambda is
accepted by mypy, pyright, others without any errors about argument types.
Additionally implemented typing for more of the public API for lambda
statements and ensured :class:`.StatementLambdaElement` is part of the
:class:`.Executable` hierarchy so it's typed as accepted by
:meth:`_engine.Connection.execute`.

Fixes: #9120
Change-Id: Ia7fa34e5b6e43fba02c8f94ccc256f3a68a1f445
doc/build/changelog/unreleased_20/9120.rst [new file with mode: 0644]
lib/sqlalchemy/sql/elements.py
lib/sqlalchemy/sql/lambdas.py
test/ext/mypy/plain_files/lambda_stmt.py [new file with mode: 0644]