yera.apps.typing.validate

Validation: checking that an app's annotations are drawn from the supported set.

Symbols

def assert_value_is_return_type — Check that an app's return value matches its declared return type.
def is_dataframe_type — Check if type is pandas DataFrame without importing pandas.
def is_enum_type — Check if type is an Enum subclass.
def is_struct_type — Check if type is a Struct subclass.
def validate_signature — Validate that all type hints in a signature are allowed.

assert_value_is_return_type

assert_value_is_return_type(
    return_value: Any,
    return_cls: type | None,
    meta: AppMetadata,
) → None

Check that an app's return value matches its declared return type.

Raises

TypeError

If the value does not match the declared return type.

TypeError

If the app declared no return type but returned a non-None value.

is_dataframe_type

is_dataframe_type(
    type_hint: Any,
) → bool

Check if type is pandas DataFrame without importing pandas.

is_enum_type

is_enum_type(
    expected_type: Any,
) → bool

Check if type is an Enum subclass.

is_struct_type

is_struct_type(
    expected_type: Any,
) → bool

Check if type is a Struct subclass.

validate_signature

validate_signature(
    signature: inspect.Signature,
    type_hints: dict[str, Any],
    identifier: str,
) → None

Validate that all type hints in a signature are allowed.

Parameters

signature
type: inspect.Signature

The inspected function signature.

type_hints
type: dict[str, Any]

Resolved type hints from get_type_hints.

identifier
type: str

The agent's module-qualified identifier, used in error messages.

Raises

TypeError

If any parameter uses *args or **kwargs syntax; these cannot be statically analysed by the SIGL compiler.

TypeError

If any parameter is missing a type hint, or if any parameter or return type uses an unsupported type.