firecrown.parameters.RequiredParameters#

class firecrown.parameters.RequiredParameters(params_names)[source]#

Bases: object

Represents a sequence of parameter names.

This class provides some type safety to distinguish between an arbitrary list of strings, and one intended to be a list of required parameter names.

An instance can be created from a list of strings. Instances can be concatenated using +, and compared for equality using ==.

To iterate through the names (which are strings), use get+params_names, which implements lazy evaluation.

Parameters:

params_names (Iterable[str]) –

Public Methods:

__init__(params_names)

Construct an instance from an Iterable yielding strings.

__len__()

Return the number of parameters contained.

__add__(other)

Return a new RequiredParameters with the concatenated names.

__eq__(other)

Compare two RequiredParameters objects for equality.

get_params_names()

Implement lazy iteration through the contained parameter names.


__add__(other)[source]#

Return a new RequiredParameters with the concatenated names.

Note that this function returns a new object that does not share state with either argument to the addition operator.

Parameters:

other (RequiredParameters) –

Return type:

RequiredParameters

__eq__(other)[source]#

Compare two RequiredParameters objects for equality.

This implementation raises a NotImplemented exception unless both objects are RequireParameters objects.

Two RequireParameters objects are equal if their contained names are equal (including appearing in the same order).

Parameters:

other (object) –

__len__()[source]#

Return the number of parameters contained.

get_params_names()[source]#

Implement lazy iteration through the contained parameter names.

Return type:

Iterator[str]