
    g                        d Z ddlmZ ddlZddlZddlmZ erddlmZmZ ddZ	ej                  j                  fd	dZy)
a  Echo calls made to functions in a module.

"Echoing" a function call means printing out the name of the function
and the values of its arguments before making the call (which is more
commonly referred to as "tracing", but Python already has a trace module).

Alternatively, echo.echo can be used to decorate functions. Calls to the
decorated function will be echoed.

Example:
-------

    @echo.echo
    def my_function(args):
        pass

    )annotationsN)TYPE_CHECKING)AnyCallablec                    | \  }}| d|S )z2Return a string representing a (name, value) pair.= )arg_valargvals      H/var/www/openai/venv/lib/python3.12/site-packages/watchdog/utils/echo.pyformat_arg_valuer   $   s    HCU!C7    c           
          j                   }|j                  |j                  d  j                  xs d}t	        t        t        t        |       d |                  t        j                         d fd       }|S )zEcho calls to a function.

    Returns a decorated version of the input function which "echoes" calls
    made to it by writing out the function's name and the arguments it was
    called with.
    Nr	   c                    t        t        t        t        t        
|                         }
t	        |       d  D cg c]  }||vst        |	|   f       }}t        t        t
        | d              }t        t        t        t        |j                                           }||z   |z   |z   } j                   ddj                  |       d        | i |S c c}w )N(z, z)
)	listmapr   ziplenrepritems__name__join)vk
positionala	defaultednamelesskeywordargsargcountargdefsargnamesfnwrites           r   wrappedzecho.<locals>.wrapped8   s     #.S15E0FGH
@HQ@Ra@R1VW_`V`%q'!*o6@R	aD!HI,/0s+T!'')_=>I%07:Qtyy/s341{{ bs   	C"C")r   r   r   r   returnr   )
__code__co_argcountco_varnames__defaults__dictr   r   r   	functoolswraps)r&   r'   codefn_defaultsr(   r#   r$   r%   s   ``   @@@r   echor3   *   s     ;;DH	*H oo3K4Hc+&6%6%89;GHIG__R	 	 	 Nr   )r
   ztuple[str, tuple[Any, ...]]r)   str)r&   r   r'   zCallable[[str], int | None]r)   r   )__doc__
__future__r   r/   systypingr   r   r   r   stdoutr'   r3   r	   r   r   <module>r:      s8   $ #  
  $ =@JJ<L<L r   