[PyQt] Getting a list of virtual PyQt functions

Phil Thompson phil at riverbankcomputing.com
Thu Jul 16 17:27:45 BST 2015


On 16/07/2015 10:49 am, Florian Bruhin wrote:
> Hi!
> 
> I recently found out about vulture[1], which is a static checker to
> find dead Python code, among other things it finds methods which never
> are called.
> 
> However, it (naturally) doesn't detect when I'm overriding a virtual
> Qt function, as that's never called *from Python*.
> 
> I opened an issue [2] and we agreed it'd be a good idea to add a
> whitelist for all virtual PyQt methods.
> 
> Of course maintaining such a whitelist by hand is not something I want
> to do, so I looked into sip and how it could help me.
> 
> I found out about the XML export (-m), and have two questions about
> it:
> 
> - Is there a reason it's not documented at [3]?
> 
> - Would a patch adding a 'virtual="true"' attribute to function tags
>   if isVirtual() is true be appreciated?

It's not documented because it's not supported. I plan to support it 
(or, more likely, something similar) for sip5.

I would accept a patch because that is useful information to the Python 
programmer. However I make no promises about whether the current 
extracts are correct, or if they might change in the future (before they 
are officially supported).

Phil


More information about the PyQt mailing list