Open sodul opened 5 months ago
another incorrect typing stub:
$ cat foo.py
from pyVmomi import vim
print(vim.TaskInfo.State.success)
$ python3 foo.py
success
$ mypy foo.py
foo.py:2: error: Module has no attribute "State" [attr-defined]
print(vim.TaskInfo.State.success)
^~~~~~~~~~~~~~~~~~
Found 1 error in 1 file (checked 1 source file)
Some more issues:
vm: vim.VirtualMachine
vm.runtime.powerState
error: RuntimeInfo? has no attribute "powerState"
Something relating to ManagedEntity
, because many objects get error for accessing name:
Datastore? has no attribute "name"
Network? has no attribute "name"
ManagedEntity? has no attribute "name"
More examples:
TaskInfo? has no attribute "state"
TaskInfo? has no attribute "result"
DatastoreBrowser? has no attribute "SearchDatastore_Task"
VirtualDevice? has no attribute "connectable"
VirtualDevice? has no attribute "uptCompatibilityEnabled"
VirtualDevice? has no attribute "backing"
VirtualHardware? has no attribute "device"
There seems to be an issue with the underlying generation issue. Those are some of the few examples.
Describe the bug
Run
mypy
on code using pyvmomi, mypy will throw an error:Reproduction steps
pip install pyvmomi==8.0.3.0.1 types-pyvmomi==8.0.0.6 mypy==1.10.1
Call mypy on code using pyvmomi:
mypy
To fix:
pip install pyvmomi==8.0.2.0.1
Expected behavior
No errors.
Additional context
Relates to #862 and #1048.