This commit is contained in:
Andrej
2025-05-29 17:23:02 +05:00
parent ea7ced738a
commit 0663c5130a
25 changed files with 42 additions and 22 deletions
@@ -43,9 +43,11 @@ import numpy
import inspect
import importlib
import ifcopenshell
from typing import Callable, Any, Optional
from typing import Callable, Any, Optional, TYPE_CHECKING
from functools import partial
if TYPE_CHECKING:
import ifcopenshell.api
pre_listeners: dict[str, dict] = {}
post_listeners: dict[str, dict] = {}
@@ -185,7 +187,7 @@ def extract_docs(module: str, usecase: str) -> dict[str, Any]:
type_hints = typing.get_type_hints(function_init)
for name, socket_data in inputs.items():
type_hint = type_hints[name]
if isinstance(type_hint, typing._UnionGenericAlias):
if isinstance(type_hint, typing._UnionGenericAlias): # pyright: ignore[reportAttributeAccessIssue]
inputs[name]["type"] = [t.__name__ for t in typing.get_args(type_hint)]
else:
inputs[name]["type"] = type_hint.__name__