mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 18:43:26 +00:00
typing
This commit is contained in:
@@ -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__
|
||||
|
||||
Reference in New Issue
Block a user