Source code for mafw.models.loop_payloads

#  Copyright 2025–2026 European Union
#  Author: Bulgheroni Antonio (antonio.bulgheroni@ec.europa.eu)
#  SPDX-License-Identifier: EUPL-1.2
"""
Loop payload dataclasses for parallel processors.

.. versionadded:: v2.1.0

"""

from __future__ import annotations

from dataclasses import dataclass
from typing import Any

from mafw.enumerators import LoopingStatus


[docs] @dataclass(slots=True) class LoopItem: """Container for a loop item and its position.""" i_item: int """Index of the item within the loop.""" n_item: int """Total number of items in the loop.""" payload: Any """The item payload."""
[docs] @dataclass(slots=True) class LoopResult: """Container for a loop result and its status.""" i_item: int """Index of the item within the loop.""" n_item: int """Total number of items in the loop.""" looping_status: LoopingStatus """Looping status produced while processing the item.""" payload: Any """Optional result payload returned by the processor.""" duration: float """Wall clock duration of the item processing."""
__all__ = ['LoopItem', 'LoopResult'] """Public exports for loop payload dataclasses."""