U
    ·ÜŸj’  ã                   @  sZ   d dl mZ d dlZd dlmZmZ ddddœdd	„Zeƒ d
dœddddddœdd„ZdS )é    )ÚannotationsN)ÚAnyÚCallablezCallable[..., Any]ÚstrÚbool)ÚfuncÚarg_nameÚreturnc                 C  s   t  | ¡}||jkS )zBReturns whether or not the given function has a specific parameter)ÚinspectÚ	signatureÚ
parameters)r   r   Úsig© r   ú=/tmp/pip-unpacked-wheel-2qj3ofc_/openai/_utils/_reflection.pyÚfunction_has_argument   s    
r   Ú )Úexclude_paramsÚdescriptionzset[str]ÚNone)Úsource_funcÚ
check_funcr   r   r	   c          
   
   C  sº   t  |¡}t  | ¡}g }|j ¡ D ]l\}}||kr4q"|j |¡}	|	sX| d|› d�¡ q"|	j|jkr"| d|› dt|jƒ› dt|	jƒ› �¡ q"q"|r¶tt	|ƒ› d|› d�d 
|¡ ƒ‚d	S )
zCEnsure that the signature of the second function matches the first.zthe `z` param is missingztypes for the `z!` param are do not match; source=z
 checking=z- errors encountered when comparing signaturesz:

z

N)r
   r   r   ÚitemsÚgetÚappendÚ
annotationÚreprÚAssertionErrorÚlenÚjoin)
r   r   r   r   Z	check_sigZ
source_sigÚerrorsÚnameZsource_paramZcustom_paramr   r   r   Úassert_signatures_in_sync   s&    	

 ÿÿr!   )	Ú
__future__r   r
   Útypingr   r   r   Úsetr!   r   r   r   r   Ú<module>   s   
û