String formatter
Pretty formatting for Operation objects.
This module provides functionality to convert Operation objects into human-readable formatted strings. The format is Pythonic and preserves all information including nested operations, lists, tuples, and dicts.
ARCHITECTURE
format_value() - Single entry point for ALL formatting ├── _format_categorical() - Internal handler for Categorical ├── _format_float() - Internal handler for Float ├── _format_integer() - Internal handler for Integer ├── _format_resampled() - Internal handler for Resample ├── _format_repeated() - Internal handler for Repeated ├── _format_operation() - Internal handler for Operation ├── _format_sequence() - Internal handler for list/tuple └── _format_dict() - Internal handler for dict
All str methods should call format_value() directly. All internal formatters call format_value() for nested values.
FormatterStyle
dataclass
#
FormatterStyle(
indent_str: str = " ",
max_line_length: int = 90,
compact_threshold: int = 40,
show_empty_args: bool = True,
)
Configuration for the formatting style.
format_value
#
format_value(
value: Any,
indent: int = 0,
style: FormatterStyle | None = None,
) -> str
Format any value with proper indentation and style.
This is the SINGLE entry point for all formatting in NePS. All str methods should delegate to this function.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
The value to format (any type)
TYPE:
|
indent
|
Current indentation level
TYPE:
|
style
|
Formatting style configuration
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
Formatted string representation |