pipeline.src.helpers.controls

Functions

make_infractions(→ List[dict])

Generates a list of infraction dicts.

Module Contents

pipeline.src.helpers.controls.make_infractions(natinfs: None | Set[int], infraction_type: src.entities.missions.InfractionType) List[dict][source]

Generates a list of infraction dicts.

Parameters:
  • natinfs (Union[None, Set[int]]) – Set of infractions natinfs.

  • infraction_type (InfractionType) – infraction_type to set in the infractions.

Raises:

ValueError – If both only_natinfs and exclude_natinfs are given.

Returns:

list of the form [{“natinf”: 1234}, {“natinf”: 9876}]

Return type:

List[dict]

Examples

>>> make_infractions({1, 2, 4}, InfractionType.WITH_RECORD)
[
    {"natinf": 1, "infractionType": "WITH_RECORD"},
    {"natinf": 2, "infractionType": "WITH_RECORD"},
    {"natinf": 4, "infractionType": "WITH_RECORD"}
]
>>> make_infractions(None, InfractionType.WITH_RECORD)
[]
>>> make_infractions({}, InfractionType.WITH_RECORD)
[]