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

Shape not recognized by PyCharm autoimport #70

Open
rruiter87 opened this issue Apr 28, 2022 · 2 comments
Open

Shape not recognized by PyCharm autoimport #70

rruiter87 opened this issue Apr 28, 2022 · 2 comments

Comments

@rruiter87
Copy link

If I type Shape and press Alt + Enter in PyCharm to find the correct import, it doesn't give nptyping.Shape as a suggestion. But if I add from nptyping import Shape, it works as expected.

import shape

With other types it gives the right suggestions.

import NDArray

Maybe it is because Shape is imported like this?

from nptyping.typing_ import Literal as Shape # type: ignore[attr-defined]

I don't quite get why you do that, because Shape is again also defined here.

Shape: TypeAlias = Literal

It should be possible to just do from nptyping.typing_ import Shape in __init__.py right?

@ramonhagenaars
Copy link
Owner

What PyCharm version are you using? I could not reproduce this (but I'm still running 2020.3).

I don't quite get why you do that, because Shape is again also defined here.

Well, that seems to be a leftover from trickery to make MyPy/Pylint/PyCharm be ok with giving Shape a string. I think you are right that it can be done like you propose. It may not have come to my attention, because I didn't see that import flaw that you showed.

Thanks for reporting this. I will test it some more and may release a fix soon.

@rruiter87
Copy link
Author

What PyCharm version are you using? I could not reproduce this (but I'm still running 2020.3).

PyCharm 2022.1 (Professional Edition)
Build #PY-221.5080.212, built on April 12, 2022

Thanks for reporting this. I will test it some more and may release a fix soon.

👍

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

2 participants