]> 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>
Tue, 17 Jan 2023 19:02:36 +0000 (14:02 -0500)
commit2a53f70eeed0c39ff13e0c57086443e8714c8142
treec2cd23635a1feb155e1775e13a9f53620e88b063
parent1762c40490182fc511b71f5044f7252e2937162b
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
(cherry picked from commit cf64582f61b15716228302f669322d7efa1003c1)
(cherry picked from commit 36285760238314f70eed4532ca2c2c0c2d684609)
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/files/issue_9102.py [new file with mode: 0644]
test/ext/mypy/files/issue_9102_workaround.py [new file with mode: 0644]
test/ext/mypy/test_mypy_plugin_py3k.py