• Re: Help with numpydoc needed (Was: Bug#1029245: nitime: FTBFS: dh_auto

    From =?UTF-8?Q?=c3=89ric_Araujo?=@21:1/5 to All on Fri Jan 20 22:10:01 2023
    Hello,

    Le 20/01/2023 à 15:33, Andreas Tille a écrit :
    I finally do not have an idea how to replace:

    Handler <function mangle_docstrings at 0x7fa9a393e3e0> for event 'autodoc-process-docstring' threw an exception (exception: 'FullArgSpec' object has no attribute 'replace')

    which you can find in the latest build log in Salsa CI.

    tl;dr: replace the body of the try block with this:

    argspec = inspect.signature(inspect.getframeinfo)
    argspec = str(argspec).replace('*', '\\*')
    signature = '%s%s' % (func_name, argspec)


    The code does a string replace so that `*` characters in the function
    signature (used for variadic args, variadic keyword args and separating keyword-only args) get escaped to prevent interpretation by Sphinx as
    emphasis markup.

    The inspect.getfullargspec function returns a special object (a named
    tuple), not a string. On the commented line in the patch, we see a call
    to format.formatargspec which was meant to turn the FullArgSpec into a
    string, but that function has been deprecated since 3.5, with an error
    message pointing to the newer, better API: function signatures.

    Cheers

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From FC Stegerman@21:1/5 to All on Fri Jan 20 22:30:01 2023
    * Éric Araujo <merwok@netwok.org> [2023-01-20 22:01]:
    tl;dr: replace the body of the try block with this:

    argspec = inspect.signature(inspect.getframeinfo)
    argspec = str(argspec).replace('*', '\\*')
    signature = '%s%s' % (func_name, argspec)

    Should that not use "func" instead of "inspect.getframeinfo"?

    argspec = inspect.signature(func)
    argspec = str(argspec).replace('*', '\\*')
    signature = '%s%s' % (func_name, argspec)

    - FC

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?=c3=89ric_Araujo?=@21:1/5 to All on Fri Jan 20 22:30:01 2023
    Le 20/01/2023 à 16:21, FC Stegerman a écrit :
    Should that not use "func" instead of "inspect.getframeinfo"?

    Yes of course! I tested in a terminal to give valid code and forgot to
    replace my example function with the original variable name. Thanks!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andreas Tille@21:1/5 to All on Sat Jan 21 09:20:01 2023
    Am Fri, Jan 20, 2023 at 04:24:07PM -0500 schrieb Éric Araujo:
    Le 20/01/2023 à 16:21, FC Stegerman a écrit :
    Should that not use "func" instead of "inspect.getframeinfo"?

    Yes of course! I tested in a terminal to give valid code and forgot to replace my example function with the original variable name. Thanks!

    Thanks to both of you
    Andreas.

    --
    http://fam-tille.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)