You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Positional-only arguments are mishandled in signatures with / always being put at the start of a signature with positional-only arguments regardless of how many arguments are positional only.
To Reproduce
With the following test code being targeted by mkdocstrings
build documentation from this module and watch it place / at the start of bar's signature as shown in the following screenshot.
Expected behavior / should appear after baz in the signature.
Screenshots
System (please complete the following information):
mkdocstrings-python version: 0.7.0
mkdocstrings version: 0.19.0
griffe version: 0.20.0
mkdocs version: 1.3.0
Python version: 3.10
OS: Windows
Additional context
This leads to an error being raised in cases where black is used to reformat function signatures with positional only arguments as / cannot be the first argument of a function syntax wise.
I can't really read this code but from what I can tell the responsible code might be here
{%- if parameter.kind.value == "positional-only" -%}
{%- if ns.render_pos_only_separator -%}
{%- set ns.render_pos_only_separator = False %}/, {% endif -%}
(where it's adding in / the moment it finds a positional only argument that isn't named self or cls rather than waiting until it reaches the end of the positional only arguments). I did try griffe with the example code and it seemed to be handling positional-only arguments properly.
The text was updated successfully, but these errors were encountered:
Describe the bug
Positional-only arguments are mishandled in signatures with
/
always being put at the start of a signature with positional-only arguments regardless of how many arguments are positional only.To Reproduce
With the following test code being targeted by mkdocstrings
and the following mkdocs.yml
build documentation from this module and watch it place
/
at the start of bar's signature as shown in the following screenshot.Expected behavior
/
should appear afterbaz
in the signature.Screenshots
System (please complete the following information):
mkdocstrings-python
version: 0.7.0Additional context
This leads to an error being raised in cases where black is used to reformat function signatures with positional only arguments as
/
cannot be the first argument of a function syntax wise.I can't really read this code but from what I can tell the responsible code might be here
python/src/mkdocstrings_handlers/python/templates/material/_base/signature.html
Lines 15 to 17 in bc1a8ae
/
the moment it finds a positional only argument that isn't namedself
orcls
rather than waiting until it reaches the end of the positional only arguments). I did try griffe with the example code and it seemed to be handling positional-only arguments properly.The text was updated successfully, but these errors were encountered: