Coverage for src / mafw / models / loop_payloads.py: 100%

26 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-03-30 16:10 +0000

1# Copyright 2025–2026 European Union 

2# Author: Bulgheroni Antonio (antonio.bulgheroni@ec.europa.eu) 

3# SPDX-License-Identifier: EUPL-1.2 

4""" 

5Loop payload dataclasses for parallel processors. 

6 

7.. versionadded:: v2.1.0 

8 

9""" 

10 

11from __future__ import annotations 

12 

13from dataclasses import dataclass 

14from typing import Any 

15 

16from mafw.enumerators import LoopingStatus 

17 

18 

19@dataclass(slots=True) 

20class LoopItem: 

21 """Container for a loop item and its position.""" 

22 

23 i_item: int 

24 """Index of the item within the loop.""" 

25 

26 n_item: int 

27 """Total number of items in the loop.""" 

28 

29 payload: Any 

30 """The item payload.""" 

31 

32 

33@dataclass(slots=True) 

34class LoopResult: 

35 """Container for a loop result and its status.""" 

36 

37 i_item: int 

38 """Index of the item within the loop.""" 

39 

40 n_item: int 

41 """Total number of items in the loop.""" 

42 

43 looping_status: LoopingStatus 

44 """Looping status produced while processing the item.""" 

45 

46 payload: Any 

47 """Optional result payload returned by the processor.""" 

48 

49 duration: float 

50 """Wall clock duration of the item processing.""" 

51 

52 

53__all__ = ['LoopItem', 'LoopResult'] 

54"""Public exports for loop payload dataclasses."""