registry

Fitter registry for descriptor lookup and matching.

Provides FitterRegistry for registering, querying, and prioritising fitter descriptors by target, sources, and constraint tags.

The module-level fitter_registry() function returns a process-wide singleton that is populated lazily on first access with all built-in descriptors from pysatl_core.distributions.computations.continuous and pysatl_core.distributions.computations.discrete.

class pysatl_core.distributions.computations.registry.FitterRegistry[source]

Bases: object

Registry that stores fitter descriptors and selects the best match.

This class is a singleton: every call to FitterRegistry() returns the same instance. Use FitterRegistry._reset() in tests to clear state.

Examples

>>> registry = FitterRegistry()
>>> registry.register(some_descriptor)
>>> desc = registry.find("cdf", ["pdf"], required_tags={"continuous", "univariate"})
Return type:

Self

__init__()[source]
Return type:

None

__copy__()[source]

Singleton copy returns the same instance.

Return type:

Self

__deepcopy__(memo)[source]

Singleton deepcopy returns the same instance.

Return type:

Self

Parameters:

memo (dict[Any, Any])

register(descriptor)[source]

Register a fitter descriptor.

Parameters:

descriptor (FitterDescriptor) – Fitter to register.

Return type:

None

register_many(descriptors)[source]

Register multiple descriptors at once.

Return type:

None

Parameters:

descriptors (Sequence[FitterDescriptor])

find(target, sources, *, required_tags=None)[source]

Find the first fitter matching the given target and sources.

Parameters:
  • target (str) – Target characteristic name.

  • sources (Sequence[str]) – Source characteristic names.

  • required_tags (frozenset[str] | None) – If provided, only fitters whose constraint_tags are a superset of required_tags are considered.

Returns:

First matching descriptor, or None if no match.

Return type:

FitterDescriptor | None

find_all(target, sources, *, required_tags=None)[source]

Return all matching fitters in registration order.

Parameters:
  • target (str) – Target characteristic name.

  • sources (Sequence[str]) – Source characteristic names.

  • required_tags (frozenset[str] | None) – Tag filter (same semantics as find()).

Returns:

Matching descriptors in registration order.

Return type:

list[FitterDescriptor]

all_descriptors()[source]

Return all registered descriptors in insertion order.

Return type:

list[FitterDescriptor]

pysatl_core.distributions.computations.registry.fitter_registry()[source]

Return the process-wide singleton FitterRegistry, populated lazily.

All built-in continuous and discrete fitter descriptors are created and registered on the first call. Subsequent calls return the cached instance. :rtype: FitterRegistry

Notes

  • Descriptors are not created at import time; they are built here on first access, keeping module-level side-effects to a minimum.

  • FitterRegistry is a singleton; FitterRegistry() is fitter_registry() is always True after the first call.

  • To reset the singleton (e.g. in tests), call reset_fitter_registry().

Return type:

FitterRegistry

pysatl_core.distributions.computations.registry.reset_fitter_registry()[source]

Reset the cached fitter registry (useful in tests).

Return type:

None