language.call
def call(target: Callable[P, L], reserved_ok: typing.Collection[str] = (), expand_args: bool = False, include_defaults: bool = False, convert: ConvertMode = 'all', recursive: bool | None = None, wrappers: typing.Sequence[typing.Any] | None = None, meta: typing.Mapping[str, typing.Any] | None = None, strict: bool = True, root: bool = False) -> Callable[P, L] | Callable[P, omegaconf.DictConfig]Perform a lazy call to a function or class.
This is fiction #1 in the lie-typing contract — see the module docstring
section "The five fictions" for the table. The returned callable claims
to return ``_L`` (the static return type of ``target``); at runtime it
produces an :class:`omegaconf.DictConfig` node that
:func:`laco.instantiate` later materialises.
Parameters
| Name | Type | Description |
|---|---|---|
| target | callable | The target function or class to call. |
| reserved_ok = () | collection of str | A collection of reserved keys that are allowed in the kwargs. |
| expand_args = False | bool | Whether to expand the first positional argument as *args. If True, only one positional argument is allowed, and it will be expanded as *args. If False, the first and second positional arguments are passed as *args. |
| include_defaults = False | bool | Whether to include default values of the target function into the configuration. Parameters with no default value are emitted as :data:`omegaconf.MISSING`, so that downstream :func:`laco.instantiate` raises a precise ``MissingMandatoryValue`` rather than an opaque constructor ``TypeError``. Covers ``POSITIONAL_ONLY``, ``POSITIONAL_OR_KEYWORD`` and ``KEYWORD_ONLY`` parameters; ``*args`` / ``**kwargs`` are skipped. |
| convert = "none" | (none, partial, object, all) | Hydra ``_convert_`` strategy emitted onto the node. Defaults to ``"all"`` so that vanilla ``hydra.utils.instantiate`` preserves Laco's historical recursive container-conversion semantics on round-tripped YAML. All four modes are honoured at instantiate-time (``laco.instantiate`` delegates to ``hydra.utils.instantiate``). |
| recursive = None | bool | Hydra ``_recursive_`` knob. When provided, emitted into the node. ``None`` leaves the key off the node, falling back to the consumer's default. |
| wrappers = None | sequence of callables | List of post-processing wrappers emitted as ``_zen_wrappers_`` onto the node (hydra-zen parity). ``laco.instantiate`` does **not** process this key — it is forwarded as-is to ``hydra.utils.instantiate``, which will pass it as a keyword argument to the target and raise ``TypeError`` for any target without ``**kwargs``. Consume via hydra-zen's ``instantiate`` or a custom instantiation backend. Must be a sequence (not a bare string). |
| meta = None | mapping | Metadata dict emitted as ``_zen_meta_`` onto the node (hydra-zen parity). Same forwarding caveat as ``wrappers``. |
| strict = ``True`` | bool | When ``True`` and ``target`` is a callable whose signature can be introspected via :func:`inspect.signature`, the kwargs passed to the returned wrapper are validated at config-construction time: any kwarg that is not a declared parameter (and the target does not accept ``**kwargs``) raises :class:`TypeError` with the target name and the offending kwarg(s). Reserved Laco keys (``_target_``, ``_args_``, ...) and any keys opted in via ``reserved_ok`` are exempt. When the target's signature cannot be introspected (e.g. a C-extension callable), a :class:`LazyCallIntrospectionWarning` is emitted once and validation is skipped — equivalent to ``strict=False``. Set ``strict=False`` explicitly to opt out for dynamic targets (and to suppress the warning). |
| root = False | bool | If True, the returned callable will be typed as returning a `DictConfig`, which is useful for defining the root of a configuration tree. |
Source: laco/language.py:336