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

Export _aliass for dict_keys etc #29

Open
KotlinIsland opened this issue Jan 19, 2022 · 0 comments · May be fixed by #94
Open

Export _aliass for dict_keys etc #29

KotlinIsland opened this issue Jan 19, 2022 · 0 comments · May be fixed by #94

Comments

@KotlinIsland
Copy link
Owner

KotlinIsland commented Jan 19, 2022

from _collections_abc import dict_keys as real_dict_keys
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    dict_keys = real_dict_keys  # type: ignore[misc]
else:
    from typing import _alias # noqa

    dict_keys = _alias(real_dict_keys, 2)

# test.py
def test_dict_keys():
    typ = dict_keys[str, int]
    dk1: typ = {'a': 1}.keys()
    dk:2 typ = {1: 'a'}.keys()   # type: ignore[assignment]
@DetachHead DetachHead changed the title Export _asliass for dict_keys etc Export _aliass for dict_keys etc Jan 19, 2022
@KotlinIsland KotlinIsland linked a pull request Dec 17, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant