]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
mypy plugin fixes
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 17 Jan 2023 01:17:50 +0000 (20:17 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 18 Jan 2023 13:56:17 +0000 (08:56 -0500)
commit0e2b3aa323f62f46a342a8a8bba35323e214d300
tree58d8279169e72305d5c18f338bb49e45766f6635
parentf91a25cd8191f026dd43c0a2475cda8a56d65c19
mypy plugin fixes

Adjustments made to the mypy plugin to accommodate for some potential
changes being made for issue #236 sqlalchemy2-stubs when using SQLAlchemy
1.4. These changes are being kept in sync within SQLAlchemy 2.0.
The changes are also backwards compatible with older versions of
sqlalchemy2-stubs.

Fixed crash in mypy plugin which could occur on both 1.4 and 2.0 versions
if a decorator for the :func:`_orm.registry.mapped` decorator were used
that was referenced in an expression with more than two components (e.g.
``@Backend.mapper_registry.mapped``). This scenario is now ignored; when
using the plugin, the decorator expression needs to be two components (i.e.
``@reg.mapped``).

References: https://github.com/sqlalchemy/sqlalchemy2-stubs/issues/236
Fixes: #9102
Change-Id: Ieb1bf7bf8184645bcd43253e57f1c267b2640537
doc/build/changelog/unreleased_14/mypy_fix.rst [new file with mode: 0644]
lib/sqlalchemy/ext/mypy/apply.py
lib/sqlalchemy/ext/mypy/plugin.py
test/ext/mypy/plugin_files/issue_9102.py [new file with mode: 0644]
test/ext/mypy/plugin_files/issue_9102_workaround.py [new file with mode: 0644]