-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
bugmypy got something wrongmypy got something wrongtopic-descriptorsProperties, class vs. instance attributesProperties, class vs. instance attributes
Description
Bug Report
It seems that Mypy is not enjoying pyqtProperty setters. Someone already asked on the Qt mailing-list.
To Reproduce
from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal
class FeatureModel(QObject):
stateChanged = pyqtSignal()
def __init__(self, enabled: bool, /) -> None:
super().__init__()
self._enabled = enabled
@pyqtProperty(bool, notify=stateChanged)
def enabled(self):
return self._enabled
@enabled.setter
def enabled(self, enabled):
self._enabled = enabled
self.stateChanged.emit()Expected Behavior
Mypy should be happy.
Actual Behavior
$ python -m mypy file.py
file.py:16: error: Name 'enabled' already defined on line 12
Found 1 error in 1 file (checked 1 source file)Your Environment
- Mypy version used: 0.790
- Mypy command-line flags: None
- Mypy configuration options from
mypy.ini(and other config files): None - Python version used: 3.8.6
- Operating system and version: macOS Big Sur (arm64) and Windows 10.
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-descriptorsProperties, class vs. instance attributesProperties, class vs. instance attributes