o
    di>                     @   s\   d dl Z d dlmZ d dlmZ d dlmZ d dlmZ G dd deZ	G dd	 d	eZ
dS )
    N)Optional)Chalice)RestAPIEventHandler)Sessionc                       s   e Zd Z fddZ  ZS )AsyncRestAPIEventHandlerc                    s    fdd}t t| ||S )Nc                     s6    di | }t |rt  }||}|  |S )N )asyncioiscoroutinenew_event_looprun_until_completeclose)kwargsresponsenew_loopview_functionr   W/home/ubuntu/.local/lib/python3.10/site-packages/aioboto3/experimental/async_chalice.py_fake_view_function   s   

zQAsyncRestAPIEventHandler._get_view_function_response.<locals>._fake_view_function)superr   _get_view_function_response)selfr   function_argsr   	__class__r   r   r      s   	z4AsyncRestAPIEventHandler._get_view_function_response)__name__
__module____qualname__r   __classcell__r   r   r   r   r   
   s    r   c                       s4   e Zd Zdddee f fddZdd Z  ZS )AsyncChaliceN)aioboto3_sessionr   c                   s&   t t| j|i | |pt | _d S )N)r   r   __init__r   aioboto3)r   r   argsr   r   r   r   r       s   zAsyncChalice.__init__c                 C   s>   || _ t| j| j| j| j| dd}|||| _|||S )Nhttp)middleware_handlers)	lambda_contextr   routesapilogdebug_get_middleware_handlerscreate_request_objectcurrent_request)r   eventcontexthandlerr   r   r   __call__!   s   
zAsyncChalice.__call__)r   r   r   r   r   r    r0   r   r   r   r   r   r      s    r   )r   typingr   chalicer   chalice.appr   r!   r   r   r   r   r   r   r   <module>   s    