Skip to content

Commit

Permalink
open up Mapped.__set__ for mypy 1.2
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zzzeek committed Apr 17, 2023
1 parent 1b48d8c commit db68861
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions sqlalchemy-stubs/orm/attributes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,7 @@ class Mapped(QueryableAttribute, Generic[_T]):
def __get__(self, instance: None, owner: Any) -> "Mapped"[_T]: ...
@overload
def __get__(self, instance: object, owner: Any) -> _T: ...
@overload
def __set__(self, instance: Any, value: _T) -> None: ...
@overload
def __set__(self, instance: Any, value: ClauseElement) -> None: ...
def __set__(self, instance: Any, value: Any) -> None: ...
def __delete__(self, instance: Any) -> None: ...
@classmethod
def _empty_constructor(cls, arg1: Any) -> "Mapped"[_T]: ...
Expand Down

0 comments on commit db68861

Please sign in to comment.