[PyQt] Getting a list of virtual PyQt functions

Florian Bruhin me at the-compiler.org
Thu Jul 16 17:39:17 BST 2015

* Phil Thompson <phil at riverbankcomputing.com> [2015-07-16 17:27:45 +0100]:
> 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).

That's okay - for my use case, the output doesn't need to be perfect.
It's a good starting point for sure.

I attached a patch. I only did it for xmlOverload as I think it's not
useful information for xmlCtor.



http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
         I love long mails! | http://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sip_virtual.patch
Type: text/x-diff
Size: 509 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150716/839d9782/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150716/839d9782/attachment.sig>

More information about the PyQt mailing list