Repeated

class ase2sprkkr.common.repetition.Repeated(*values)[source]

Describe how repeated configuration items are parsed and stored.

Class hierarchy

Inheritance diagram of ase2sprkkr.common.repetition.Repeated


Constructor

__init__(type, key_type=<function Key.NONE>, is_numbered=Numbering.NO, has_header=True)[source]
Parameters:
class Type(*values)[source]

Storage used for a repeated item.

NO = None
ARRAY = <class 'numpy.ndarray'>
LIST = <class 'list'>
DICT = <class 'dict'>
class Numbering(*values)[source]

Numbering used by an item name.

NO = 0
YES = 1
WITH_DEFAULT = 2
property has_default
property grammar_numbering

Numbering syntax accepted by the parser.

property numbering_condition

Condition controlling output numbering, if there is one.

numbering_for(option)[source]

Return the numbering to use when writing option.

Parameters:

option (Option)

Return type:

ase2sprkkr.common.repetition.Repeated.Numbering

static NUMBERED_IF(condition)[source]

Create a dense repetition numbered when condition(option) is true.

Parameters:

condition (Callable[[Option], bool])

Return type:

RepeatedNumberedIf

classmethod create(value, default)[source]
property is_array
property is_dict
NO = Type.NO
IGNORED = (Type.NO, <class fIgnoredKey>)
REPEATED = (Type.LIST, <class fRepeatedKey>)
ARRAY = (Type.ARRAY, <class fRepeatedKey>)
LIST_SECTION = (Type.LIST, <function Key.NONE>, Numbering.NO, False)
DICT_SECTION = (Type.DICT, <function Key.NONE>, Numbering.NO, False)
NUMBERED = (Type.ARRAY, <class fArrayKey>, Numbering.YES)
DICT = (Type.DICT, <class fDictKey>, Numbering.YES)
DEFAULTDICT = (Type.DICT, <class fDefDictKey>, Numbering.WITH_DEFAULT)