def _get_property_list_from_type_hints()

in src/databao_context_engine/introspection/property_extract.py [0:0]


def _get_property_list_from_type_hints(*, parent_type: type, is_root_type: bool) -> list[ConfigPropertyDefinition]:
    try:
        type_hints = get_type_hints(parent_type, include_extras=True)
    except TypeError as e:
        if is_root_type:
            # Ignore root types that don't have type hints like dict or list
            return []
        else:
            # If we're evaluating a nested property, we want to propagate the exception
            # to let the parent property know that this type should be ignored
            raise e

    result = []
    for property_key, property_type in type_hints.items():
        config_property = _create_property(property_type=property_type, property_name=property_key)

        if config_property is not None:
            result.append(config_property)

    return result