How to fix wrong parameter order introduced in 2.4.0

12 views
Skip to first unread message

Pavel Dvořák

unread,
Mar 24, 2020, 6:40:11 AM3/24/20
to sphinx-users
Since 2.4.0 we got warnings like these:
```
08:53:25 WARNING: error while formatting arguments for pywikibot.Claim.__init__: wrong parameter order: <_ParameterKind.VAR_KEYWORD: 4> before <_ParameterKind.POSITIONAL_OR_KEYWORD: 1>
```
But there seems to be nothing wrong with:
```
        @deprecated_args(isReference='is_reference', isQualifier='is_qualifier')
        def __init__(self, site, pid, snak=None, hash=None, is_reference=False,
                     is_qualifier=False, rank='normal', **kwargs):
            """
            Initializer.
   
            Defined by the "snak" value, supplemented by site + pid
   
            @param site: repository the claim is on
            @type site: pywikibot.site.DataSite
            @param pid: property id, with "P" prefix
            @param snak: snak identifier for claim
            @param hash: hash identifier for references
            @param is_reference: whether specified claim is a reference
            @param is_qualifier: whether specified claim is a qualifier
            @param rank: rank for claim
            """
```
How to fix these?

Pavel Dvořák

unread,
Mar 24, 2020, 8:38:30 AM3/24/20
to sphinx-users
Also: Is there a way to print Python variables values during sphinx-build? (either into docs or into console) This would help me find out, if there is an issue with @deprecated_args decorator
Message has been deleted

Jörg Faschingbauer

unread,
Mar 24, 2020, 9:06:29 AM3/24/20
to sphinx...@googlegroups.com, Pavel Dvořák
I use the Python logger to filter a warning. Example code here, look out
for the 'setup' function, down at the bottom of the file.

https://github.com/jfasch/jfasch-home/blob/master/conf.py

It might not be a silver bullet, maybe there's a better way for your
case. I'd have had to patch the Sphinx html builder; so I filter the log
as a last resort.

Jörg
--
DI Jörg Faschingbauer
Linux und Open Source - Programmierung, Beratung und Schulung
https://www.faschingbauer.me
http://www.faschingbauer.co.at
j...@faschingbauer.co.at
Bergwirtstrasse 10
A-8075 Hart bei Graz
Tel. +43-664-5783814
UID: ATU64329756

Pavel Dvořák

unread,
Mar 24, 2020, 9:26:09 AM3/24/20
to sphinx-users
I've inspected the issue in a different way. It really does @deprecated_args decorator, which adds parameters to the wrong place. Now I just have to come up with a way to insert those params into the correct place in __signature__.parameters
Reply all
Reply to author
Forward
0 new messages