o
    î6WjÑ
  ã                   @  s^   d dl mZ d dlZd dlZd dlmZmZ dd
d„Zeƒ dœddd„Z	eƒ dœddd„Z
dS )é    )ÚannotationsN)ÚAnyÚCallableÚfuncúCallable[..., Any]Úarg_nameÚstrÚreturnÚboolc                 C  s   t  | ¡}||jv S )zBReturns whether or not the given function has a specific parameter)ÚinspectÚ	signatureÚ
parameters)r   r   Úsig© r   úk/home/esfera/Documents/content_generation/venv/lib/python3.10/site-packages/anthropic/_utils/_reflection.pyÚfunction_has_argument   s   

r   )Úexclude_paramsÚsource_funcÚ
check_funcr   úset[str]ÚNonec          	   
   C  s´   t  |¡}t  | ¡}g }|j ¡ D ]6\}}||v rq|j |¡}|s,| d|› d�¡ q|j|jkrG| d|› dt|jƒ› dt|jƒ› �¡ qq|rXtt	|ƒ› d�d 
|¡ ƒ‚dS )	zCEnsure that the signature of the second function matches the first.zthe `ú` param is missingztypes for the `z!` param are do not match; source=z
 checking=z0 errors encountered when comparing signatures:

ú

N)r   r   r   ÚitemsÚgetÚappendÚ
annotationÚreprÚAssertionErrorÚlenÚjoin)	r   r   r   Ú	check_sigÚ
source_sigÚerrorsÚnameÚsource_paramÚcustom_paramr   r   r   Úassert_signatures_in_sync   s&   

 ÿüÿr'   Úoverloaded_funcc                C  sì   t  | ¡}t |¡}|std|›�ƒ‚g }t|ƒD ]J\}}t  |¡}|j ¡ D ];\}	}
|	|v r0q'|j |	¡}|sE| 	d|› d|	› d�¡ q'|j
|
j
krb| 	d|› d|	› dt|
j
ƒ› dt|j
ƒ› �¡ q'q|rttt|ƒ› d�d	 |¡ ƒ‚d
S )zTEnsure that every @overload of overloaded_func contains all params from source_func.z#No @overload definitions found for z	overload z: `r   z: types for `z` do not match; source=z
 overload=z9 errors encountered when comparing overload signatures:

r   N)r   r   Útyping_extensionsÚget_overloadsr   Ú	enumerater   r   r   r   r   r   r   r    )r   r(   r   r"   Ú	overloadsr#   ÚiÚoverload_fnÚoverload_sigr$   r%   Úoverload_paramr   r   r   Úassert_overloads_in_sync.   s2   


&ÿ€öÿÿr1   )r   r   r   r   r	   r
   )r   r   r   r   r   r   r	   r   )r   r   r(   r   r   r   r	   r   )Ú
__future__r   r   r)   Útypingr   r   r   Úsetr'   r1   r   r   r   r   Ú<module>   s    

ü$ü