Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show generic arguments #50

Open
sobolevn opened this issue Sep 6, 2020 · 0 comments
Open

Show generic arguments #50

sobolevn opened this issue Sep 6, 2020 · 0 comments

Comments

@sobolevn
Copy link

sobolevn commented Sep 6, 2020

Hi again! 🙂

In my use-case, it is very important to show what generic arguments types have.
Let's see it with real-life example.

This is how my Maybe is show in the new version of this plugin:

Снимок экрана 2020-09-04 в 10 33 29

But, that's how it is defined:

class Maybe(
    BaseContainer,
    SupportsKind1['Maybe', _ValueType],
    MaybeBased2[_ValueType, None],
    metaclass=ABCMeta,
):

See, how many information about typing is lost right now! 😞

I propose to show all available typing information if :generics: key is given.

Here's a quick demo to show that it is possible.

>>> from typing import Generic
>>> from typing import TypeVar
>>> T = TypeVar('T')
>>> class Example(Generic[T]): ...
... 
>>> Example.__mro__
(<class '__main__.Example'>, <class 'typing.Generic'>, <class 'object'>)
>>> Example.__orig_bases__
(typing.Generic[~T],)

Related to #48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant