Coverage for src/foapy/core/_mode.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-05-17 20:45 +0000

1class mode: 

2 """ 

3 Mode enumeration used to determinate handling the intervals at the sequence boundaries. 

4 

5 Examples 

6 ---------- 

7 

8 See [foapy.intervals()][foapy.intervals] function for code examples using modes. 

9 

10 Example how different modes handle intervals are extracted when binding.start 

11 

12 === "mode.normal" 

13 

14 | | b | a | b | c | b | 

15 |:------:|:--:|:--:|:--:|:--:|:--:| 

16 | b | 1 | -> | 2 | -> | 2 | 

17 | a | -> | 2 | | | | 

18 | c | -> | -> | -> | 4 | | 

19 | result | 1 | 2 | 2 | 4 | 2 | 

20 

21 === "mode.cycle" 

22 

23 | | transition | a | b | c | b | b | transition | 

24 |:------:|:----------:|:--:|:--:|:--:|:--:|:--:|:----------:| 

25 | b | (1) | 1 | -> | 2 | -> | 2 | (1) | 

26 | a | (2) | -> | 5 | -> | -> | -> | (2) | 

27 | c | (3) | -> | -> | -> | 5 | -> | (3) | 

28 | result | | 1 | 5 | 2 | 5 | 2 | | 

29 

30 === "mode.lossy" 

31 

32 | | b | a | b | c | b | 

33 |:------:|:--:|:--:|:--:|:--:|:--:| 

34 | b | x | -> | 2 | -> | 2 | 

35 | a | -> | x | | | | 

36 | c | -> | -> | -> | x | | 

37 | result | | | 2 | | 2 | 

38 

39 === "mode.redundant" 

40 

41 | | a | b | c | b | b | end | 

42 |:------:|:--:|:--:|:--:|:--:|:--:|:-----:| 

43 | b | 1 | -> | 2 | -> | 2 | 1 | 

44 | a | -> | 2 | -> | -> | -> | 4 | 

45 | c | -> | -> | -> | 4 | -> | 2 | 

46 | result | 1 | 2 | 2 | 4 | 2 | 1 4 2 | 

47 

48 

49 """ # noqa: E501 

50 

51 lossy: int = 1 

52 """ 

53 Ignore boundary intervals 

54 """ 

55 

56 normal: int = 2 

57 """ 

58 Include first/last boundary interval based on binding 

59 """ 

60 

61 cycle: int = 3 

62 """ 

63 Sumarize boundary intervals as one cyclic interval 

64 """ 

65 

66 redundant: int = 4 

67 """ 

68 Include both (first and last) boundary intervals 

69 """