ó
    Ð]jÁ6  ã                   óÎ   • S r SSKrSSKrSSKrSSKrSSKrSSKJr  SSKJ	r
  SSKJr  Sr\R                  " S\5      rS	 rS
 rSS jrS rS rS\" 5       4S jrS rS rSS jrg)z>
My own variation on function-specific inspect-like features.
é    N)Úislice)Úopené   )ÚpformatzAargs varargs varkw defaults kwonlyargs kwonlydefaults annotationsÚFullArgSpecc                 óô  • Sn U R                   nUR                  n[        R                  R	                  U5      (       d{  SR                  [        R                  " U 5      S   5      nSnUR                  S5      (       a7  [        R                  " SU5      R                  5       u  p[        U5      nSU-  nX1U4$ [        U5       nUR                  n[        [!        XVS-
  S5      5      nSSS5        SR                  [        R"                  " W5      5      UW4$ ! , (       d  f       N6= f!   [%        U S5      (       a(  ['        U R                   R)                  5       5      US	4s $ [+        U 5      US	4s $ = f)
aï  Attempts to retrieve a reliable function code hash.

The reason we don't use inspect.getsource is that it caches the
source, whereas we want this to be modified on the fly when the
function is modified.

Returns
-------
func_code: string
    The function code
source_file: string
    The path to the file in which the function is defined.
first_line: int
    The first line of the code in the source file.

Notes
------
This function does a bit more magic than inspect, and is thus
more robust.
NÚ r   r   z	<doctest z\<doctest (.*\.rst)\[(.*)\]\>z<doctest %s>Ú__code__éÿÿÿÿ)r
   Úco_filenameÚosÚpathÚexistsÚjoinÚinspectÚgetsourcelinesÚ
startswithÚreÚmatchÚgroupsÚintÚopen_py_sourceÚco_firstlinenoÚlistr   ÚgetblockÚhasattrÚstrÚ__hash__Úrepr)ÚfuncÚsource_fileÚcodeÚsource_codeÚline_noÚsource_file_objÚ
first_lineÚsource_liness           ÚP/home/mande/repo/quber/.venv/lib/python3.13/site-packages/joblib/func_inspect.pyÚget_func_coder)      sL  € ð* €Kð /Ø�}‰}ˆØ×&Ñ&ˆÜ�w‰w�~‰~˜k×*Ñ*ð Ÿ'™'¤'×"8Ò"8¸Ó">¸qÑ"AÓBˆKØˆGØ×%Ñ% k×2Ñ2Ü')§x¢xØ4°kó(ç‘&“(ñ %�ô ˜g›,�Ø,¨{Ñ:�Ø¨WÐ4Ð4ä˜KÔ(¨OØ×,Ñ,ˆJä¤ ÀQ¹ÈÓ MÓNˆL÷ )ð �w‰w”w×'Ò'¨Ó5Ó6¸ÀZÐOÐO÷	 )Õ(ûð
/ô �4˜×$Ñ$ä�t—}‘}×-Ñ-Ó/Ó0°+¸rÐAÒAô ˜“:˜{¨BÐ.Ò.ús0   „B6D, Â;D, Ã%DÃ+/D, Ä
D)Ä%D, Ä,9E7Å'E7c                 ó¾   • SSK n[        US5      (       a  UR                  nOSSKnUR                  R                  nS H  nU R                  X2" U5      5      n M     U $ )z2Windows cannot encode some characters in filename.r   NÚquote)Ú<Ú>Ú!Ú:Ú\)Úurllibr   r+   Úurllib.parseÚparseÚreplace)Ústringr1   r+   Úchars       r(   Ú_clean_win_charsr7   R   sR   € ãäˆv�w×ÑØ—‘‰ó 	à—‘×"Ñ"ˆÛ*ˆØ—‘  e¨D£kÓ2Šñ +à€Mó    c                 ó  • [        U S5      (       a  U R                  nO [        R                  " U 5      nUc  SnUS:X  Ga   [        R                  R                  [        R                  " U 5      5      nUbË  UR                  [        R                  5      nUS   R                  S5      (       a2  US   R                  S	5      nS	R                  USS
 USS -   5      US'   O-[        U5      S
:”  a  US   R                  S5      (       a  SUS'   S	R                  U5      nUR                  S5      (       a  USS nUS	-   U-   nUR                  S5      n[        U S5      (       a  U R                   nO [        U S5      (       a  U R"                  nOSnU(       a7  [        U S5      (       a&  XpR$                  ;   a  U R$                  U   U La  SU-  n[        U S5      (       a=  U R&                  U:w  a-  UR)                  U R&                  R                  S5      SS 5        [        R*                  " U 5      (       a8  [        U S5      (       a'  U R,                  nUR/                  UR"                  5        [        R0                  S:X  a-  U(       a&  [3        U5      nU V	s/ s H  n	[3        U	5      PM     nn	X74$ ! [         a0    [        U S5      (       a  U R
                  R                  n GN´Sn GN¹f = f!   Sn GN„= fs  sn	f )a�  Return the function import path (as a list of module names), and
a name for the function.

Parameters
----------
func: callable
    The func to inspect
resolv_alias: boolean, optional
    If true, possible local aliases are indicated.
win_characters: boolean, optional
    If true, substitute special characters using urllib.quote
    This is useful in Windows, as it cannot encode some filenames
Ú
__module__Ú	__class__ÚunknownNr	   Ú__main__r   z<ipython-inputÚ-é   é   éþÿÿÿÚ
ipykernel_Ú	ipykernelz.pyéýÿÿÿÚ.Ú	func_nameÚ__name__Úfunc_globalsz%s-aliasÚ__qualname__Úim_classÚnt)r   r:   r   Ú	getmoduleÚ	TypeErrorr;   r   r   ÚabspathÚgetsourcefileÚsplitÚsepr   r   ÚlenÚendswithrF   rG   rH   rI   ÚextendÚismethodrJ   ÚappendÚnamer7   )
r    Úresolv_aliasÚwin_charactersÚmoduleÚfilenameÚpartsrP   rW   ÚklassÚss
             r(   Úget_func_namer_   b   s—  € ô ˆt�\×"Ñ"Ø—‘‰ð	#Ü×&Ò& tÓ,ˆFð �~àˆØ�Ôð	Ü—w‘w—‘¤w×'<Ò'<¸TÓ'BÓCˆHð Ñà—N‘N¤2§6¡6Ó*ˆEØ�R‰y×#Ñ#Ð$4×5Ñ5ð ˜b™	Ÿ™¨Ó,�ØŸH™H U¨2¨A Y°°q°r°Ñ%:Ó;��b’	Ü�U“˜a“ E¨"¡I×$8Ñ$8¸×$FÑ$Fð (��b‘	Ø—x‘x “ˆHØ× Ñ  ×'Ñ'Ø# C R˜=�Ø˜c‘\ HÑ,ˆFØ�\‰\˜#Ó€FÜˆt�[×!Ñ!Ø�~‰~‰Ü	��z×	"Ñ	"Ø�}‰}‰àˆæä�4˜×(Ñ(¨T×5FÑ5FÓ-FØ× Ñ  Ñ&¨dÒ2Ø! DÑ(�Üˆt�^×$Ñ$¨×):Ñ):¸dÓ)Bð 	�‰�d×'Ñ'×-Ñ-¨cÓ2°3°BÐ7Ô8Ü×Ò˜×Ñä�4˜×$Ñ$Ø—M‘MˆEØ�M‰M˜%Ÿ.™.Ô)Ü	‡w�w�$ƒž>ä Ó%ˆÙ/5Ó6ªv¨!Ô" 1Ö%©vˆÐ6Øˆ<ÐøôI ó 	#Ü�t˜[×)Ñ)ØŸ™×2Ñ2“à"“ð		#ûð	Ø‹Hüòn 7s)    J6 Á3K3 ÊK=Ê61K0Ë*K0Ë/K0Ë3K:c                 ó$   • SR                  X5      $ )z.Helper function to output a function signaturez{}{})Úformat)Úfunction_nameÚarg_sigs     r(   Ú_signature_strrd   ¼   s   € à�=‰=˜Ó0Ð0r8   c                 ó’   • Sn[        U5      SS nSR                  S UR                  5        5       5      nUR                  XU5      $ )z)Helper function to output a function callz{0}({1}, {2})r   r   ú, c              3   ó8   #   • U  H  u  pU< S U< 3v •  M     g7f)Ú=N© )Ú.0ÚkÚvs      r(   Ú	<genexpr>Ú'_function_called_str.<locals>.<genexpr>Æ   s   é € ÐGº±°£aªÕ+ºùs   ‚)r   r   Úitemsra   )rb   ÚargsÚkwargsÚtemplate_strÚargs_strÚ
kwargs_strs         r(   Ú_function_called_strru   Á   sD   € à"€Lä�D‹z˜!˜BÐ€HØ—‘ÑG¸¿¹¼ÓGÓG€JØ×Ñ˜}¸
ÓCÐCr8   ri   c                 ó²  • [        U5      n[        U[        5      (       a  [        SU< S[	        U5      < S35      e[
        R                  " U 5      (       d>  [
        R                  " U 5      (       d#  U(       a  [        R                  " SU -  SS9  X#S.$ [
        R                  " U 5      n/ n/ n/ nSnSn	UR                  R                  5        GH
  n
U
R                  U
R                  L a  UR                  U
R                   5        O›U
R                  U
R"                  L a7  UR                  U
R                   5        UR                  U
R                   5        OKU
R                  U
R$                  L a  U
R                   nO%U
R                  U
R&                  L a  U
R                   n	U
R(                  U
R*                  Ld  Mï  UR                  U
R(                  5        GM     [
        R                  " U 5      (       aT  U R,                  /U-   n[
        R                  " U R.                  5      n[1        [3        UR                  5      5      nU/U-   n[5        U S	S
9u  pÞ[7        5       nSn[9        U5       Hw  u  nnU[;        U5      :  a;  UU;  a
  UU   UU'   M%  [        SU< S[=        Xä5      < S[?        XâU5      < S35      eU[;        U5      -
  nUU;   a
  UU   UU'   Mn   UU   UU'   My     [7        5       n[E        URG                  5       5       H/  u  nnUU;   a  UUU'   M  U	b  UUU'   M  [I        SU< SU< S35      e   U	b  UUS'   Ub  UUS-   S nUUS'   U H6  nUU;   a  URK                  U5        M  [        SU< S[=        Xä5      < 35      e   U$ ! [@        [B        4 a-  n[        S[=        Xä5      < S[?        XâU5      < S35      UeSnAff = f)a  Filters the given args and kwargs using a list of arguments to
ignore, and a function specification.

Parameters
----------
func: callable
    Function giving the argument specification
ignore_lst: list of strings
    List of arguments to ignore (either a name of an argument
    in the function spec, or '*', or '**')
*args: list
    Positional arguments passed to the function.
**kwargs: dict
    Keyword arguments passed to the function

Returns
-------
filtered_args: list
    List of filtered positional and keyword arguments.
z2ignore_lst must be a list of parameters to ignore z (type z) was givenz4Cannot inspect object %s, ignore list will not work.r?   )Ú
stacklevel)Ú*ú**NF)rX   r   zKeyword-only parameter 'z)' was passed as positional parameter for z:
     z was called.zWrong number of arguments for zIgnore list for z,() contains an unexpected keyword argument 'Ú'ry   r   rx   zIgnore list: argument 'z' is not defined for function )&r   Ú
isinstancer   Ú
ValueErrorÚtyper   rU   Ú
isfunctionÚwarningsÚwarnÚ	signatureÚ
parametersÚvaluesÚkindÚPOSITIONAL_OR_KEYWORDrV   rW   ÚKEYWORD_ONLYÚVAR_POSITIONALÚVAR_KEYWORDÚdefaultÚemptyÚ__self__Ú__func__ÚnextÚiterr_   ÚdictÚ	enumeraterR   rd   ru   Ú
IndexErrorÚKeyErrorÚsortedro   rM   Úpop)r    Ú
ignore_lstrp   rq   rc   Ú	arg_namesÚarg_defaultsÚarg_kwonlyargsÚarg_varargsÚ	arg_varkwÚparamÚclass_method_sigÚ	self_nameÚ_rW   Úarg_dictÚarg_positionÚarg_nameÚpositionÚeÚ	varkwargsÚ	arg_valueÚvarargsÚitems                           r(   Úfilter_argsr¨   Ê   s¤  € ô* �‹:€DÜ�*œc×"Ñ"åã(2´D¸Ö4DðFó
ð 	
ô
 ×Ò˜D×!Ñ!¬'×*<Ò*<¸T×*BÑ*BÞÜ�MŠMØFÈÑMØòð Ñ(Ð(Ü×Ò Ó%€GØ€IØ€LØ€NØ€KØ€IØ×#Ñ#×*Ñ*×,ˆØ�:‰:˜×4Ñ4Ò4Ø×Ñ˜UŸZ™ZÕ(Ø�Z‰Z˜5×-Ñ-Ò-Ø×Ñ˜UŸZ™ZÔ(Ø×!Ñ! %§*¡*Õ-Ø�Z‰Z˜5×/Ñ/Ò/ØŸ*™*‰KØ�Z‰Z˜5×,Ñ,Ò,ØŸ
™
ˆIØ�=‰= §¡Ô+Ø×Ñ §¡×.ñ -ô ×Ò˜×Ñð �M‰Mð
àñˆô #×,Ò,¨T¯]©]Ó;ÐÜœÐ.×9Ñ9Ó:Ó;ˆ	Ø�K )Ñ+ˆ	ô ˜D¨uÑ5�G€AÜ‹v€HØ€LÜ"+¨IÖ"6Ñˆ�hØœ#˜d›)Ó#à˜~Ó-Ø%)¨,Ñ%7�˜Ó"å ó
 !Ü& tÖ5Ü,¨T¸Ö@ðó	ð 	ð $¤c¨)£nÑ4ˆHØ˜6Ó!Ø%+¨HÑ%5�˜Ó"ðØ)5°hÑ)?�H˜XÓ&ñ/ #7ôF “€IÜ% f§l¡l£nÖ5Ñˆ�)Ø�xÓØ!*ˆH�XÓØÑ"Ø"+ˆI�hÓåã+/³ð;óð ñ  6ð ÑØ"ˆ�‰ØÑØ�| aÑ'Ð)Ð*ˆØˆ�‰ó ˆØ�8ÓØ�L‰L˜Öåã!%¤~°dÕ'DðFóð ñ	 ð €OøôO #¤HÐ-ó 	å$ô +¨4Ö9Ü0°¸VÖDð	óð ðûð	ús   Ë!NÎOÎ)(OÏOc                 óH   • [        U SS9n[        U5      S:”  a  SUS S -  nU$ )Nr?   )ÚindentiÜ  z%s...i¼  )r   rR   )ÚargÚformatted_args     r(   Ú_format_argr­   T  s2   € Ü˜C¨Ñ*€MÜ
ˆ=Ó˜DÓ Ø -°°Ð"5Ñ5ˆØÐr8   c                 ó  • [        U 5      u  p4U Vs/ s H  oU(       d  M  UPM     nnU(       a#  UR                  U5        SR                  U5      nOUn[        5       nSnU H5  n	[	        U	5      n
US:”  a  SU
-  n
[        U
5      nUR                  U
5        M7     UR                  UR                  5        VVs/ s H  u  p¼U< S[	        U5      < 3PM     snn5        SR                  U5      nU< SU< S3nXm4$ s  snf s  snnf )	NrE   r   éP   z
%srh   rf   Ú(Ú))r_   rV   r   r   r­   rR   rT   ro   )r    rp   rq   rZ   rW   ÚmÚmodule_pathÚarg_strÚprevious_lengthr«   r¬   rl   Úir�   s                 r(   Úformat_signaturer·   [  sè   € ä  Ó&�L€FÙÓ%š�A£1�a™€FÐ%ÞØ�‰�dÔØ—h‘h˜vÓ&‰àˆÜ‹f€GØ€OÛˆÜ# CÓ(ˆØ˜RÓØ" ]Ñ2ˆMÜ˜mÓ,ˆØ�‰�}Ö%ñ ð ‡N�N¸f¿l¹l¼nÔMºn±d°a›q¤+¨a¥.Ó1¹nÒMÔNØ�i‰i˜Ó €Gã £'Ð*€IØÐ!Ð!ùò% &ùó Ns   ’
C= C=Â9D
c                 óJ   • [        U /UQ70 UD6u  pES< SU< SU< SU< 3nU$ )z\Returns a nicely formatted statement displaying the function
call with the given arguments.
ÚP________________________________________________________________________________z
[z
] Calling z...
)r·   )r    rp   rq   Úobject_namer   r�   Úmsgs          r(   Úformat_callr¼   s  s-   € ô ' tÐ=¨dÒ=°fÑ=�O€DÛ*2³KÃÂyÐ
Q€CØ€Jr8   )TT)ÚMemory)Ú__doc__Úcollectionsr   r   r   r   Ú	itertoolsr   Útokenizer   r   Úloggerr   Úfull_argspec_fieldsÚ
namedtupleÚfull_argspec_typer)   r7   r_   rd   ru   r�   r¨   r­   r·   r¼   ri   r8   r(   Ú<module>rÆ      s�   ðñó Û Û 	Û 	Û Ý Ý +å ð Hð ð  ×*Ò*¨=Ð:MÓNÐ ò6/òrô Wòt1ò
Dð (*±$³&ô GòTò"õ0r8   