update for mypy 1.20.0

Change-Id: I95f72b8a1818b79d01d26531202199f24fe3b808
This commit is contained in:
Mike Bayer
2026-04-01 14:31:21 -04:00
committed by Michael Bayer
parent aae603beab
commit 6a54490c9d
6 changed files with 11 additions and 6 deletions
@@ -20,6 +20,7 @@ is completely automated.
from __future__ import annotations
from typing import Any
from typing import ClassVar
from typing import TYPE_CHECKING
from sqlalchemy import create_engine
@@ -92,6 +93,8 @@ class HasAddresses:
"""
Address: ClassVar[type]
@declared_attr
def addresses(cls: type[Any]) -> Mapped[list[AddressWithParent]]:
cls.Address = type(
+1 -1
View File
@@ -1755,7 +1755,7 @@ class hybrid_property(interfaces.InspectionAttrInfo, ORMDescriptor[_T]):
name = self.__name__
break
else:
name = attributes._UNKNOWN_ATTR_KEY # type: ignore[assignment]
name = attributes._UNKNOWN_ATTR_KEY # type: ignore[assignment,unused-ignore] # noqa: E501
return cast(
"_HybridClassLevelAccessor[_T]",
+2 -2
View File
@@ -1034,7 +1034,7 @@ class MutableSet(Mutable, Set[_T]):
self.symmetric_difference_update(other)
return self
def __isub__(self, other: AbstractSet[object]) -> MutableSet[_T]: # type: ignore[misc] # noqa: E501
def __isub__(self, other: AbstractSet[object]) -> MutableSet[_T]: # type: ignore[misc,unused-ignore] # noqa: E501
self.difference_update(other)
return self
@@ -1046,7 +1046,7 @@ class MutableSet(Mutable, Set[_T]):
set.remove(self, elem)
self.changed()
def discard(self, elem: _T) -> None:
def discard(self, elem: _T) -> None: # type: ignore[override,unused-ignore] # noqa: E501
set.discard(self, elem)
self.changed()
+2
View File
@@ -4756,6 +4756,8 @@ class SQLCompiler(Compiled):
"_label_select_column is only relevant within "
"the columns clause of a SELECT or RETURNING"
)
result_expr: elements.Label[Any] | _CompileLabel
if isinstance(column, elements.Label):
if col_expr is not column:
result_expr = _CompileLabel(
+2 -2
View File
@@ -229,12 +229,12 @@ class immutabledict(Dict[_KT, _VT]):
self, __value: Mapping[_KT, _VT], /
) -> immutabledict[_KT, _VT]:
return immutabledict(
dict.__or__(self, __value), # type: ignore[call-overload]
dict.__or__(self, __value), # type: ignore[call-overload,operator,unused-ignore] # noqa: E501
)
def __ror__( # type: ignore[override]
self, __value: Mapping[_KT, _VT], /
) -> immutabledict[_KT, _VT]:
return immutabledict(
dict.__ror__(self, __value), # type: ignore[call-overload]
dict.__ror__(self, __value), # type: ignore[call-overload,operator,unused-ignore] # noqa: E501
)
+1 -1
View File
@@ -45,7 +45,7 @@ Discussions = "https://github.com/sqlalchemy/sqlalchemy/discussions"
[project.optional-dependencies]
asyncio = ["greenlet>=1"]
mypy = [
"mypy >= 1.19",
"mypy >= 1.20",
"types-greenlet >= 2",
]
mssql = ["pyodbc"]