
    ?KiV                         S SK JrJr  S SK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)    )CallableMapping)	AnnotatedAnyBinaryIOTypeVarcast)Doc)GetJsonSchemaHandler)URL)Address)FormData)Headers)QueryParams)State)
UploadFilec            	         ^  \ rS rSr% Sr\\\" S5      4   \S'   \\	S-  \" S5      4   \S'   \\
S-  \" S5      4   \S	'   \\\" S
5      4   \S'   \\	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).fileNz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.
                returnc                 >   >#    [         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     X/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/fastapi/datastructures.pyr   UploadFile.writeB   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.readV   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.seekh   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.   r/   s      r!   	_validateUploadFile._validate   s6    -)<==>tM?R>STUUJ..    core_schemahandlerc                     SSS.$ )Nstringzapplication/octet-stream)r4   contentMediaType )r5   r9   r:   s      r!   __get_pydantic_json_schema__'UploadFile.__get_pydantic_json_schema__   s     !6PQQr8   sourcec                 2    SSK Jn  U" U R                  5      $ )N   )"with_info_plain_validator_function)
_compat.v2rD   r6   )r5   rA   r:   rD   s       r!   __get_pydantic_core_schema__'UploadFile.__get_pydantic_core_schema__   s     	C1#--@@r8   r>   ))r   N)__name__
__module____qualname____firstlineno____doc__r   r   r
   __annotations__strintr   bytesr   r%   r)   r,   classmethodr   r6   r   r   dictr?   r4   r   rF   __static_attributes____classcell__)r    s   @r!   r   r      s   B :;	=  d
C(A$BBCC
C$J$D EE
FFw$A BBCCd
CLMM )
) 
): (
( 
( ($*
* 
*(% /c /c /l / /
 R!#s(+R6JR	c3hR R
 A#YA)13%c9J2J)KA	c	A Ar8   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rY   )r   rY   s     r!   __init__DefaultPlaceholder.__init__   s    
r8   r   c                 ,    [        U R                  5      $ r[   )boolrY   )r   s    r!   __bool__DefaultPlaceholder.__bool__   s    DJJr8   oc                 b    [        U[        5      =(       a    UR                  U R                  :H  $ r[   )r1   rW   rY   )r   rc   s     r!   __eq__DefaultPlaceholder.__eq__   s"    !/0JQWW

5JJr8   r\   N)rI   rJ   rK   rL   rM   r   r]   r`   ra   objectre   rT   r>   r8   r!   rW   rW      s5    c  $  K K4 Kr8   rW   DefaultTyperY   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.
)rW   r\   s    r!   Defaultrj      s     e$$r8   N)collections.abcr   r   typingr   r   r   r   r	   annotated_docr
   pydanticr   starlette.datastructuresr   r   r   r   r   r   r   r2   rW   rh   rj   r>   r8   r!   <module>rp      sl    -   ) / 7 9 7 ? 3 FAA$ AAHK K$ m$%; %; %r8   