ifcopenshell_wrapper.pyi - support stubs for constructors

This commit is contained in:
Andrej730
2026-03-19 18:16:24 +05:00
parent 26280d24fe
commit cb113ae8da
2 changed files with 37 additions and 1 deletions
@@ -57,9 +57,16 @@ def get_function_node_name(node: ast.FunctionDef) -> Union[SubnameType, None]:
:return: Function node name as ``SubnameType`` or ``None``, if function wasn't processed and can be skipped.
"""
node_name = node.name
if node_name.startswith("_") and node_name not in ("_is",):
is_init = node_name == "__init__"
if node_name.startswith("_") and node_name not in ("_is",) and not is_init:
return None
args = [a.arg for a in node.args.args]
# Skip non-informative constructors.
if is_init and args == ["self"]:
return None
if node.args.vararg:
args.append("*args")