U
    nËjá  ã                   @   sÐ   d dl mZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlm	Z	 zd d	l
Z
W n ek
r„   d	Z
Y nX zd d	lZW n ek
rª   d	ZY nX G d
d„ deƒZG dd„ deƒZd	S )é    )ÚAny)ÚFileResponse)ÚHTMLResponse)ÚJSONResponse)ÚPlainTextResponse)ÚRedirectResponse)ÚResponse)ÚStreamingResponseNc                   @   s    e Zd ZdZeedœdd„ZdS )ÚUJSONResponsez÷
    JSON response using the high-performance ujson library to serialize data to JSON.

    Read more about it in the
    [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/).
    ©ÚcontentÚreturnc                 C   s$   t d k	stdƒ‚t j|dd� d¡S )Nz,ujson must be installed to use UJSONResponseF)Úensure_asciizutf-8)ÚujsonÚAssertionErrorÚdumpsÚencode©Úselfr   © r   ú5/tmp/pip-unpacked-wheel-yktl02hi/fastapi/responses.pyÚrender   s    zUJSONResponse.renderN©Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úbytesr   r   r   r   r   r
      s   r
   c                   @   s    e Zd ZdZeedœdd„ZdS )ÚORJSONResponsezø
    JSON response using the high-performance orjson library to serialize data to JSON.

    Read more about it in the
    [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/).
    r   c                 C   s&   t d k	stdƒ‚t j|t jt jB d�S )Nz.orjson must be installed to use ORJSONResponse)Úoption)Úorjsonr   r   ZOPT_NON_STR_KEYSZOPT_SERIALIZE_NUMPYr   r   r   r   r   ,   s
     
ÿzORJSONResponse.renderNr   r   r   r   r   r   $   s   r   )Útypingr   Zstarlette.responsesr   r   r   r   r   r   r	   r   ÚImportErrorr    r
   r   r   r   r   r   Ú<module>   s"   

