Reconciling pyqtProperty and mypy
4glitch at gmail.com
Wed Aug 19 10:15:38 BST 2020
Shouldn't the second method have a different name?
вт, 18 серп. 2020 о 21:55 Ben Green <ben.green at geckorobotics.com> пише:
> I'm using pyqtProperty a lot, and mypy doesn't seem to play nicely with
> it. When defining the setter, it gives a "name already defined" error.
> Also, since the type is "Callable[..., Any]", instead of the actual type of
> the property, references to that property can give errors.
> For example:
> class Foo(QObject):
> def series(self) -> QAbstractSeries:
> return self._series
> @series.setter # mypy error here: Name 'series' already defined on
> line x
> def series(self, val):
> self._series = val
> def do_something(self):
> self.series.replace() # mypy error here: "Callable[..., Any]"
> has no attribute "replace"
> Is there any way to reconcile these so I don't have to put in "type:
> ignore" comments all over the place?
> Ben Green | Software Engineer I
> *GeckoRobotics* | geckorobotics.com
> *o:* 412.407.2444 *m:* 484.895.5793
> *e:* ben.green at geckorobotics.com
;; -*- signature -*-
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt