pyrtma.core_defs.StructArray

class StructArray(msg_struct, len)[source]

Bases: FieldValidator, Sequence, Generic[_S]

Validator for structure arrays

Validator for structure arrays

Parameters:
  • msg_struct (Type[_S]) – Structure class

  • len (int) – Array length

Methods

count

index

Raises ValueError if the value is not present.

pretty_print

Generate formatted string for structure array

validate_array

Validate structure array

validate_many

Validate multiple structures

validate_one

Validate a structure

count(value) integer -- return number of occurrences of value
index(value[, start[, stop]]) integer -- return first index of value.

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

pretty_print(add_tabs=0)[source]

Generate formatted string for structure array

Parameters:

add_tabs (int, optional) – Indent level. Defaults to 0.

Returns:

Formatted string

Return type:

str

validate_array(value)[source]

Validate structure array

Parameters:

value (StructArray[_S]) – StructArray to validate

Raises:

TypeError – Wrong type

validate_many(value)[source]

Validate multiple structures

Parameters:

value (Iterable[_S]) – Structure values to validate

validate_one(value)[source]

Validate a structure

Parameters:

value (_S) – Structure value to validate