in src/databao_context_engine/introspection/property_extract.py [0:0]
def _read_actual_property_type(property_type: type) -> type:
property_type_origin = get_origin(property_type)
if property_type_origin is Annotated:
return property_type.__origin__ # type: ignore[attr-defined]
elif property_type_origin is Union or property_type_origin is types.UnionType:
type_args = property_type.__args__ # type: ignore[attr-defined]
if len(type_args) == 2 and type(None) in type_args:
# Uses the actual type T when the Union is "T | None" (or "None | T")
return next(arg for arg in type_args if arg is not None)
else:
# Ignoring Union types when it is not used as type | None as we wouldn't which type to pick
return type(None)
return property_type