§
    ãóÉjë?  ã                   óâ   — d Z ddlZddlZddlZddlZddlZddlZddlZddlm	Z	 ddl
mZ ddlmZ dZ ej        de¦  «        Zd	„ Zd
„ Zd„ Zdd„Zd„ Zd„ Zd e¦   «         fd„Zd„ Zd„ Zdd„ZdS )z>
My own variation on function-specific inspect-like features.
é    N)Úislice)Úopené   )ÚpformatzAargs varargs varkw defaults kwonlyargs kwonlydefaults annotationsÚFullArgSpecc                 ó¸  — | j         | j                             ¦   «         t          | dd¦  «                             ¦   «         g| j        ¢| j        ¢| j        ¢| j        ¢t          t          | j
        | j        | j        | j        f¦  «        ¢}| j        D ]a}t          |t           j        ¦  «        r#|                     t'          |¦  «        ¦  «         Œ?|                     t          |¦  «        ¦  «         Œbt)          j        dd¬¦  «        }|                     d                     |¦  «                             dd¬	¦  «        ¦  «         |                     ¦   «         S )
aÉ  Digest the contents of a code object.

    ``hash(code)`` would be simpler, but it hashes the strings it is built from
    and those are salted by PYTHONHASHSEED. This value is written to
    func_code.py and compared by *other* processes, which then conclude the
    function changed and wipe its cache directory (#1694).

    The fields below mirror CPython's own ``code_hash()``:
    https://github.com/python/cpython/blob/5918085bb6f4a3a48193cacb9bb99b044d4e0452/Objects/codeobject.c#L2608-L2624
    co_localsplusnames is spelled out as varnames/cellvars/freevars. Only the
    position information, co_firstlineno and co_linetable, is deliberately left
    out: joblib compares source *text* and tracks the line number separately,
    so moving a function without editing it must not invalidate its cache. For
    the same reason co_filename is not included, unlike ``marshal.dumps``,
    which would key a notebook function to the cell number it last ran in.
    Úco_exceptiontableó    Úmd5F)Úusedforsecurityú
zutf-8Úreplace)Úerrors)Úco_nameÚco_codeÚhexÚgetattrÚco_namesÚco_varnamesÚco_cellvarsÚco_freevarsÚmapÚreprÚco_argcountÚco_posonlyargcountÚco_kwonlyargcountÚco_flagsÚ	co_constsÚ
isinstanceÚtypesÚCodeTypeÚappendÚ_code_fingerprintÚhashlibÚnewÚupdateÚjoinÚencodeÚ	hexdigest)ÚcodeÚpartsÚconstÚdigests       úv/home/lighthouse/badge-speaker-benchmark/.benchmark-venv-community/lib/python3.11/site-packages/joblib/func_inspect.pyr#   r#      sZ  € ð$ 	ŒàŒ×ÒÑÔå�Ð)¨3Ñ/Ô/×3Ò3Ñ5Ô5ðð 
Œðð 
Ô	ðð 
Ô	ðð 
Ô	ðõ 
ÝàÔ ØÔ'ØÔ&Ø”ð	ñ

ô 

ð€Eð( ”ð &ð &ˆå�e�Uœ^Ñ,Ô,ð 	&Ø�LŠLÕ*¨5Ñ1Ô1Ñ2Ô2Ð2Ð2à�LŠL�˜e™œÑ%Ô%Ð%Ð%ÝŒ[˜°Ð6Ñ6Ô6€FØ
‡M‚M�$—)’)˜EÑ"Ô"×)Ò)¨'¸)Ð)ÑDÔDÑEÔEÐEØ×ÒÑÔÐr
   c                 óæ  — d}	 | j         }|j        }t          j                             |¦  «        s‡d                     t          j        | ¦  «        d         ¦  «        }d}|                     d¦  «        r>t          j
        d|¦  «                             ¦   «         \  }}t          |¦  «        }d|z  }|||fS t          |¦  «        5 }|j        }t          t!          ||dz
  d¦  «        ¦  «        }ddd¦  «         n# 1 swxY w Y   d                     t          j        |¦  «        ¦  «        ||fS #  t%          | d¦  «        rt'          | j         ¦  «        |d	fcY S t)          | ¦  «        |d	fcY S xY w)
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__éÿÿÿÿ)r1   Úco_filenameÚosÚpathÚexistsr'   ÚinspectÚgetsourcelinesÚ
startswithÚreÚmatchÚgroupsÚintÚopen_py_sourceÚco_firstlinenoÚlistr   ÚgetblockÚhasattrr#   r   )ÚfuncÚsource_filer*   Úsource_codeÚline_noÚsource_file_objÚ
first_lineÚsource_liness           r.   Úget_func_coderJ   K   sË  € ð* €Kð /ØŒ}ˆØÔ&ˆÝŒw�~Š~˜kÑ*Ô*ð 	5ð Ÿ'š'¥'Ô"8¸Ñ">Ô">¸qÔ"AÑBÔBˆKØˆGØ×%Ò% kÑ2Ô2ð ;Ý')¤xØ4°kñ(ô (ç’&‘(”(ñ %�˜Wõ ˜g™,œ,�Ø,¨{Ñ:�Ø ¨WÐ4Ð4å˜KÑ(Ô(ð 	O¨OØÔ,ˆJå¥ ¸
ÀQ¹ÈÑ MÔ MÑNÔNˆLð	Oð 	Oð 	Oñ 	Oô 	Oð 	Oð 	Oð 	Oð 	Oð 	Oð 	Oøøøð 	Oð 	Oð 	Oð 	Oð �wŠw•wÔ'¨Ñ5Ô5Ñ6Ô6¸ÀZÐOÐOøð/õ �4˜Ñ$Ô$ð 	/å$ T¤]Ñ3Ô3°[À"ÐDÐDÐDÐDõ ˜‘:”:˜{¨BÐ.Ð.Ð.Ð.øøøs<   „B3D1 Â8D1 Ã)C<Ã0D1 Ã<D Ä D1 ÄD Ä,D1 Ä1)E0ÅE0c                 ó¦   — ddl }t          |d¦  «        r|j        }nddl}|j        j        }dD ]!}|                      | ||¦  «        ¦  «        } Œ"| S )z2Windows cannot encode some characters in filename.r   NÚquote)ú<ú>ú!ú:ú\)ÚurllibrB   rL   Úurllib.parseÚparser   )ÚstringrR   rL   Úchars       r.   Ú_clean_win_charsrW   „   so   € à€M€M€Måˆv�wÑÔð #Ø”ˆˆð 	ÐÐÐà”Ô"ˆØ*ð 3ð 3ˆØ—’  e e¨D¡k¤kÑ2Ô2ˆˆØ€Mr
   Tc                 ó¦  — t          | d¦  «        r| j        }nE	 t          j        | ¦  «        }n/# t          $ r" t          | d¦  «        r| j        j        }nd}Y nw xY w|€d}|dk    �r.	 t          j                             t          j	        | ¦  «        ¦  «        }n	#  d}Y nxY w|�ð| 
                    t          j        ¦  «        }|d                              d¦  «        rG|d          
                    d	¦  «        }d	                     |dd
…         |dd…         z   ¦  «        |d<   n3t          |¦  «        d
k    r |d                              d¦  «        rd|d<   d	                     |¦  «        }|                     d¦  «        r
|dd…         }|d	z   |z   }| 
                    d¦  «        }t          | d¦  «        r| j        }nt          | d¦  «        r| j        }nd}|r-t          | d¦  «        r|| j        v r| j        |         | urd|z  }t          | d¦  «        r@| j        |k    r5|                     | j         
                    d¦  «        dd…         ¦  «         t          j        | ¦  «        r1t          | d¦  «        r!| j        }|                     |j        ¦  «         t          j        dk    r|rt3          |¦  «        }d„ |D ¦   «         }||fS )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__ÚunknownNr0   Ú__main__r2   z<ipython-inputú-é   é   éþÿÿÿÚ
ipykernel_Ú	ipykernelz.pyéýÿÿÿú.Ú	func_nameÚ__name__Úfunc_globalsz%s-aliasÚ__qualname__Úim_classÚntc                 ó,   — g | ]}t          |¦  «        ‘ŒS © )rW   )Ú.0Úss     r.   ú
<listcomp>z!get_func_name.<locals>.<listcomp>ê   s!   € Ð6Ð6Ð6¨!Õ" 1Ñ%Ô%Ð6Ð6Ð6r
   )rB   rY   r7   Ú	getmoduleÚ	TypeErrorrZ   r4   r5   ÚabspathÚgetsourcefileÚsplitÚsepr9   r'   ÚlenÚendswithre   rf   rg   rh   ÚextendÚismethodri   r"   ÚnamerW   )	rC   Úresolv_aliasÚwin_charactersÚmoduleÚfilenamer+   rt   rz   Úklasss	            r.   Úget_func_namer€   ”   s  € õ ˆt�\Ñ"Ô"ð 	#Ø”ˆˆð	#ÝÔ& tÑ,Ô,ˆFˆFøÝð 	#ð 	#ð 	#Ý�t˜[Ñ)Ô)ð #ØœÔ2��à"�øøð		#øøøð
 €~àˆØ�ÒÑð	Ý”w—’¥wÔ'<¸TÑ'BÔ'BÑCÔCˆHˆHøð	ØˆHˆHˆHøøøØÐà—N’N¥2¤6Ñ*Ô*ˆEØ�RŒy×#Ò#Ð$4Ñ5Ô5ð (ð ˜bœ	Ÿš¨Ñ,Ô,�ØŸHšH U¨2¨A¨2¤Y°°q°r°r´Ñ%:Ñ;Ô;��b‘	�	Ý�U‘”˜a’� E¨"¤I×$8Ò$8¸Ñ$FÔ$F�ð (��b‘	Ø—x’x ‘”ˆHØ× Ò  Ñ'Ô'ð )Ø# C R Cœ=�Ø˜c‘\ HÑ,ˆFØ�\Š\˜#ÑÔ€FÝˆt�[Ñ!Ô!ð ØŒ~ˆˆÝ	��zÑ	"Ô	"ð ØŒ}ˆˆàˆàð )å�4˜Ñ(Ô(ð 	)¨T°TÔ5FÐ-FÐ-FØÔ  Ô&¨dÐ2Ð2Ø! DÑ(�Ýˆt�^Ñ$Ô$ð 9¨Ô):¸dÒ)BÐ)Bð 	�Š�dÔ'×-Ò-¨cÑ2Ô2°3°B°3Ô7Ñ8Ô8Ð8ÝÔ˜ÑÔð *å�4˜Ñ$Ô$ð 	*Ø”MˆEØ�MŠM˜%œ.Ñ)Ô)Ð)Ý	„w�$‚€˜>€å Ñ%Ô%ˆØ6Ð6¨vÐ6Ñ6Ô6ˆØ�4ˆ<Ðs   š/ ¯)AÁAÁ*1B ÂB"c                 ó.   — d                      | |¦  «        S )z.Helper function to output a function signaturez{}{})Úformat)Úfunction_nameÚarg_sigs     r.   Ú_signature_strr…   î   s   € à�=Š=˜¨Ñ0Ô0Ð0r
   c                 óÄ   — d}t          |¦  «        dd…         }d                     d„ |                     ¦   «         D ¦   «         ¦  «        }|                     | ||¦  «        S )z)Helper function to output a function callz{0}({1}, {2})r   r2   ú, c              3   ó*   K  — | ]\  }}|›d |›�V — ŒdS )ú=Nrl   )rm   ÚkÚvs      r.   ú	<genexpr>z'_function_called_str.<locals>.<genexpr>ø   s1   è è € ÐGÐG±°°1 a a a¨¨Ð+ÐGÐGÐGÐGÐGÐGr
   )r   r'   Úitemsr‚   )rƒ   ÚargsÚkwargsÚtemplate_strÚargs_strÚ
kwargs_strs         r.   Ú_function_called_strr“   ó   s[   € à"€Lå�D‰zŒz˜!˜B˜$Ô€HØ—’ÐGÐG¸¿º¹¼ÐGÑGÔGÑGÔG€JØ×Ò˜}¨h¸
ÑCÔCÐCr
   rl   c                 óú  ‡— t          |¦  «        }t          |t          ¦  «        r#t          d|› dt	          |¦  «        › d�¦  «        ‚t          j        | ¦  «        s5t          j        | ¦  «        s!|rt          j	        d| › d�d¬¦  «         ||dœS t          j
        | ¦  «        }g }g }d	}d	}t          ¦   «         Š|j                             ¦   «         D ]œ}	|	j        |	j        u r|                     |	j        ¦  «         nT|	j        |	j        u r|                     |	j        ¦  «         n+|	j        |	j        u r|	j        }n|	j        |	j        u r|	j        }|	j        |	j        ur|	j        ‰|	j        <   Œ�t          j        | ¦  «        rK| j        g|z   }t          j
        | j        ¦  «        }
t3          t5          |
j        ¦  «        ¦  «        }|g|z   }t7          | d
¬¦  «        \  }}t9          |¦  «        D ]¥\  }}|t;          |¦  «        k     rF||         ‰|<   ||v r6t          d|› dt=          ||¦  «        › dt?          |||¦  «        › d�¦  «        ‚Œ^||v r||         ‰|<   Œn|‰vr3t          dt=          ||¦  «        › dt?          |||¦  «        › d�¦  «        ‚Œ¦t;          |¦  «        t;          |¦  «        k    rP|€3t          dt=          ||¦  «        › dt?          |||¦  «        › d�¦  «        ‚|t;          |¦  «        d	…         ‰d<   n|�g ‰d<   |D ]I}||v r||         ‰|<   Œ|‰vr3t          dt=          ||¦  «        › dt?          |||¦  «        › d�¦  «        ‚ŒJˆfd„|                      ¦   «         D ¦   «         }|�|‰d<   n5|r3t          dt=          ||¦  «        › dt?          |||¦  «        › d�¦  «        ‚|D ]>}|‰v r‰ !                    |¦  «         Œt          d|› dt=          ||¦  «        › �¦  «        ‚‰S )aX  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 givenzCannot inspect object z, ignore list will not work.r^   )Ú
stacklevel)Ú*ú**NF)r{   z	Argument z1 was given both as positional and as keyword for z:
    z was called.zWrong number of arguments for zToo many arguments for r–   c                 ó$   •— i | ]\  }}|‰v¯	||“ŒS rl   rl   )rm   rŠ   r‹   Úarg_dicts      €r.   ú
<dictcomp>zfilter_args.<locals>.<dictcomp>q  s)   ø€ ÐFÐFÐF™$˜!˜Q°A¸XÐ4EÐ4E��AÐ4EÐ4EÐ4Er
   r—   zToo many keyword arguments for zIgnore list: argument 'z' is not defined for function )"r@   r   ÚstrÚ
ValueErrorÚtyper7   ry   Ú
isfunctionÚwarningsÚwarnÚ	signatureÚdictÚ
parametersÚvaluesÚkindÚPOSITIONAL_OR_KEYWORDr"   rz   ÚKEYWORD_ONLYÚVAR_POSITIONALÚVAR_KEYWORDÚdefaultÚemptyÚ__self__Ú__func__ÚnextÚiterr€   Ú	enumeraterv   r…   r“   r�   Úpop)rC   Ú
ignore_lstrŽ   r�   r„   Ú	arg_namesÚarg_kwonlyargsÚarg_varargsÚ	arg_varkwÚparamÚclass_method_sigÚ	self_nameÚ_rz   Úarg_positionÚarg_nameÚ	varkwargsÚitemr™   s                     @r.   Úfilter_argsr¿   ü   s‘  ø€ õ* �‰:Œ:€DÝ�*�cÑ"Ô"ð 
åð@Øð@ð @Ý"& zÑ"2Ô"2ð@ð @ð @ñ
ô 
ð 	
õ
 Ô˜DÑ!Ô!ð )­'Ô*<¸TÑ*BÔ*Bð )Øð 	ÝŒMØK¨ÐKÐKÐKØðñ ô ð ð  Ð(Ð(Ð(ÝÔ Ñ%Ô%€GØ€IØ€NØ€KØ€IÝ‰vŒv€HØÔ#×*Ò*Ñ,Ô,ð 
1ð 
1ˆØŒ:˜Ô4Ð4Ð4Ø×Ò˜UœZÑ(Ô(Ð(Ð(ØŒZ˜5Ô-Ð-Ð-Ø×!Ò! %¤*Ñ-Ô-Ð-Ð-ØŒZ˜5Ô/Ð/Ð/Øœ*ˆKˆKØŒZ˜5Ô,Ð,Ð,Øœ
ˆIØŒ= ¤Ð+Ð+Ø#(¤=ˆH�U”ZÑ øÝÔ˜ÑÔð ,ð ŒMð
àñˆõ #Ô,¨T¬]Ñ;Ô;ÐÝ�Ð.Ô9Ñ:Ô:Ñ;Ô;ˆ	Ø�K )Ñ+ˆ	õ ˜D¨uÐ5Ñ5Ô5�G€A€tõ #,¨IÑ"6Ô"6ð ð Ñˆ�hØ�#˜d™)œ)Ò#Ð#à!% lÔ!3ˆH�XÑØ˜6Ð!Ð!Ý ðR ð Rð RÝ*¨4°Ñ9Ô9ðRð Rå/°°d¸FÑCÔCðRð Rð Rñô ð ð "ð ˜ÐÐà!'¨Ô!1ˆH�XÑÐØ˜XÐ%Ð%åðNµÀÀgÑ1NÔ1Nð Nð NÝ+¨D°$¸Ñ?Ô?ðNð Nð Nñô ð ð &õ ˆ4�y„y•3�y‘>”>Ò!Ð!ØÐÝðN­.¸¸wÑ*GÔ*Gð Nð NÝ+¨D°$¸Ñ?Ô?ðNð Nð Nñô ð ð �S ™^œ^Ð-Ð-Ô.ˆ�‰ˆØ	Ð	 Øˆ�‰ð #ð 	ð 	ˆØ�vÐÐØ!'¨Ô!1ˆH�XÑÐØ˜XÐ%Ð%õ ðNµÀÀgÑ1NÔ1Nð Nð NÝ+¨D°$¸Ñ?Ô?ðNð Nð Nñô ð ð &ð GÐFÐFÐF &§,¢,¡.¤.ÐFÑFÔF€IØÐØ"ˆ�‰ˆà	ð 
ÝðJ­n¸TÀ7Ñ.KÔ.Kð Jð JÝ'¨¨d°FÑ;Ô;ðJð Jð Jñ
ô 
ð 	
ð ð ð ˆØ�8ÐÐØ�LŠL˜ÑÔÐÐåð<¨$ð <ð <Ý*¨4°Ñ9Ô9ð<ð <ñô ð ð
 €Or
   c                 óh   — t          | d¬¦  «        }t          |¦  «        dk    rd|d d…         z  }|S )Nr^   )ÚindentiÜ  z%s...i¼  )r   rv   )ÚargÚformatted_args     r.   Ú_format_argrÄ   ˆ  s@   € Ý˜C¨Ð*Ñ*Ô*€MÝ
ˆ=ÑÔ˜DÒ Ð Ø -°°°Ô"5Ñ5ˆØÐr
   c                 óæ  — t          | ¦  «        \  }}d„ |D ¦   «         }|r+|                     |¦  «         d                     |¦  «        }n|}t          ¦   «         }d}|D ]@}t	          |¦  «        }	|dk    rd|	z  }	t          |	¦  «        }|                     |	¦  «         ŒA|                     d„ |                     ¦   «         D ¦   «         ¦  «         d                     |¦  «        }|›d|›d	�}
||
fS )
Nc                 ó   — g | ]}|¯|‘ŒS rl   rl   )rm   Úms     r.   ro   z$format_signature.<locals>.<listcomp>’  s   € Ð%Ð%Ð%�A 1Ð%ˆaÐ%Ð%Ð%r
   rd   r   éP   z
%sc                 ó<   — g | ]\  }}|›d t          |¦  «        ›�‘ŒS )r‰   )rÄ   )rm   r‹   Úis      r.   ro   z$format_signature.<locals>.<listcomp>   s-   € ÐMÐMÐM±d°a¸˜q˜q˜q¥+¨a¡.¤. .Ð1ÐMÐMÐMr
   r‡   ú(ú))r€   r"   r'   r@   rÄ   rv   rx   r�   )rC   rŽ   r�   r}   rz   Úmodule_pathÚarg_strÚprevious_lengthrÂ   rÃ   r¡   s              r.   Úformat_signaturerÐ   �  s  € å  Ñ&Ô&�L€FˆDØ%Ð%˜Ð%Ñ%Ô%€FØð Ø�Š�dÑÔÐØ—h’h˜vÑ&Ô&ˆˆàˆÝ‰fŒf€GØ€OØð &ð &ˆÝ# CÑ(Ô(ˆØ˜RÒÐØ" ]Ñ2ˆMÝ˜mÑ,Ô,ˆØ�Š�}Ñ%Ô%Ð%Ð%Ø‡N‚NÐMÐM¸f¿lºl¹n¼nÐMÑMÔMÑNÔNÐNØ�iŠi˜Ñ Ô €Gà ˜D˜D ' ' 'Ð*€IØ˜	Ð!Ð!r
   ÚMemoryc                 óF   — t          | g|¢R i |¤Ž\  }}d›d|›d|›d|›�}|S )zdReturns a nicely formatted statement displaying the function
    call with the given arguments.
    ÚP________________________________________________________________________________z
[z
] Calling z...
)rÐ   )rC   rŽ   r�   Úobject_namer5   r¡   Úmsgs          r.   Úformat_callrÖ   §  sF   € õ ' tÐ=¨dÐ=Ð=Ð=°fÐ=Ð=�O€Dˆ)Ø*2¨(¨(°K°K°KÀÀÀÀyÀyÐ
Q€CØ€Jr
   )TT)rÑ   )Ú__doc__Úcollectionsr$   r7   r4   r:   r    rŸ   Ú	itertoolsr   Útokenizer   r>   Úloggerr   Úfull_argspec_fieldsÚ
namedtupleÚfull_argspec_typer#   rJ   rW   r€   r…   r“   r¢   r¿   rÄ   rÐ   rÖ   rl   r
   r.   ú<module>rß      sw  ððð ð Ð Ð Ð Ø €€€Ø €€€Ø 	€	€	€	Ø 	€	€	€	Ø €€€Ø €€€Ø Ð Ð Ð Ð Ð Ø +Ð +Ð +Ð +Ð +Ð +à Ð Ð Ð Ð Ð ð Hð ð +�KÔ*¨=Ð:MÑNÔNÐ ð-ð -ð -ð`6/ð 6/ð 6/ðrð ð ð Wð Wð Wð Wðt1ð 1ð 1ð
Dð Dð Dð (*°$°$±&´&ð Ið Ið Ið IðXð ð ð"ð "ð "ð0ð ð ð ð ð r
   