Skip to content

docs: show type-hints for positional-only arguments #8722

@jepler

Description

@jepler

I noticed that the following docstring was lacking type hints:

//|     @overload
//|     def open(self, /, bytesio: io.BytesIO) -> Tuple[int, int]:
//|         """Use the specified object  as the JPEG data source.
//|
//|         The source may be a filename, a binary buffer in memory, or an opened binary stream.
//|
//|         Returns the image size as the tuple ``(width, height)``."""

When I removed the /, positional-only marker, the type hints appeared.

I'll format the docstrings so that they get the type hint, even though they are position-only; it seems the better compromise.

iirc we had to work around an autodoc limitation when it came to positional-only arguments, maybe the workaround is incomplete.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions