simplebench.reporters.choices.choices_conf module🔗

ChoicesConf class for reporters.

This module defines the ChoicesConf class, which is a container for managing ChoiceConf instances used in reporter configurations.

It ensures type safety by enforcing that only ChoiceConf instances can be added to the container, and provides methods for adding, retrieving, and managing these instances.

It is designed to be used in the context of reporters that require a collection of ChoiceConf instances.

It has no methods of its own; all functionality is inherited from _BaseChoices.

class simplebench.reporters.choices.choices_conf.ChoicesConf(
choices: Iterable[ChoiceConf] | ChoicesConf | None = None,
)[source]🔗

Bases: _BaseChoices[ChoiceConf, _ChoicesErrorTag]

A dictionary-like container for ChoiceConf instances.

This class enforces that only ChoiceConf instances can be added to it, and provides methods to manage and retrieve those instances.

It is designed to be used in the context of reporters that require a collection of ChoiceConf instances.

Construct a Choices container.

Parameters:

choices (Iterable[ChoiceConf] | ChoicesConf | None) – An Iterable of ChoiceConf instances or another ChoicesConf instance to initialize the container with. If None, an empty container is created.

add(
choice: ChoiceConf,
) None[source]🔗

Add a ChoiceConf instance to the container.

The choice.name attribute is used as the key in the container and is required to be unique withing the container.

Parameters:

choice (ChoiceConf) – The ChoiceConf instance to add.

Raises:
extend(
choices: Iterable[ChoiceConf] | ChoicesConf,
) None[source]🔗

Add ChoiceConf instances to the container.

It does so by adding each ChoiceConf in the provided Iterable of ChoiceConf or by adding the ChoiceConf instances from the provided ChoicesConf instance.

Parameters:

choices (Iterable[ChoiceConf] | ChoicesConf) – An Iterable of ChoiceConf instances or an instance of ChoicesConf.

Raises:
remove(name: str) None[source]🔗

Remove a ChoiceConf instance from the container by its name.

Parameters:

name (str) – The name of the ChoiceConf instance to remove.

Raises:

SimpleBenchKeyError – If no ChoiceConf under the given name exists in the container.