� K�g�)��F�ddlmZddlZddlZddlZejdkrddlmZnddlmZddlm Z m Z ddl m Z m Z ddlmZddlmZdd lmZdd lmZdd lmZdd lmZmZdd lmZmZmZmZm Z m!Z!ddl"m#Z#ej$dd���Z%ed��Z&Gd�d��Z'dS)�)� annotationsN)�� )� ParamSpec)�State�URLPath)� Middleware�_MiddlewareFactory)�BaseHTTPMiddleware)�ServerErrorMiddleware)�ExceptionMiddleware)�Request)�Response)� BaseRoute�Router)�ASGIApp�ExceptionHandler�Lifespan�Receive�Scope�Send)� WebSocket�AppType� Starlette)�bound�Pc���eZdZdZ dLdMd�ZdNd�ZedOd���ZdPd�ZdQd&�Z dRd)�Z dSdTd-�Z dSdUd/�Z dVd6�Z dWd;�ZdXd=�Z dYdZdD�Z dSd[dF�Zd\dG�Z dYd]dH�ZdSd^dI�Zd_dK�ZdS)`rz!Creates an Starlette application.FN�selfr�debug�bool�routes�!typing.Sequence[BaseRoute] | None� middleware�"typing.Sequence[Middleware] | None�exception_handlers�3typing.Mapping[typing.Any, ExceptionHandler] | None� on_startup�7typing.Sequence[typing.Callable[[], typing.Any]] | None� on_shutdown�lifespan�Lifespan[AppType] | None�return�Nonec���|�|�|� Jd���||_t��|_t||||���|_|�int |��|_|�gnt|��|_d|_ dS)a�Initializes the application. Parameters: debug: Boolean indicating if debug tracebacks should be returned on errors. routes: A list of routes to serve incoming HTTP and WebSocket requests. middleware: A list of middleware to run for every request. A starlette application will always automatically include two middleware classes. `ServerErrorMiddleware` is added as the very outermost middleware, to handle any uncaught errors occurring anywhere in the entire stack. `ExceptionMiddleware` is added as the very innermost middleware, to deal with handled exception cases occurring in the routing or endpoints. exception_handlers: A mapping of either integer status codes, or exception class types onto callables which handle the exceptions. Exception handler callables should be of the form `handler(request, exc) -> response` and may be either standard functions, or async functions. on_startup: A list of callables to run on application startup. Startup handler callables do not take any arguments, and may be either standard functions, or async functions. on_shutdown: A list of callables to run on application shutdown. Shutdown handler callables do not take any arguments, and may be either standard functions, or async functions. lifespan: A lifespan context function, which can be used to perform startup and shutdown tasks. This is a newer style that replaces the `on_startup` and `on_shutdown` handlers. Use one or the other, not both. Nz>Use either 'lifespan' or 'on_startup'/'on_shutdown', not both.)r'r)r*) rr�stater�router�dictr%�list�user_middleware�middleware_stack)rrr!r#r%r'r)r*s �f/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/starlette/applications.py�__init__zStarlette.__init__s���L�� � �;�#6�#6� K�$7�#6� ��� ��W�W�� ��V� � �^f�g�g�g�� �(:�(B�"�"��M_�H`�H`���%/�%7�r�r�T�*�=M�=M���04�����rc�D�|j}d}i}|j���D]\}}|dtfvr|}�|||<�t t ||���g|jzt t||���gz}|j}t|��D]\}} } ||g| �Ri| ��}�|S)Ni�)�handlerr)�handlersr) rr%�items� Exceptionr r r3r r0�reversed) rr� error_handlerr%�key�valuer#�app�cls�args�kwargss r5�build_middleware_stackz Starlette.build_middleware_stackOs���� ��� �`b���1�7�7�9�9� 0� 0�J�C���s�I�&�&�&� %� � �*/�"�3�'�'��-�}�E� R� R� R� S��"� #��-�8J�RW�X�X�X�Y� Z� � �k��!)�*�!5�!5� ,� ,� �C��v��#�c�+�D�+�+�+�F�+�+�C�C�� r7�list[BaseRoute]c��|jjS�N)r0r!)rs r5r!zStarlette.routeses ���{�!�!r7�name�str� path_params� typing.Anyrc �(�|jj|fi|��SrH)r0� url_path_for)rrIrKs r5rNzStarlette.url_path_foris��'�t�{�'��<�<� �<�<�<r7�scoper�receiver�sendrc��K�||d<|j�|���|_|�|||���d{V��dS)NrA)r4rE)rrOrPrQs r5�__call__zStarlette.__call__ls\������e� � � � (�$(�$?�$?�$A�$A�D� !��#�#�E�7�D�9�9�9�9�9�9�9�9�9�9�9r7� event_type�typing.Callablec�6�|j�|��SrH)r0�on_event)rrTs r5rWzStarlette.on_eventrs���{�#�#�J�/�/�/r7�pathrA� str | Nonec�@�|j�|||���dS�N)rArI)r0�mount)rrXrArIs r5r\zStarlette.mountus%�� � ���$�C�d��3�3�3�3�3r7�hostc�@�|j�|||���dSr[)r0r])rr]rArIs r5r]zStarlette.hostxs%�� � ����3�T��2�2�2�2�2r7�middleware_class�_MiddlewareFactory[P]rC�P.argsrD�P.kwargsc��|j�td���|j�dt |g|�Ri|����dS)Nz6Cannot add middleware after an application has startedr)r4� RuntimeErrorr3�insertr )rr_rCrDs r5�add_middlewarezStarlette.add_middleware{sT�� � � ,��W�X�X� X� ��#�#�A�z�2B�'T�T�'T�'T�'T�V�'T�'T�U�U�U�U�Ur7�exc_class_or_status_code�int | type[Exception]r9rc��||j|<dSrH)r%)rrgr9s r5�add_exception_handlerzStarlette.add_exception_handler�s�� =D��� 8�9�9�9r7�funcc�<�|j�||��dSrH)r0�add_event_handler)rrTrks r5rmzStarlette.add_event_handler�s"�� � �%�%�j�$�7�7�7�7�7r7T�route�Atyping.Callable[[Request], typing.Awaitable[Response] | Response]�methods�list[str] | None�include_in_schemac�D�|j�|||||���dS�N)rprIrr�r0� add_route)rrXrnrprIrrs r5rvzStarlette.add_route�s,�� � ���d�E�7��Yj��k�k�k�k�kr7�4typing.Callable[[WebSocket], typing.Awaitable[None]]c�@�|j�|||���dS�N)rI�r0�add_websocket_route)rrXrnrIs r5r{zStarlette.add_websocket_route�s'�� � �'�'��e�$�'�?�?�?�?�?r7c�L���tjdt��d��fd� }|S)Nz�The `exception_handler` decorator is deprecated, and will be removed in version 1.0.0. Refer to https://www.starlette.io/exceptions/ for the recommended approach.rkrUr,c�4�����|��|SrH)rj)rkrgrs ��r5� decoratorz.Starlette.exception_handler.<locals>.decorator�s��� � &� &�'?�� F� F� F��Kr7�rkrUr,rU��warnings�warn�DeprecationWarning)rrgr~s`` r5�exception_handlerzStarlette.exception_handler�sL����� � Z� � � � �  � � � � � � ��r7c�X������tjdt��d�����fd� }|S)z� We no longer document this decorator style API, and its usage is discouraged. Instead you should use the following approach: >>> routes = [Route(path, endpoint=...), ...] >>> app = Starlette(routes=routes) z�The `route` decorator is deprecated, and will be removed in version 1.0.0. Refer to https://www.starlette.io/routing/ for the recommended approach.rkrUr,c�F���j��|������|Srtru)rkrrrprIrXrs �����r5r~z"Starlette.route.<locals>.decorator�s8��� �K� !� !�����"3� "� � � ��Kr7rr�)rrXrprIrrr~s````` r5rnzStarlette.route�s`������� � � W� � � � �  � � � � � � � � � ��r7c�P����tjdt��d���fd� }|S)a We no longer document this decorator style API, and its usage is discouraged. Instead you should use the following approach: >>> routes = [WebSocketRoute(path, endpoint=...), ...] >>> app = Starlette(routes=routes) z�The `websocket_route` decorator is deprecated, and will be removed in version 1.0.0. Refer to https://www.starlette.io/routing/#websocket-routing for the recommended approach.rkrUr,c�B���j��|����|Sryrz)rkrIrXrs ���r5r~z,Starlette.websocket_route.<locals>.decorator�s%��� �K� +� +�D�$�T� +� B� B� B��Kr7rr�)rrXrIr~s``` r5�websocket_routezStarlette.websocket_route�sT����� � � i� � � � �  � � � � � � � ��r7�middleware_typec�h��tjdt��|dks Jd���d�fd� }|S) z� We no longer document this decorator style API, and its usage is discouraged. Instead you should use the following approach: >>> middleware = [Middleware(...), ...] >>> app = Starlette(middleware=middleware) z�The `middleware` decorator is deprecated, and will be removed in version 1.0.0. Refer to https://www.starlette.io/middleware/#using-middleware for recommended approach.�httpz/Currently only middleware("http") is supported.rkrUr,c�@����t|���|S)N)�dispatch)rfr )rkrs �r5r~z'Starlette.middleware.<locals>.decorator�s"��� � � � 2�T� � B� B� B��Kr7rr�)rr�r~s` r5r#zStarlette.middleware�sd��� � � g� � � � � �&�(�(�(�*[�(�(�(� � � � � � ��r7)FNNNNNN)rrrr r!r"r#r$r%r&r'r(r)r(r*r+r,r-)r,r)r,rF)rIrJrKrLr,r)rOrrPrrQrr,r-)rTrJr,rUrH)rXrJrArrIrYr,r-)r]rJrArrIrYr,r-)r_r`rCrarDrbr,r-)rgrhr9rr,r-)rTrJrkrUr,r-)NNT) rXrJrnrorprqrIrYrrr r,r-)rXrJrnrwrIrYr,r-)rgrhr,rU) rXrJrprqrIrYrrr r,rU)rXrJrIrYr,rU)r�rJr,rU)�__name__� __module__� __qualname__�__doc__r6rE�propertyr!rNrSrWr\r]rfrjrmrvr{r�rnr�r#�r7r5rrs�������+�+��48�9=�RV�NR�OS�-1�/5�/5�/5�/5�/5�b����,�"�"�"��X�"�=�=�=�=�:�:�:�:� 0�0�0�0�4�4�4�4�4�3�3�3�3�3�V�V�V�V�D�D�D�D�8�8�8�8�%)��"&� l�l�l�l�l� � @�@�@�@�@� � � � � %)��"&� �����@�����(�����r7)(� __future__r�sys�typingr�� version_infor�typing_extensions�starlette.datastructuresrr�starlette.middlewarer r �starlette.middleware.baser �starlette.middleware.errorsr �starlette.middleware.exceptionsr �starlette.requestsr�starlette.responsesr�starlette.routingrr�starlette.typesrrrrrr�starlette.websocketsr�TypeVarrrrr�r7r5�<module>r�s���"�"�"�"�"�"� � � � � � � � �������w��� � � � � � � �+�+�+�+�+�+�3�3�3�3�3�3�3�3�?�?�?�?�?�?�?�?�8�8�8�8�8�8�=�=�=�=�=�=�?�?�?�?�?�?�&�&�&�&�&�&�(�(�(�(�(�(�/�/�/�/�/�/�/�/�U�U�U�U�U�U�U�U�U�U�U�U�U�U�U�U�*�*�*�*�*�*� �&�.��+� 6� 6� 6�� �I�c�N�N��^�^�^�^�^�^�^�^�^�^r7
Memory