Skip to content

Commit 34e184f

Browse files
authored
open up Mapped.__set__ for mypy 1.2 (#253)
We are getting errors in 1.4 mypy due to the Mapped.__set__ method being too specific in some way: [classic@photon3 sqlalchemy:rel_1_4]$ PYTHONPATH=~/dev/sqlalchemy/lib/:~/dev/sqlalchemy2-stubs/ mypy test/ext/mypy/files/dataclasses_workaround.py test/ext/mypy/files/dataclasses_workaround.py:34: error: Unsupported "__set__" in "Mapped" [misc] test/ext/mypy/files/dataclasses_workaround.py:35: error: Unsupported "__set__" in "Mapped" [misc] test/ext/mypy/files/dataclasses_workaround.py:36: error: Unsupported "__set__" in "Mapped" [misc] test/ext/mypy/files/dataclasses_workaround.py:37: error: Unsupported "__set__" in "Mapped" [misc] test/ext/mypy/files/dataclasses_workaround.py:38: error: Unsupported "__set__" in "Mapped" [misc] test/ext/mypy/files/dataclasses_workaround.py:59: error: Unsupported "__set__" in "Mapped" [misc] test/ext/mypy/files/dataclasses_workaround.py:60: error: Unsupported "__set__" in "Mapped" [misc] test/ext/mypy/files/dataclasses_workaround.py:61: error: Unsupported "__set__" in "Mapped" [misc] Found 8 errors in 1 file (checked 1 source file) Open this up to avoid errors.
1 parent 1b48d8c commit 34e184f

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

sqlalchemy-stubs/orm/attributes.pyi

+1-4
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,7 @@ class Mapped(QueryableAttribute, Generic[_T]):
106106
def __get__(self, instance: None, owner: Any) -> "Mapped"[_T]: ...
107107
@overload
108108
def __get__(self, instance: object, owner: Any) -> _T: ...
109-
@overload
110-
def __set__(self, instance: Any, value: _T) -> None: ...
111-
@overload
112-
def __set__(self, instance: Any, value: ClauseElement) -> None: ...
109+
def __set__(self, instance: Any, value: Any) -> None: ...
113110
def __delete__(self, instance: Any) -> None: ...
114111
@classmethod
115112
def _empty_constructor(cls, arg1: Any) -> "Mapped"[_T]: ...

0 commit comments

Comments
 (0)