§
    Ý
@gþ  ã                  ó´   — d dl mZ d dlmZmZmZmZ d dlmZ	 d dl
mZmZmZmZ ddlmZ ddlmZ dd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zddœd d„ZdS )!é    )Úannotations)ÚAnyÚTypeVarÚIterableÚcast)Úabc)ÚRequiredÚ	AnnotatedÚget_argsÚ
get_originé   )ÚInheritsGeneric)Úis_unionÚtypÚtypeÚreturnÚboolc                ó2   — t          | ¦  «        t          k    S ©N)r   r
   ©r   s    úI/var/www/piapp/venv/lib/python3.11/site-packages/openai/_utils/_typing.pyÚis_annotated_typer      s   € Ý�c‰?Œ?�iÒ'Ð'ó    c                ó6   — t          | ¦  «        p| t          k    S r   )r   Úlistr   s    r   Úis_list_typer      s   € Ý�s‰OŒOÐ"˜s¥tÒ+Ð+r   c                óZ   — t          | ¦  «        p| }|t          k    p|t          j        k    S )z)If the given type is `typing.Iterable[T]`)r   r   Ú_c_abc)r   Úorigins     r   Úis_iterable_typer       s)   € å˜‰_Œ_Ð# €FØ•XÒÐ: ­6¬?Ò!:Ð:r   c                ó:   — t          t          | ¦  «        ¦  «        S r   )Ú	_is_unionr   r   s    r   Úis_union_typer#      s   € Ý•Z ‘_”_Ñ%Ô%Ð%r   c                ó2   — t          | ¦  «        t          k    S r   )r   r	   r   s    r   Úis_required_typer%      s   € Ý�c‰?Œ?�hÒ&Ð&r   c                ó2   — t          | ¦  «        t          k    S r   )r   r   r   s    r   Ú
is_typevarr'   !   s   € õ �‰9Œ9�ÒÐr   c                ó¬   — t          | ¦  «        st          | ¦  «        r5t          t          t          t          | ¦  «        d         ¦  «        ¦  «        S | S )Nr   )r%   r   Ústrip_annotated_typer   r   r   r   s    r   r)   r)   (   sL   € Ý˜ÑÔð BÕ 1°#Ñ 6Ô 6ð BÝ#¥D­­x¸©}¬}¸QÔ/?Ñ$@Ô$@ÑAÔAÐAà€Jr   ÚindexÚintc                óª   — t          | ¦  «        }	 t          t          ||         ¦  «        S # t          $ r}t	          d| › d|› d�¦  «        |‚d }~ww xY w)NzExpected type z" to have a type argument at index z but it did not)r   r   r   Ú
IndexErrorÚRuntimeError)r   r*   ÚargsÚerrs       r   Úextract_type_argr1   /   sp   € Ý�C‰=Œ=€DðtÝ•D˜$˜uœ+Ñ&Ô&Ð&øÝð tð tð tÝÐi¨CÐiÐiÐSXÐiÐiÐiÑjÔjÐpsÐsøøøøðtøøøs   ‘, ¬
A¶AÁAN)Úfailure_messageÚgeneric_basesútuple[type, ...]r2   ú
str | Nonec               óŽ  — t          t          t          | ¦  «        p| ¦  «        }||v rt          | |¦  «        S t	          |t
          ¦  «        rbd}|j        D ]}|j        |v r|} nŒ|€t          d|› d|› d�¦  «        ‚t          ||¦  «        }t          |¦  «        rt          | |¦  «        S |S t          |pd|› d| › �¦  «        ‚)aÛ  Given a type like `Foo[T]`, returns the generic type variable `T`.

    This also handles the case where a concrete subclass is given, e.g.
    ```py
    class MyResponse(Foo[bytes]):
        ...

    extract_type_var(MyResponse, bases=(Foo,), index=0) -> bytes
    ```

    And where a generic subclass is given:
    ```py
    _T = TypeVar('_T')
    class MyResponse(Foo[_T]):
        ...

    extract_type_var(MyResponse[bytes], bases=(Foo,), index=0) -> bytes
    ```
    NzFCould not find the generic base class;
This should never happen;
Does z inherit from one of z ?z/Could not resolve inner type variable at index z for )
r   Úobjectr   r1   Ú
isinstancer   Ú__orig_bases__Ú
__origin__r.   r'   )r   r3   r*   r2   ÚclsÚtarget_base_classÚbaseÚ	extracteds           r   Úextract_type_var_from_baser?   7   s&  € õ4 �v•z #‘”Ð-¨#Ñ
.Ô
.€CØ
ˆmÐÐå  UÑ+Ô+Ð+õ �#•Ñ'Ô'ð Ø(,ÐØÔ&ð 	ð 	ˆDØŒ -Ð/Ð/Ø$(Ð!Ø�ð 0ð Ð$ÝðDàðDð Dà2?ðDð Dð Dñô ð õ %Ð%6¸Ñ>Ô>ˆ	Ý�iÑ Ô ð 		0õ $ C¨Ñ/Ô/Ð/àÐå
�ÐmÐ*mÐ\aÐ*mÐ*mÐhkÐ*mÐ*mÑ
nÔ
nÐnr   )r   r   r   r   )r   r   r   r   )r   r   r*   r+   r   r   )
r   r   r3   r4   r*   r+   r2   r5   r   r   )Ú
__future__r   Útypingr   r   r   r   Úcollectionsr   r   Útyping_extensionsr	   r
   r   r   Ú_typesr   Ú_compatr   r"   r   r   r    r#   r%   r'   r)   r1   r?   © r   r   ú<module>rG      sv  ðØ "Ð "Ð "Ð "Ð "Ð "à /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ø %Ð %Ð %Ð %Ð %Ð %Ø GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ Gà $Ð $Ð $Ð $Ð $Ð $Ø +Ð +Ð +Ð +Ð +Ð +ð(ð (ð (ð (ð,ð ,ð ,ð ,ð;ð ;ð ;ð ;ð&ð &ð &ð &ð'ð 'ð 'ð 'ð ð  ð  ð  ðð ð ð ðtð tð tð tð #'ðAoð Aoð Aoð Aoð Aoð Aoð Aoð Aor   