Module

parsing.blocks.list.trace

Debug tracing for list parsing.

Enable via PATITAS_DEBUG=list environment variable or programmatically.

Usage:

# Enable tracing
from patitas.parsing.blocks.list.trace import enable_trace
enable_trace()

# In list parsing code:
from .trace import trace
trace("handle_blank_line", token=tok.value, indent=check_indent, result="EndItem")

Classes

trace_scope 3
Context manager for indented trace scopes. Usage: with trace_scope("parse_list_item", marker="…

Context manager for indented trace scopes.

Usage:

with trace_scope("parse_list_item", marker="1."):
    # traces within here will be indented
    trace("found_content", line="foo")

Methods

Internal Methods 3
__init__ 1
def __init__(self, event: str, **kwargs: Any)
Parameters
Name Type Description
event
__enter__ 0 trace_scope
def __enter__(self) -> trace_scope
Returns
trace_scope
__exit__ 0
def __exit__(self, *args: Any) -> None

Functions

enable_trace 0 None
Enable list parsing tracing programmatically.
def enable_trace() -> None
disable_trace 0 None
Disable list parsing tracing.
def disable_trace() -> None
is_trace_enabled 0 bool
Check if tracing is enabled.
def is_trace_enabled() -> bool
Returns
bool
trace 1 None
Log a trace event if tracing is enabled.
def trace(event: str, **kwargs: Any) -> None
Parameters
Name Type Description
event str

Event name (e.g., "parse_list", "handle_blank_line") **kwargs: Key-value pairs to include in trace output

trace_decision 3 None
Trace a decision point with its inputs and outcome.
def trace_decision(event: str, condition: str, result: bool, **context: Any) -> None
Parameters
Name Type Description
event str

Decision event name

condition str

The condition being evaluated (as string)

result bool

The boolean result **context: Additional context values