[PySide] pylint and signal emit

Cristián Maureira-Fredes Cristian.Maureira-Fredes at qt.io
Mon May 31 14:12:04 CEST 2021



On 5/31/21 1:29 PM, Ed Lipson wrote:
> I'm using pylint on a program. It keeps pointing out an error of no emit 
> member unless I disable the check.
> 
>     self.dataChanged.emit(index, index) # pylint: disable=E1101
> 
> The code seems to work, so I am not sure if it is a false pylint error 
> or it is working some other way, even though I have subclassed setData 
> and as specified emitted dataChanged explicitly.
> Could this be an artifact of the python/c++ nature of pyside?
> 
> 
> Thanks,
> Ed
> 

Hey Ed,

most of the linters work mainly at a Python level,
and I expect them to fail when looking for Qt-inherited
members, which are usually not explicit.

In the case of a Signal,
we create that Python type with C-extensions,
so most of the behavior is manually written
https://code.qt.io/cgit/pyside/pyside-setup.git/tree/sources/pyside6/libpyside/pysidesignal.cpp

There you can see that we create the "emit" method of  the type Signal
(line 177), so it should be picked up by autocomplete tools,
for example (in some IDE).

I'm not certain what's the process of pylint to detect the members,
but maybe you can ask the developers (or maybe on a public channel?)
to see what does they expect for the detection of members.

Do you have similar problems with Slots or Properties?

Cheers

-- 
Dr. Cristián Maureira-Fredes
R&D Manager

The Qt Company GmbH
Erich-Thilo-Str. 10
D-12489 Berlin

Geschäftsführer: Mika Pälsi,
Juha Varelius, Jouni Lintunen
Sitz der Gesellschaft: Berlin,
Registergericht: Amtsgericht
Charlottenburg, HRB 144331 B


More information about the PySide mailing list