� K�g����ddlmZmZmZmZmZmZmZmZm Z ddl m Z m Z m Z mZmZddlmZddlmZddlmZddlmZddlmZddlmZdd lmZdd lmZmZGd �d e��ZGd �d��Zed��Zdedefd�ZdS)�) �Any�BinaryIO�Callable�Dict�Iterable�Optional�Type�TypeVar�cast)� PYDANTIC_V2� CoreSchema�GetJsonSchemaHandler�JsonSchemaValue�"with_info_plain_validator_function)�URL)�Address)�FormData)�Headers)� QueryParams)�State)� UploadFile)� Annotated�Docc���eZdZUdZeeed��fed<eee ed��fed<eee ed��fed<ee ed��fed <eee ed ��fed <d ee ed ��fddf�fd� Z d'dee ed��fde f�fd� Zdee ed��fddf�fd� Zd(�fd� Zededdeedeffd���Zededdedefd���Zedededdfd���Zesed ee efddfd!���Zed"ed#edefd$���Zed%eed#eegefdefd&���Z �xZ!S))raA A file uploaded in a request. Define it as a *path operation function* (or dependency) parameter. If you are using a regular `def` function, you can use the `upload_file.file` attribute to access the raw standard Python file (blocking, not async), useful and needed for non-async code. Read more about it in the [FastAPI docs for Request Files](https://fastapi.tiangolo.com/tutorial/request-files/). ## Example ```python from typing import Annotated from fastapi import FastAPI, File, UploadFile app = FastAPI() @app.post("/files/") async def create_file(file: Annotated[bytes, File()]): return {"file_size": len(file)} @app.post("/uploadfile/") async def create_upload_file(file: UploadFile): return {"filename": file.filename} ``` z,The standard Python file object (non-async).�filezThe original file name.�filenamezThe size of the file in bytes.�sizezThe headers of the request.�headersz2The content type of the request, from the headers.� content_type�datazA The bytes to write to the file. �returnNc��V�K�t���|���d{V��S)z� Write some bytes to the file. You normally wouldn't use this from a file you read in a request. To be awaitable, compatible with async, this is run in threadpool. N)�super�write)�selfr � __class__s ��f/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/fastapi/datastructures.pyr$zUploadFile.writeKs1�����$�W�W�]�]�4�(�(�(�(�(�(�(�(�(������zL The number of bytes to read from the file. c��V�K�t���|���d{V��S)z| Read some bytes from the file. To be awaitable, compatible with async, this is run in threadpool. N)r#�read)r%rr&s �r'r+zUploadFile.read_s1����� �W�W�\�\�$�'�'�'�'�'�'�'�'�'r(�offsetzO The position in bytes to seek to in the file. c��V�K�t���|���d{V��S)z� Move to a position in the file. Any next read or write will be done from that position. To be awaitable, compatible with async, this is run in threadpool. N)r#�seek)r%r,r&s �r'r.zUploadFile.seekqs1�����$�W�W�\�\�&�)�)�)�)�)�)�)�)�)r(c��T�K�t������d{V��S)zm Close the file. To be awaitable, compatible with async, this is run in threadpool. N)r#�close)r%r&s �r'r0zUploadFile.close�s-����� �W�W�]�]�_�_�$�$�$�$�$�$�$r(�cls.c#�K�|jV�dS�N)�validate)r1s r'�__get_validators__zUploadFile.__get_validators__�s�����l�����r(�vc�n�t|t��stdt|�������|S�NzExpected UploadFile, received: )� isinstance�StarletteUploadFile� ValueError�type)r1r6s r'r4zUploadFile.validate�s8���!�0�1�1� J��H�t�A�w�w�H�H�I�I� I��r(�_UploadFile__input_value�_c��t|t��stdt|�������t t |��Sr8)r9r:r;r<r r)r1r=r>s r'� _validatezUploadFile._validate�sE���-�)<�=�=� V��T�t�M�?R�?R�T�T�U�U� U��J� �.�.�.r(� field_schemac�6�|�ddd���dS�N�string�binary)r<�format)�update)r1rAs r'�__modify_schema__zUploadFile.__modify_schema__�s$�� � � ��X� F� F� G� G� G� G� Gr(� core_schema�handlerc� �ddd�SrC�)r1rIrJs r'�__get_pydantic_json_schema__z'UploadFile.__get_pydantic_json_schema__�s��!�H�5�5�5r(�sourcec�*�t|j��Sr3)rr@)r1rNrJs r'�__get_pydantic_core_schema__z'UploadFile.__get_pydantic_core_schema__�s��2�#�-�@�@�@r()r))r!N)"�__name__� __module__� __qualname__�__doc__rrr�__annotations__r�str�intr�bytesr$r+r.r0� classmethodr rrrr5r4r@r rrHr rrrMrP� __classcell__)r&s@r'rrs�����������B �� �� :�;�;� =� ������� �s�s�+D�'E�'E�E�F�F�F�F� �H�S�M�3�3�'G�#H�#H�H� I�I�I�I� �w���$A� B� B�B� C�C�C�C���� �s�s�O�P�P�P�����)�� � �C�� � � � �)� �)�)�)�)�)�)�: �(�(�� � �C�� � � � �(� �(�(�(�(�(�(�$*�� � �C�� � � � �*� �*�*�*�*�*�*�(%�%�%�%�%�%����\� 2��x���c��@R�7S�����[����d�<�(��S��S�����[�� �/�c�/�c�/�l�/�/�/��[�/� �H� � H��c�3�h�� H�D� H� H� H� �� H��6�$�6�/C�6� �6�6�6��[�6� �A��#�Y�A�)1�3�%��2C�)D�A� �A�A�A��[�A�A�A�A�Ar(rc�:�eZdZdZdefd�Zdefd�Zdedefd�Z dS) �DefaultPlaceholderz� You shouldn't use this class directly. It's used internally to recognize when a default value has been overwritten, even if the overridden default value was truthy. �valuec��||_dSr3�r])r%r]s r'�__init__zDefaultPlaceholder.__init__�s ���� � � r(r!c�*�t|j��Sr3)�boolr])r%s r'�__bool__zDefaultPlaceholder.__bool__�s���D�J���r(�oc�L�t|t��o|j|jkSr3)r9r\r])r%rds r'�__eq__zDefaultPlaceholder.__eq__�s!���!�/�0�0�J�Q�W�� �5J�Jr(N) rQrRrSrTrr`rbrc�objectrfrLr(r'r\r\�s~���������c����� �$� � � � �K��K�4�K�K�K�K�K�Kr(r\� DefaultTyper]r!c� �t|��S)z� You shouldn't use this function directly. It's used internally to recognize when a default value has been overwritten, even if the overridden default value was truthy. )r\r_s r'�Defaultrj�s�� �e� $� $�$r(N)�typingrrrrrrr r r �fastapi._compatr r rrr�starlette.datastructuresrrrrrrrr:�typing_extensionsrrr\rhrjrLr(r'�<module>ros��� � � � � � � � � � � � � � � � � � � � � � ���������������0�/�/�/�/�/�7�7�7�7�7�7�9�9�9�9�9�9�7�7�7�7�7�7�?�?�?�?�?�?�3�3�3�3�3�3�F�F�F�F�F�F�,�,�,�,�,�,�,�,�OA�OA�OA�OA�OA�$�OA�OA�OA�dK�K�K�K�K�K�K�K�$�g�m�$�$� �%�;�%�;�%�%�%�%�%�%r(
Memory