sourcery_analytics.metrics.compounders

Functions for creating compound metrics.

class sourcery_analytics.metrics.compounders.Compounder(*args, **kwargs)

Bases: Protocol

A compounder function produces a compound metric function.

sourcery_analytics.metrics.compounders.tuple_metrics(*metrics: Callable[[NodeNG], MetricResult]) Callable[[NodeNG], TupleMetricResult]

A compounder which joins the results in a tuple.

sourcery_analytics.metrics.compounders.name_metrics(*metrics: Callable[[NodeNG], MetricResult]) Callable[[NodeNG], NamedMetricResult]

A compounder which joins the result as a dictionary keyed on the metric names.

class sourcery_analytics.metrics.compounders.TupleMetricResult(iterable=(), /)

Bases: Tuple[MetricResult, …], _CompoundMetricResult

A compound metric result comprising a tuple of sub-result values.

class sourcery_analytics.metrics.compounders.NamedMetricResult

Bases: Dict[str, MetricResult], _CompoundMetricResult

A compound metric result mapping sub-metric name to sub-metric result.