
    ,hi                     8   U d dl mZmZmZmZmZmZ d dlmZm	Z	 d dl
mZ d dl
mZ d dlmZmZ  G d de      Z G d d	e      Z e	d
      Zee   ed<    e	d      Zee   ed<    G d de      Z G d de      Z G d de      Z G d de      Z G d de      Zy)    )AnyDictOptionalSequenceTypeUnion)	BaseModelcreate_model)HTTPException)WebSocketException)	AnnotatedDocc                        e Zd ZdZ	 	 ddee ed      f   dee ed      f   deee	e
e
f       ed      f   d	df fd
Z xZS )r   a  
    An HTTP exception you can raise in your own code to show errors to the client.

    This is for client errors, invalid authentication, invalid data, etc. Not for server
    errors in your code.

    Read more about it in the
    [FastAPI docs for Handling Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/).

    ## Example

    ```python
    from fastapi import FastAPI, HTTPException

    app = FastAPI()

    items = {"foo": "The Foo Wrestlers"}


    @app.get("/items/{item_id}")
    async def read_item(item_id: str):
        if item_id not in items:
            raise HTTPException(status_code=404, detail="Item not found")
        return {"item": items[item_id]}
    ```
    Nstatus_codezI
                HTTP status code to send to the client.
                detailz}
                Any data to be sent to the client in the `detail` key of the JSON
                response.
                headerszT
                Any headers to send to the client in the response.
                returnc                 *    t         |   |||       y )N)r   r   r   super__init__)selfr   r   r   	__class__s       T/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/fastapi/exceptions.pyr   zHTTPException.__init__%   s    8 	[Q    )NN)__name__
__module____qualname____doc__r   intr   r   r   r   strr   __classcell__r   s   @r   r   r   	   s    Z  5R
R 
R& T#s(^$
'R6 
7R Rr   r   c            	       j     e Zd ZdZ	 d	dee ed      f   deeedf    ed      f   ddf fdZ	 xZ
S )
r   a^  
    A WebSocket exception you can raise in your own code to show errors to the client.

    This is for client errors, invalid authentication, invalid data, etc. Not for server
    errors in your code.

    Read more about it in the
    [FastAPI docs for WebSockets](https://fastapi.tiangolo.com/advanced/websockets/).

    ## Example

    ```python
    from typing import Annotated

    from fastapi import (
        Cookie,
        FastAPI,
        WebSocket,
        WebSocketException,
        status,
    )

    app = FastAPI()

    @app.websocket("/items/{item_id}/ws")
    async def websocket_endpoint(
        *,
        websocket: WebSocket,
        session: Annotated[str | None, Cookie()] = None,
        item_id: str,
    ):
        if session is None:
            raise WebSocketException(code=status.WS_1008_POLICY_VIOLATION)
        await websocket.accept()
        while True:
            data = await websocket.receive_text()
            await websocket.send_text(f"Session cookie is: {session}")
            await websocket.send_text(f"Message text was: {data}, for item ID: {item_id}")
    ```
    Ncodez
                A closing code from the
                [valid codes defined in the specification](https://datatracker.ietf.org/doc/html/rfc6455#section-7.4.1).
                reasonaw  
                The reason to close the WebSocket connection.

                It is UTF-8-encoded data. The interpretation of the reason is up to the
                application, it is not specified by the WebSocket specification.

                It could contain text that could be human-readable or interpretable
                by the client code, etc.
                r   c                 (    t         |   ||       y )N)r%   r&   r   )r   r%   r&   r   s      r   r   zWebSocketException.__init__n   s    4 	d62r   N)r   r   r   r   r   r    r   r   r!   r   r"   r#   s   @r   r   r   D   sq    'B 13
3 #t)

32 
33 3r   r   RequestRequestErrorModel	WebSocketWebSocketErrorModelc                       e Zd ZdZy)FastAPIErrorz,
    A generic, FastAPI-specific error.
    N)r   r   r   r    r   r   r.   r.      s    r   r.   c                   4    e Zd Zdee   ddfdZdee   fdZy)ValidationExceptionerrorsr   Nc                     || _         y r(   _errors)r   r2   s     r   r   zValidationException.__init__   s	    r   c                     | j                   S r(   r4   )r   s    r   r2   zValidationException.errors   s    ||r   )r   r   r   r   r   r   r2   r/   r   r   r1   r1      s)    x}   r   r1   c                   8     e Zd Zdddee   deddf fdZ xZS )RequestValidationErrorNbodyr2   r:   r   c                2    t         |   |       || _        y r(   r   r   r:   r   r2   r:   r   s      r   r   zRequestValidationError.__init__        	r   )r   r   r   r   r   r   r"   r#   s   @r   r8   r8      s)    =A x} s d  r   r8   c                       e Zd Zy)WebSocketRequestValidationErrorN)r   r   r   r/   r   r   r@   r@      s    r   r@   c                   D     e Zd Zdddee   deddf fdZdefdZ xZS )ResponseValidationErrorNr9   r2   r:   r   c                2    t         |   |       || _        y r(   r<   r=   s      r   r   z ResponseValidationError.__init__   r>   r   c                 j    t        | j                         d}| j                  D ]  }|d| dz  } |S )Nz validation errors:
z  
)lenr5   )r   messageerrs      r   __str__zResponseValidationError.__str__   sC    &''<=<< 	$CC5|#G	$r   )	r   r   r   r   r   r   r!   rI   r"   r#   s   @r   rB   rB      s0    =A x} s d  r   rB   N)typingr   r   r   r   r   r   pydanticr	   r
   starlette.exceptionsr   StarletteHTTPExceptionr   StarletteWebSocketExceptiontyping_extensionsr   r   r*   __annotations__r,   RuntimeErrorr.   	Exceptionr1   r8   r@   rB   r/   r   r   <module>rS      s    = = = , H R ,8R* 8RvD34 D3N &2)%< 4	? <'3K'@ T)_ @< ) 0 	&9 		1 	r   