K iBTddlmZddlmZddlmZGddZdedd fd Z d d Z y ) )proton)get_profiling_onwrapsc4eZdZdZdeddfdZdZd dZdZy) stateaz A context manager and decorator for entering and exiting a state. Usage: context manager: ```python with proton.state("test0"): foo[1,](x, y) ``` decorator: ```python @proton.state("test0") def foo(x, y): ... ``` Args: name (str): The name of the state. namereturnNc||_yNr )selfr s [/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/triton/profiler/state.py__init__zstate.__init__s  c\ts|Stj|j|Sr )r libproton enter_stater )rs r __enter__zstate.__enter__s$!Kdii( rcBtsytjyr )rr exit_state)rexc_type exc_value tracebacks r__exit__zstate.__exit__%s! rc2tfd}|S)Nctrtjj|i|}trtj|Sr )rrrr r)argskwargsretfuncrs rwrapperzstate.__call__..wrapper,sA!%%dii0''C!$$&Jrr)rr"r#s`` r__call__zstate.__call__*s t   rr N) __name__ __module__ __qualname____doc__strrrrr$rrr r s)*ST  rr r r Nc.tj|yr )rrrs rrr8s $rc,tjyr )rrr+rrrr<s rr%) triton._C.libprotonrrflagsr functoolsrr r*rrr+rrr1s13#//d c d r