gemseo.core.grammars.required_names module#

Grammar required names.

class RequiredNames(grammar, names=())[source]#

Bases: MutableSet[str]

A set-like class for handling grammar required names.

The names in an instance of this class shall belong to the bound grammar.

Parameters:
  • grammar (BaseGrammar) -- The grammar bound to the required names.

  • names (Iterable[str]) --

    The required names.

    By default it is set to ().

add(name)[source]#

Add an element.

Parameters:

name (str)

Return type:

None

discard(name)[source]#

Remove an element. Do not raise an exception if absent.

Parameters:

name (str)

Return type:

None

get_names_difference(other)[source]#

Return the names that are not in other.

If only the names matter, this method is much faster than computing instance differences.

Parameters:

other (Iterable[str]) -- The names to be discarded.

Returns:

The names that are not in other.

Return type:

set[str]