
    [iU                         S SK Jr  S SKJrJrJrJrJrJrJ	r	  S SK
Jr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S S	KJr  S S
KJr  S SKJr   " S S\5      r " S S5      r\" S5      rS\S\4S jrg)    )Mapping)	AnnotatedAnyBinaryIOCallableOptionalTypeVarcast)Doc)GetJsonSchemaHandler)URL)Address)FormData)Headers)QueryParams)State)
UploadFilec            	         ^  \ rS rSr% Sr\\\" S5      4   \S'   \\	\
   \" S5      4   \S'   \\	\   \" S5      4   \S'   \\\" S	5      4   \S
'   \\	\
   \" S5      4   \S'   S\\\" S5      4   SS4U 4S jjr S!S\\\" S5      4   S\4U 4S jjjrS\\\" S5      4   SS4U 4S jjrS"U 4S jjr\S\S\SS 4S j5       r\S\\
\4   S\S\\
\4   4S j5       r\S\\   S\\/\\
\4   4   S\\
\4   4S j5       rS rU =r$ )#r      a  
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).filezThe original file name.filenamezThe size of the file in bytes.sizezThe headers of the request.headersz2The content type of the request, from the headers.content_typedatazA
                The bytes to write to the file.
                returnNc                 >   >#    [         TU ]  U5      I Sh  vN $  N7f)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     iC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\fastapi/datastructures.pyr   UploadFile.writeD   s     $ W]4((((   zL
                The number of bytes to read from the file.
                c                 >   >#    [         TU ]  U5      I Sh  vN $  N7f)zd
Read some bytes from the file.

To be awaitable, compatible with async, this is run in threadpool.
N)r   read)r    r   r!   s     r"   r&   UploadFile.readX   s       W\$''''r$   offsetzO
                The position in bytes to seek to in the file.
                c                 >   >#    [         TU ]  U5      I Sh  vN $  N7f)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*   UploadFile.seekj   s     $ W\&))))r$   c                 <   >#    [         TU ]  5       I Sh  vN $  N7f)zU
Close the file.

To be awaitable, compatible with async, this is run in threadpool.
N)r   close)r    r!   s    r"   r-   UploadFile.close~   s      W]_$$$s   _UploadFile__input_value_c                 z    [        U[        5      (       d  [        S[        U5       35      e[	        [
        U5      $ )NzExpected UploadFile, received: )
isinstanceStarletteUploadFile
ValueErrortyper
   r   )clsr/   r0   s      r"   	_validateUploadFile._validate   s6    -)<==>tM?R>STUUJ..    core_schemahandlerc                     SSS.$ )Nstringbinary)r5   format )r6   r:   r;   s      r"   __get_pydantic_json_schema__'UploadFile.__get_pydantic_json_schema__   s     !H55r9   sourcec                 2    SSK Jn  U" U R                  5      $ )N   )"with_info_plain_validator_function)
_compat.v2rF   r7   )r6   rC   r;   rF   s       r"   __get_pydantic_core_schema__'UploadFile.__get_pydantic_core_schema__   s     	C1#--@@r9   r@   ))r   N)__name__
__module____qualname____firstlineno____doc__r   r   r   __annotations__r   strintr   bytesr   r&   r*   r-   classmethodr   r7   r   r   dictrA   r5   r   rH   __static_attributes____classcell__)r!   s   @r"   r   r      s   B :;	=  s+D'EEFF
HSM3'G#HH
IIw$A BBCCsOPP )
) 
): (
( 
( ($*
* 
*(% /c /c /l / /
 6!#s(+66J6	c3h6 6
 A#YA)13%c9J2J)KA	c	A Ar9   r   c                   F    \ rS rSrSrS\4S jrS\4S jrS\	S\4S jr
S	rg
)DefaultPlaceholder   z
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                     Xl         g Nr[   )r    r[   s     r"   __init__DefaultPlaceholder.__init__   s    
r9   r   c                 ,    [        U R                  5      $ r]   )boolr[   )r    s    r"   __bool__DefaultPlaceholder.__bool__   s    DJJr9   oc                 b    [        U[        5      =(       a    UR                  U R                  :H  $ r]   )r2   rY   r[   )r    re   s     r"   __eq__DefaultPlaceholder.__eq__   s"    !/0JQWW

5JJr9   r^   N)rK   rL   rM   rN   rO   r   r_   rb   rc   objectrg   rV   r@   r9   r"   rY   rY      s5    c  $  K K4 Kr9   rY   DefaultTyper[   r   c                     [        U 5      $ )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.
)rY   r^   s    r"   Defaultrl      s     e$$r9   N)collections.abcr   typingr   r   r   r   r   r	   r
   annotated_docr   pydanticr   starlette.datastructuresr   r   r   r   r   r   r   r3   rY   rj   rl   r@   r9   r"   <module>rr      sq    #    ) / 7 9 7 ? 3 FAA$ AAHK K$ m$%; %; %r9   