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

Type warnings #1026

Closed
IvarVirusiim opened this issue Jun 8, 2023 · 2 comments
Closed

Type warnings #1026

IvarVirusiim opened this issue Jun 8, 2023 · 2 comments
Assignees
Labels

Comments

@IvarVirusiim
Copy link

IvarVirusiim commented Jun 8, 2023

Describe the bug

When using PyCharm and type hinting, there are warnings like those:

image

image

image

Reproduction steps

  1. Add a type hint using full path, for example: vim.vm.device.VirtualEthernetCard
  2. Look at warning that says: Cannot find reference 'vm' in '__init__.pyi' :
    image

Expected behavior

No warnings

Additional context

For this example (vim.vm.device.VirtualEthernetCard) using re-exports should fix them:

https://typing.readthedocs.io/en/latest/source/stubs.html#imports

For example vim.__init__.pyi :
from . import vim as vim

and in vm.__init__.pyi:
from . import device as device

@DanielDraganov
Copy link
Collaborator

Thanks for reporting this. There is discrepancy between PyCharm and Visual Studio Code because the latter did not have issues with the imports and did not show warnings. Nevertheless, the imports are modified to comply with the "from Y import X as X" rule.

@nofacer
Copy link

nofacer commented Nov 1, 2023

Hi @DanielDraganov , I think this issue still exists with pyvmomi==8.0.2.0.
image
image

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

No branches or pull requests

3 participants