Ë
    äÞËjú  ã                  óŠ  — d Z ddlmZ ddlZddlZd„ Zd„ Zd„ Zd„ Zd„ Z	d	„ Z
ej                  j                  fd
„Zej                  j                  fd„Zej                  j                  fd„Zej                  j                  fd„Zedk(  r8ddlZej&                  Z ej*                  de¬«        ej,                  e¬«       yy)aª  Echo calls made to functions and methods 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).

Example: to echo calls made to functions in "my_module" do:

  import echo
  import my_module
  echo.echo_module(my_module)

Example: to echo calls made to functions in "my_module.my_class" do:

  echo.echo_class(my_module.my_class)

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


é    )ÚannotationsNc                ó   — | j                   S )zReturn an item's name.)Ú__name__)Úitems    úP/var/www/photos/backend/venv/lib/python3.12/site-packages/watchdog/utils/echo.pyÚnamer   *   s   € à�=‰=Ðó    c                óL   — t        j                  | «      xr | j                  |u S )z0Determine if an instancemethod is a classmethod.)ÚinspectÚismethodÚ__self__)ÚinstancemethodÚklasss     r   Úis_classmethodr   /   s#   € ä×Ñ˜NÓ+ÒP°×0GÑ0GÈ5Ð0PÐPr	   c                óJ   ‡ — t        ˆ fd„|j                  «       D «       d«      S )z6Returns True if method is an instance method of klass.c              3  óš   •K  — | ]B  }t        ‰«      |j                  v sŒt        |j                  t        ‰«         t        «      –— ŒD y ­w)N)r   Ú__dict__Ú
isinstanceÚstaticmethod)Ú.0ÚcÚmethods     €r   ú	<genexpr>z#is_static_method.<locals>.<genexpr>7   s:   øè ø€ ÒoÀÔTXÐY_ÓT`Ðde×dnÑdnÒTnŒ�A—J‘Jœt F›|Ñ,¬l×	;Ñoùs
   ƒA +AF)ÚnextÚmro)r   r   s   ` r   Úis_static_methodr   4   s!   ø€ äÛoÀUÇYÁYÃ[ÔoØóð r	   c                óL   — | j                  d«      xr | j                  d«       S )z,Determine if a name is a class private name.Ú__)Ú
startswithÚendswith)r   s    r   Úis_class_private_namer!   <   s$   € ð �?‰?˜4Ó Ò<¨¯©°tÓ)<Ð%<Ð<r	   c                óz   — t        | «      }t        |«      r$dt        | j                  j                  «      › |› �}|S )z©Return a method's name.

    This function returns the name the method is accessed by from
    outside the class (i.e. it prefixes "private" methods appropriately).
    Ú_)r   r!   r   Ú	__class__)r   Úmnames     r   Úmethod_namer&   B   s:   € ô �‹L€EÜ˜UÔ#Ø”D˜Ÿ™×2Ñ2Ó3Ð4°U°GÐ<ˆØ€Lr	   c                ó   — | \  }}|› d|›�S )zuReturn a string representing a (name, value) pair.

    >>> format_arg_value(("x", (1, 2, 3)))
    'x=(1, 2, 3)'
    ú=© )Úarg_valÚargÚvals      r   Úformat_arg_valuer-   N   s   € ð �H€CˆØˆU�!�C�7ÐÐr	   c           
     ó  ‡ ‡‡‡‡— ddl }‰ j                  }|j                  Š|j                  d‰ Š‰ j                  xs g }t        t        t        ‰t        |«       d |«      «      «      Š|j                  ‰ «      ˆˆˆˆ ˆfd„«       }|S )zÆEcho 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.
    r   Nc                 óÌ  •— 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   } ‰t        ‰«      › ddj                  |«      › d�«        ‰| i |¤ŽS c c}w )Nú(z, z)
)	ÚlistÚmapr-   ÚzipÚlenÚreprÚitemsr   Újoin)ÚvÚkÚ
positionalÚaÚ	defaultedÚnamelessÚkeywordÚargsÚargcountÚargdefsÚargnamesÚfnÚwrites           €€€€€r   Úwrappedzecho.<locals>.wrappedh   sÕ   ø€ ô œ#Ô.´´S¸À1Ó5EÓ0FÓGÓHˆ
Ø@HÌÈQËÈÐ@RÖa¸1ÐVWÐ_`ÒV`Ô% q¨'°!©* oÕ6Ðaˆ	ÐaÜœœD ! H I ,Ó/Ó0ˆÜ”sÔ+¬T°!·'±'³)«_Ó=Ó>ˆØ˜IÑ%¨Ñ0°7Ñ:ˆÙ”�b“�
˜!˜DŸI™I d›OÐ,¨CÐ0Ô1Ù�1ˆ{˜‰{Ðùò bs   ¾	C!ÁC!)
Ú	functoolsÚ__code__Úco_argcountÚco_varnamesÚ__defaults__Údictr1   r3   r4   Úwraps)	rC   rD   rF   ÚcodeÚfn_defaultsrE   r@   rA   rB   s	   ``    @@@r   ÚechorO   X   s†   ü€ ó ð �;‰;€DØ×Ñ€HØ×Ñ 	 Ð*€HØ—/‘/Ò' R€KÜ”4œ˜H¤c¨+Ó&6Ð%6Ð%8Ð9¸;ÓGÓHÓI€Gà‡_�_�RÓ÷	ó ð	ð €Nr	   c           
     óÄ   — t        |«      }d}||v ryt        || «      r+t        | |t        t	        |j
                  |«      «      «       yt        | |t	        ||«      «       y)z­Change an instancemethod so that calls to it are echoed.

    Replacing a classmethod is a little more tricky.
    See: http://www.python.org/doc/current/ref/types.html
    )Ú__str__Ú__repr__N)r&   r   ÚsetattrÚclassmethodrO   Ú__func__)r   r   rD   r%   Ú
never_echos        r   Úecho_instancemethodrW   w   s[   € ô ˜Ó€Eð€Jð �
ÑØÜ	˜ Ô	&Ü��uœk¬$¨v¯©ÀÓ*FÓGÕHä��uœd 6¨5Ó1Õ2r	   c                óT  — t        j                  | t         j                  «      D ]  \  }}t        | ||«       Œ t        j                  | t         j                  «      D ]H  \  }}t        || «      r*t        | t        |«      t        t        ||«      «      «       Œ<t        | ||«       ŒJ y)z0Echo calls to class methods and static functionsN)
r   Ú
getmembersr   rW   Ú
isfunctionr   rS   r   r   rO   )r   rD   r#   r   rC   s        r   Ú
echo_classr[   Š   s�   € ä×'Ñ'¨¬w×/?Ñ/?Ó@ò 2‰	ˆˆ6ä˜E 6¨5Õ1ð2ô ×#Ñ# E¬7×+=Ñ+=Ó>ò 2‰ˆˆ2Ü˜B Ô&Ü�Eœ4 ›8¤\´$°r¸5³/Ó%BÕCô    r¨5Õ1ñ2r	   c           	     óú   — t        j                  | t         j                  «      D ]  \  }}t        | |t	        ||«      «       Œ t        j                  | t         j
                  «      D ]  \  }}t        ||«       Œ y)z0Echo calls to functions and methods in a module.N)r   rY   rZ   rS   rO   Úisclassr[   )ÚmodrD   ÚfnamerC   r#   r   s         r   Úecho_moduler`   —   sh   € ä×'Ñ'¨¬W×-?Ñ-?Ó@ò -‰	ˆˆrÜ��UœD  U›OÕ,ð-ä×&Ñ& s¬G¯O©OÓ<ò !‰ˆˆ5Ü�5˜%Õ ñ!r	   Ú__main__zechoexample.txt)Úoptionflags)Ú__doc__Ú
__future__r   r   Úsysr   r   r   r!   r&   r-   ÚstdoutrD   rO   rW   r[   r`   r   ÚdoctestÚELLIPSISrb   ÚtestfileÚtestmodr)   r	   r   ú<module>rk      sÂ   ðñõ8 #ã Û 
òò
Qò
ò=ò	òð —:‘:×#Ñ#ó ð> .1¯Z©Z×-=Ñ-=ó 3ð&  ŸJ™J×,Ñ,ó 
2ð Ÿ:™:×+Ñ+ó !ð ˆzÒÛà×"Ñ"€KØ€G×ÑÐ&°KÕ@Ø€G‡O�O Ö,ð r	   