vmware / pyvmomi

VMware vSphere API Python Bindings
Apache License 2.0
2.21k stars 764 forks source link

Type stubs: Missing vim.fault.* and vmodl.fault.* types #1018

Closed intgr closed 1 year ago

intgr commented 1 year ago

Describe the bug

Used with mypy or PyCharm, code like except vim.fault.AlreadyUpgraded: doesn't typecheck correctly and results in errors like

upgrade_vm.py:61:16: error: Module has no attribute "fault"  [attr-defined]

Example code: https://github.com/vmware/pyvmomi-community-samples/blob/7020598713aa440c70816edae89f96a0fe742be8/samples/upgrade_vm.py#LL61C5-L61C5

Reproduction steps

  1. Manually fixed syntax errors reported in https://github.com/vmware/pyvmomi/issues/1015
  2. Installed resulting package with pip
  3. Ran mypy over my codebase

Expected behavior

This is correct working code, no error expected.

Additional context

No response