<div dir="ltr">Shouldn't the second method have a different name?<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">вт, 18 серп. 2020 о 21:55 Ben Green <<a href="mailto:ben.green@geckorobotics.com">ben.green@geckorobotics.com</a>> пише:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>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.</div><div><br></div><div>For example:</div><div><font face="monospace"><br></font></div><div><font face="monospace">class Foo(QObject):</font></div><div><font face="monospace"> @pyqtProperty(QAbstractSeries)</font></div><div><font face="monospace"> def series(self) -> QAbstractSeries:</font></div><div><font face="monospace"> return self._series</font></div><div><font face="monospace"><br></font></div><div><font face="monospace"> @series.setter # mypy error here: Name 'series' already defined on line x</font></div><div><font face="monospace"> def series(self, val):</font></div><div><font face="monospace"> self._series = val</font></div><div><font face="monospace"><br></font></div><div><font face="monospace"> def do_something(self):</font></div><div><font face="monospace"> self.series.replace([]) # mypy error here: "Callable[..., Any]" has no attribute "replace"</font></div><div><div><br></div><div>Is there any way to reconcile these so I don't have to put in "type: ignore" comments all over the place?</div><div><br></div>-- <br><div dir="ltr">
<div dir="ltr">
<span style="color:gray">Ben Green | </span>
<span style="color:rgb(115,170,27)">Software Engineer I</span><br><br>
<p style="margin:0px">
<b><span style="color:rgb(115,170,27)">Gecko</span><span style="color:rgb(128,128,128)">Robotics</span></b> |
<a style="color:rgb(17,85,204)" href="http://www.geckorobotics.com/?utm_source=signature&utm_medium=email&utm_campaign=signature" target="_blank">geckorobotics.com</a>
</p>
<p style="margin:0px">
<b style="color:rgb(115,170,27)">o:</b> <span style="color:gray">412.407.2444</span> <b style="color:rgb(115,170,27)">m:</b> <span style="color:gray">484.895.5793</span>
<br>
<b style="color:rgb(115,170,27)">e:</b> <a style="color:rgb(17,85,204)" href="mailto:ben.green@geckorobotics.com" target="_blank">ben.green@geckorobotics.com</a>
</p></div>
</div></div></div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature">;; -*- signature -*-</div>