fleche.call

Attributes

AnyCall

Classes

Call

Represents a function call, capturing its name, arguments, and keyword arguments.

DigestedCall

A Call where arguments and result are Digest pointers into a value store.

LazyCall

QueryCall

Functions

bind(func, args, kwargs[, apply_defaults, partial])

Thin wrapper around inspect.Signature.bind() / bind_partial().

Module Contents

fleche.call.bind(func, args, kwargs, apply_defaults=False, partial=False)[source]

Thin wrapper around inspect.Signature.bind() / bind_partial().

Parameters:
  • func – The callable whose signature to bind against.

  • args – Positional arguments.

  • kwargs – Keyword arguments.

  • apply_defaults – If True, fill in default values for parameters that were not explicitly supplied.

  • partial – If True, use bind_partial(), which allows required arguments to be omitted (treated as wildcards).

Returns:

inspect.BoundArguments.arguments — an OrderedDict containing the supplied (and, when requested, defaulted) values.

class fleche.call.Call[source]

Represents a function call, capturing its name, arguments, and keyword arguments.

module and version can be optionally set to be included in the hash of the call. version should be a plain integer and monotonically increase. Each different version will completely change the hash of the call, invalidating previously cached results.

name: str[source]
arguments: dict[str, Any][source]
metadata: dict[str, dict[str, Any]][source]
module: str | None = None[source]
version: str | int | None = None[source]
code_digest: str | None = None[source]
result: Any = None[source]
classmethod from_call(func, *args, **kwargs)[source]
to_lookup_key() fleche.digest.Digest[source]
_to_digested(save_fn: Callable[[Any], fleche.digest.Digest]) DigestedCall[source]

Generic conversion to DigestedCall using save_fn to handle each value.

stash(values) DigestedCall[source]

Save arguments and result into values, returning a DigestedCall.

Result save errors propagate to the caller. Argument save errors fall back to a digest-only reference (the value is hashed but not stored).

Parameters:

values – A ValueStorage instance to persist values into.

Returns:

A DigestedCall with all argument values and the result replaced by their Digest keys.

See also

digest() for a variant that does not write to storage.

digest() DigestedCall[source]

Digest arguments and result without saving to storage, returning a DigestedCall.

Equivalent to stash() but uses digest() instead of values.save, so no data is written anywhere.

class fleche.call.DigestedCall[source]

A Call where arguments and result are Digest pointers into a value store.

Produced by Call.stash() or Call.digest(); represents a call whose values have been replaced by their content-addressed keys.

name: str[source]
arguments: dict[str, fleche.digest.Digest][source]
result: fleche.digest.Digest | None = None[source]
metadata: dict[str, dict[str, Any]][source]
module: str | None = None[source]
version: str | int | None = None[source]
code_digest: str | None = None[source]
__eq__(other: object) bool[source]
__digest__()[source]
to_lookup_key() fleche.digest.Digest[source]
fetch(cache) LazyCall[source]

Wrap this DigestedCall in a LazyCall backed by cache.

Parameters:

cache – A cache instance (e.g. Cache) whose value storage will be used to load argument and result values on demand.

Returns:

A LazyCall that loads values lazily from cache.

class fleche.call.LazyCall[source]
name: str[source]
_arguments: dict[str, Any][source]
_result: Any[source]
_cache: Any[source]
metadata: dict[str, dict[str, Any]][source]
module: str | None = None[source]
version: str | int | None = None[source]
code_digest: str | None = None[source]
property arguments[source]
property result[source]
to_lookup_key() str[source]
fetch() Call[source]

Reconstruct a full Call object by loading all values from the cache.

__digest__()[source]
class fleche.call.QueryCall[source]
name: StrQueryType = None[source]
arguments: dict[str, AnyQueryType] | None = None[source]
metadata: dict[str, dict[str, StrQueryType]] | None = None[source]
module: str | None = None[source]
version: str | int | None = None[source]
code_digest: fleche.digest.Digest | None = None[source]
result: AnyQueryType = None[source]
classmethod from_call(func, *args, **kwargs)[source]
matches(other: Call | LazyCall | DigestedCall) bool[source]

Check if this call matches another call, treating None as a wildcard in this object.

fleche.call.AnyCall[source]