Files
AutoMetabuilder/backend/autometabuilder/workflow/value_helpers.py
johndoe6345789 877ba64de8 Introduce AutoMetabuilder core components and workflow packages:
- Implement core components: CLI argument parsing, environment loading, GitHub service creation, and logging configuration.
- Add support for OpenAI client setup and model resolution.
- Develop SDLC context loader from GitHub and repository files.
- Implement workflow context and engine builders.
- Introduce major workflow packages: `game_tick_loop` and `contextual_iterative_loop`.
- Update localization files with new package descriptions and labels.
- Streamline web navigation by loading items from a dedicated JSON file.
2026-01-10 00:45:46 +00:00

40 lines
1.2 KiB
Python

"""Helpers for normalizing workflow values."""
class ValueHelpers:
"""Normalize values for workflow helpers."""
@staticmethod
def ensure_list(value):
"""Return a list for any incoming value."""
if value is None:
return []
if isinstance(value, list):
return value
if isinstance(value, (tuple, set)):
return list(value)
if isinstance(value, str):
return [line for line in value.splitlines() if line.strip()]
return [value]
@staticmethod
def coerce_bool(value) -> bool:
"""Coerce values into booleans."""
if isinstance(value, bool):
return value
if isinstance(value, str):
lowered = value.strip().lower()
if lowered in ("true", "yes", "1"):
return True
if lowered in ("false", "no", "0", ""):
return False
return bool(value)
@staticmethod
def normalize_separator(text):
"""Normalize escaped separators."""
if text is None:
return ""
if isinstance(text, str):
return text.replace("\\n", "\n").replace("\\t", "\t")
return str(text)