Switch

class ase2sprkkr.common.configuration_definitions.Switch(item, values, name=None, template=None)[source]

Items of this class can control, which elements of grammar will be active and which not

Class hierarchy

Inheritance diagram of ase2sprkkr.common.configuration_definitions.Switch

Constructor

__init__(item, values, name=None, template=None)[source]
Parameters:
  • item – The name of Option, whose value determine the active elements

  • values

    Dictionary, with the possible values of the item in the keys and the active elements in the values.

    example:

    V('TYPE', Keyword('SCALAR', 'COMPLEX'),
    Switch(
        {'SCALAR' : V('SCALAR' : int),
       'COMPLEX': V('COMPLEX', complex) }
    

    desribes both the following files:

    TYPE=SCALAR
    SCALAR=1
    
    and::

    TYPE=COMPLEX COMPLEX=1e5 7e5

  • name – Not needed to be supplied, it can be autogenerated.

create_object = None
empty = Empty
Parameters:

name (str | None) –

Return type:

ParserElement

copy()[source]
all_values()[source]
item_hook(grammar)[source]
prepare_grammar(definition, grammar)[source]
remove_from_container()[source]
added_to_container(container)[source]

Hook called, when the object is assigned to the container (currently from the container constructor)