You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Property setter not accepted if not next to getter #1465
mypy returns a "Callable[[Any], Any]" has no attribute "getter" error here. In this case, it's obviously not possible to move the two methods to be next to each other.
Thanks for posting this - also struggling with this. Is there any known workaround? Specifically I wanted to override a property setter.
Reacted by Jordan Kail, Michael Dawson-Haggerty, Paul Rademacher, Jon Cluce and nk
"No attribute" along with "Untyped decorator" error.
class Cell(ABC):
def __init__(self, value: int | None = None):
...
@property
def value(self) -> int | None:
return self._value
class InputCell(Cell):
@Cell.value.setter
def value(self, value: int) -> None:
...
Running mypy with --strict generates:
react.py:28: error: "Callable[[Cell], int | None]" has no attribute "setter" [attr-defined]
react.py:28: error: Untyped decorator makes function "value" untyped [misc]
Activity
Make mypy succeed with imports on master.py
Make mypy succeed with imports on master.py
Make mypy succeed with imports on master.py
Make mypy succeed with imports on master.py
Make mypy succeed with imports on master.py
Make mypy succeed with imports on master.py
Make mypy succeed with imports on master.py
Make mypy succeed with imports on master.py
ilevkivskyi commentedon Jun 4, 2017
#1713 has another example and some ideas.
levsa commentedon Aug 30, 2017
What is the status of this issue? #1713 is closed as duplicate of this issue.
JukkaL commentedon Aug 30, 2017
We don't have immediate plans for fix this issue, but we are happy to receive a PR.
[-]Wrong error for @smth.setter property[/-][+]Property setter not accepted if not next to getter[/+]levsa commentedon Aug 30, 2017
I had missed that moving the setter next to getter solves the problem, which is good enough. Thanks for the update!
30 remaining items
samskiter commentedon May 27, 2023
Thanks for posting this - also struggling with this. Is there any known workaround? Specifically I wanted to override a property setter.
asarkar commentedon Sep 23, 2023
"No attribute" along with "Untyped decorator" error.
Running mypy with
--strictgenerates:Line 28 happens to be the
@Cell.value.setter.RF: annotate entries.py, fix a string format in test
RF: annotate entries.py, fix a string format in test
Workaround for python/mypy#1465
Enable type hint checking (#5956)
🏷️ Fixing mypy errors
Fix false positive when @Property getter and setter are non-adjacent
Add type hints
Add type hints
Add type hints
Add type hints
Add type hints
Add type hints
Add type hints