Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Docstrings confuse autocompletion #966

Copy link
Copy link
@Andriamanitra

Description

@Andriamanitra
Issue body actions

I ran into an issue where the autocompletion starts thinking an example from the docstring of the function is the signature of the function.

The original code where I ran into this was a bit more complicated but I managed to create a somewhat minimal reproduction (the inheritance is significant, without inheriting it works correctly):

from collections.abc import Sequence


class C(Sequence):
    @classmethod
    def cmethod(cls, number: int, lst: list[int] = []):
        """
        Return a list of numbers

        Example:
        ========
        C.cmethod(1337, [1, 2]) # => [1, 2, 1337]
        """
        return lst + [number]

image

The autocompletion (and the documentation pop-up) seems to not realize that 1337 and [1 and 2 are literals rather than parameter names, and the cls parameter for a class method gets turned into obj for whatever reason.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.