src.common.utils
Common utilities for error handling and validation across the Wordle Solver.
Functions
|
Calculate various success metrics from guess history. |
|
Format guess history for display purposes. |
|
Decorator to safely execute operations and handle common exceptions. |
|
Validate result pattern ensuring it contains only valid color codes. |
|
Validate word input ensuring it meets Wordle requirements. |
- src.common.utils.validate_word_input(word, word_length=5)[source]
Validate word input ensuring it meets Wordle requirements.
- Parameters:
- Return type:
- Returns:
The validated and normalized word (uppercase)
- Raises:
InvalidGuessError – If the word is invalid
- src.common.utils.validate_result_pattern(result, expected_length=5)[source]
Validate result pattern ensuring it contains only valid color codes.
- Parameters:
- Return type:
- Returns:
The validated and normalized result pattern (uppercase)
- Raises:
InvalidResultError – If the result pattern is invalid
- src.common.utils.safe_execute(operation_name='operation')[source]
Decorator to safely execute operations and handle common exceptions.
- Parameters:
operation_name (
str
) – Name of the operation for error messages