Python interface definition stubs / modules (.pyi files) are a standardized way to describe API that is accessible from Python, but not implemented as Python code. They can contain type information which advanced Python editors like Visual Studio Code with the Python extension can utilize to provide very smart auto-completion and static type checking.
I have produced / generated full pyi definition for VC 4.8 Premium’s API based on the newonline help.
Here is a (silent) demo of using these with Visual Studio Code, using Pylance as type checker.
Features:
Includes all Python classes and their members (properties, methods, constructors, events) + constants as described in the online help.
Includes accurate type information where possible.
Includes descriptions and direct links to the online help.
Module organization is similar to VC. Functions from vcScript, vcCommand, vcVector etc. can be imported.
Caveats:
Definitions for some base classes such as vcBehaviour have to include properties that may only exist in some of the behaviours. These have a note in the description.
I think the import is not getting resolved becausevcApplicationis not defined as separate module in these API files, the class definition is invcScript.
Would need to make a separatevcApplication.pyi该文件包含静态模块级成员,并且需要一个空文件夹才能实现直接导入。
你或许可以直接在代码中使用 `vcApplication` 前缀,例如 `vcApplication.loadBitmap(…)`。vcApplicationfolder for that direct import to work.
You can probably just use thevcApplicationprefix in your code instead, likevcApplication.loadBitmap(…)
网友评论
最新评论