mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
ifcopenshell_wrapper.pyi - support varargs and kwargs in constructors
This commit is contained in:
@@ -70,13 +70,16 @@ def get_function_node_name(node: ast.FunctionDef) -> Union[SubnameType, None]:
|
||||
else:
|
||||
args.append(f"{arg.arg}={ast.unparse(default)}")
|
||||
|
||||
if arg := node.args.vararg:
|
||||
args.append(f"*{arg.arg}")
|
||||
|
||||
if arg := node.args.kwarg:
|
||||
args.append(f"**{arg.arg}")
|
||||
|
||||
# Skip non-informative constructors.
|
||||
if is_init and args == ["self"]:
|
||||
return None
|
||||
|
||||
if node.args.vararg:
|
||||
args.append("*args")
|
||||
|
||||
node_name = f"def {node.name}"
|
||||
node_name = f"{node_name}({', '.join(args)}): ..."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user