
    i                         S SK JrJrJrJrJrJrJrJrJ	r	  S SK
Jr  S SK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\5      r " S S5      r\" S5      rS\S\4S jrg)    )	AnyBinaryIOCallableDictIterableOptionalTypeTypeVarcast)Doc)
CoreSchemaGetJsonSchemaHandlerJsonSchemaValue)URL)Address)FormData)Headers)QueryParams)State)
UploadFile)	Annotatedc                   d  ^  \ 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      4S j5       r\S\S    S\S\4S j5       r\S\S\SS 4S j5       r\S \\
\4   SS4S! j5       r\S"\S#\S\4S$ j5       r\S%\\   S#\\/\4   S\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     ^/var/www/html/qgis-automation/mouza_env/lib/python3.13/site-packages/fastapi/datastructures.pyr#   UploadFile.writeJ   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.read^   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.seekp   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&   r1   UploadFile.close   s      W]_$$$s   cls.c              #   (   #    U R                   v   g 7fN)validate)r3   s    r&   __get_validators__UploadFile.__get_validators__   s     lls   vc                 ^    [        U[        5      (       d  [        S[        U5       35      eU$ NzExpected UploadFile, received: )
isinstanceStarletteUploadFile
ValueErrortype)r3   r9   s     r&   r6   UploadFile.validate   s,    !011>tAwiHII    _UploadFile__input_value_c                 z    [        U[        5      (       d  [        S[        U5       35      e[	        [
        U5      $ r;   )r<   r=   r>   r?   r   r   )r3   rB   rC   s      r&   	_validateUploadFile._validate   s6    -)<==>tM?R>STUUJ..rA   field_schemac                 ,    UR                  SSS.5        g Nstringbinary)r?   format)update)r3   rG   s     r&   __modify_schema__UploadFile.__modify_schema__   s    XBCrA   core_schemahandlerc                     SSS.$ rI    )r3   rP   rQ   s      r&   __get_pydantic_json_schema__'UploadFile.__get_pydantic_json_schema__   s     !H55rA   sourcec                 2    SSK Jn  U" U R                  5      $ )N   )"with_info_plain_validator_function)
_compat.v2rY   rE   )r3   rV   rQ   rY   s       r&   __get_pydantic_core_schema__'UploadFile.__get_pydantic_core_schema__   s     	C1#--@@rA   rS   ))r    N)#__name__
__module____qualname____firstlineno____doc__r   r   r   __annotations__r   strintr   bytesr#   r*   r.   r1   classmethodr	   r   r   r   r7   r6   rE   r   rN   r   r   r   rT   r[   __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 )
) 
): (
( 
( ($*
* 
*(% \ 2 xc@R7S   d<( S S  
 /c /c /l / / DT#s(^ D D D 6$6/C6	6 6
 A#YA)13%2C)DA	A ArA   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 r5   rm   )r$   rm   s     r&   __init__DefaultPlaceholder.__init__   s    
rA   r    c                 ,    [        U R                  5      $ r5   )boolrm   )r$   s    r&   __bool__DefaultPlaceholder.__bool__   s    DJJrA   oc                 b    [        U[        5      =(       a    UR                  U R                  :H  $ r5   )r<   rk   rm   )r$   rv   s     r&   __eq__DefaultPlaceholder.__eq__   s"    !/0JQWW

5JJrA   ro   N)r^   r_   r`   ra   rb   r   rp   rs   rt   objectrx   rh   rS   rA   r&   rk   rk      s5    c  $  K K4 KrA   rk   DefaultTyperm   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.
)rk   ro   s    r&   Defaultr}      s     e$$rA   N)typingr   r   r   r   r   r   r	   r
   r   annotated_docr   fastapi._compatr   r   r   starlette.datastructuresr   r   r   r   r   r   r   r=   typing_extensionsr   rk   r{   r}   rS   rA   r&   <module>r      sz   
 
 
  
 0 7 9 7 ? 3 F 'PA$ PAfK K$ m$%; %; %rA   