HandlerList#

class snake.core.handlers.base.HandlerList(*args)[source]#

Bases: UserList

Represent a Chain of Handler, that needs to be apply to a simulation.

Methods

__init__

append

S.append(value) -- append value to the end of the sequence

clear

copy

count

extend

S.extend(iterable) -- extend sequence by appending elements from the iterable

from_cfg

Create a HandlerList from a configuration.

index

Raises ValueError if the value is not present.

insert

S.insert(index, value) -- insert value before index

pop

Raise IndexError if list is empty or index is out of range.

remove

S.remove(value) -- remove first occurrence of value.

reverse

S.reverse() -- reverse IN PLACE

serialize

Serialize the handlerList as a list of dictionary.

sort

to_yaml

Serialize the handlerList as a yaml string.

Parameters:

args (AbstractHandler)

classmethod from_cfg(cfg)[source]#

Create a HandlerList from a configuration.

Parameters:

cfg (dict[str, Any])

Return type:

HandlerList

to_yaml(filename=None)[source]#

Serialize the handlerList as a yaml string.

Parameters:

filename (str | None)

Return type:

str

serialize()[source]#

Serialize the handlerList as a list of dictionary.

Return type:

list[dict[str, Any]]