
    XhB                     \    d dl mZ ddlmZ d dlmZ  G d d          Zdedd	fd
Z	ddZ
d	S )    )proton   )get_profiling_onwrapsc                   6    e Zd ZdZdeddfdZd Zd	dZd ZdS )
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.
    namereturnNc                     || _         d S Nr
   )selfr
   s     g/var/www/tools.fuzzalab.pt/emblema-extractor/venv/lib/python3.11/site-packages/triton/profiler/state.py__init__zstate.__init__   s    			    c                 X    t                      s| S t          j        | j                   | S r   )r   	libprotonenter_stater
   )r   s    r   	__enter__zstate.__enter__   s-    !! 	Kdi(((r   c                 L    t                      sd S t          j                     d S r   )r   r   
exit_state)r   exc_type	exc_value	tracebacks       r   __exit__zstate.__exit__%   s*    !! 	Fr   c                 @     t                     fd            }|S )Nc                      t                      rt          j        j                    | i |}t                      rt          j                     |S r   )r   r   r   r
   r   )argskwargsretfuncr   s      r   wrapperzstate.__call__.<locals>.wrapper,   sZ    !! 1%di000$'''C!! '$&&&Jr   r   )r   r"   r#   s   `` r   __call__zstate.__call__*   s9    	t	 	 	 	 	 
	 r   r   N)	__name__
__module____qualname____doc__strr   r   r   r$    r   r   r	   r	      sr         *S T         
    r   r	   r
   r   Nc                 .    t          j        |            d S r   )r   r   r   s    r   r   r   8   s    $r   c                  ,    t          j                     d S r   )r   r   r+   r   r   r   r   <   s    r   r%   )triton._C.libprotonr   r   flagsr   	functoolsr   r	   r*   r   r   r+   r   r   <module>r1      s    3 3 3 3 3 3 # # # # # #      / / / / / / / /d c  d             r   