Skip to content

parameters

parameters #

parameter_specs — a parameter annotation is the schema its argument hashes as.

parameter_specs(func) #

The CGType schema each of func's parameters declares, by name.

A broadcast value is a schemaless container — Map.values() and Array.map land in a bare Array, which cannot store itself — so what the parameter declares is the schema its argument stores, and hashes, as. A parameter that declares a bare container declares no schema either, and its argument falls back to hashing as its own type.

Source code in capturegraph-lib/capturegraph/recipes/calls/parameters.py
def parameter_specs(func: Callable[..., object]) -> dict[str, type[CGType]]:
    """The ``CGType`` schema each of ``func``'s parameters declares, by name.

    A broadcast value is a schemaless container — ``Map.values()`` and
    ``Array.map`` land in a bare ``Array``, which cannot store itself — so what
    the parameter declares is the schema its argument stores, and hashes, as.
    A parameter that declares a bare container declares no schema either, and
    its argument falls back to hashing as its own type.
    """
    return {
        name: hint
        for name, hint in get_type_hints(func).items()
        if name != "return"
        and isinstance(hint, type)
        and issubclass(hint, CGType)
        and hint not in _SCHEMALESS
    }