Implemented foundation of task-flow-engine

This commit is contained in:
2026-05-01 22:19:03 +02:00
parent de540e6341
commit 4be941e65e
13 changed files with 993 additions and 5 deletions

View File

@@ -0,0 +1,37 @@
from __future__ import annotations
from collections.abc import Sequence
from typing import Any
EMPTY_VALUES = (None, "", [], {}, ())
def all_eq(values: list[Any], expected: Any) -> bool:
return all(_matches(value, expected) for value in values)
def any_eq(values: list[Any], expected: Any) -> bool:
return any(_matches(value, expected) for value in values)
def none_eq(values: list[Any], expected: Any) -> bool:
return all(not _matches(value, expected) for value in values)
def exists(values: list[Any], expected: Any = None) -> bool:
return any(value not in EMPTY_VALUES for value in values)
def count_gte(values: list[Any], expected: Any) -> bool:
try:
threshold = int(expected)
except (TypeError, ValueError):
return False
return len(values) >= threshold
def _matches(value: Any, expected: Any) -> bool:
if isinstance(expected, Sequence) and not isinstance(expected, (str, bytes, bytearray)):
return value in expected
return value == expected