validate_stub

Script to ensure ifcopenshell_wrapper.pyi and ifcopenshell_wrapper.py work in sync.

Things we do check: - all symbols from the wrapper present in the stub and vice versa - functions and methods signatures - read-only and settable properties, staticmethods - class hierarchy

Module Contents

validate_stub.format_diff(lines: list[str]) → None
validate_stub.get_function_node_name(node: ast.FunctionDef) → SubnameType | None
Returns:

Function node name as SubnameType or None, if function wasn’t processed and can be skipped.

validate_stub.get_names_tree(tree: ast.Module) → dict[str, set[SubnameType]]
validate_stub.get_names_tree_lines(tree: ast.Module) → list[str]
validate_stub.main() → None
validate_stub.signature_from_docstring(name: str, doc: str | None, is_method: bool) → str | None

Rebuild the proxy def signature SWIG would have generated from an autodoc docstring.

One prototype whose defaults are all Python literals becomes named parameters; several prototypes (overloads), or a default SWIG cannot express as a literal such as an enum, become *args, which is what SWIG does. Checked against every def of a wrapper built without -fastproxy: 773 of 773 signatures rebuild identically.

validate_stub.SubnameType