taps.run.utils¶
change_cwd() ¶
Context manager that changes the current working directory.
Parameters:
Yields:
Source code in taps/run/utils.py
        flatten_mapping() ¶
flatten_mapping(
    mapping: MutableMapping[str, Any],
    parent_key: str = "",
    separator: str = ".",
) -> dict[str, Any]
Flatten the keys of nested mappings/dicts.
Parameters:
- 
        
mapping(MutableMapping[str, Any]) –Nested mapping to flatten.
 - 
        
parent_key(str, default:'') –Prefix of parent keys when this function is called recursively.
 - 
        
separator(str, default:'.') –Separator between key parts.
 
Returns:
Source code in taps/run/utils.py
        prettify_mapping() ¶
Turn a mapping into a nicely formatted string.
Example
Source code in taps/run/utils.py
        prettify_validation_error() ¶
prettify_validation_error(
    error: ValidationError,
    model: type[BaseModel] | None = None,
) -> ValueError
Parse a Pydantic validation error into a ValueError.
Given a ValidationError,
pydantic_core._pydantic_core.ValidationError: 2 validation errors for GeneratedConfig
app.matrix_size
  Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='100x', input_type=str]
    For further information visit https://errors.pydantic.dev/2.7/v/int_parsing
engine.executor.max_threads
  Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='1.5', input_type=str]
    For further information visit https://errors.pydantic.dev/2.7/v/int_parsing
ValueError with a more readable output.
ValueError: Found 2 validation errors:
  - Input should be a valid integer, unable to parse string as an integer
    Attribute: app.matrix_size
    Input (str): '100x'
    Error type: int_parsing (https://errors.pydantic.dev/2.7/v/int_parsing)
  - Input should be a valid integer, unable to parse string as an integer
    Attribute: engine.executor.max_threads
    Input (str): '1.5'
    Error type: int_parsing (https://errors.pydantic.dev/2.7/v/int_parsing)
Source code in taps/run/utils.py
        update_environment() ¶
Context manager that updates environment variables.
Parameters: