U
    õÕ/es
  ã                   @  s¨   d Z ddlmZ ddlZe e¡ZddlmZ ddl	m
Z
mZmZmZ ddlZddlmZ ddlmZ e
rvddlmZ d	Zd
ZG dd„ deƒZejdddœdd„ƒZdS )z3 Define a Pytest plugin to provide a Bokeh server

é    )ÚannotationsN©Úcontextmanager)ÚTYPE_CHECKINGÚAnyÚContextManagerÚIterator)ÚProtocol)ÚServer)ÚApplication© )ÚManagedServerLoopc                   @  s"   e Zd Zd	dddddœdd„ZdS )
ÚMSLNr   ú
int | Noner   zContextManager[Server]©ÚapplicationÚportÚserver_kwargsÚreturnc                 K  s   d S )Nr   )Úselfr   r   r   r   r   úN/tmp/pip-unpacked-wheel-f5fndrjf/bokeh/_testing/plugins/managed_server_loop.pyÚ__call__9   ó    zMSL.__call__)N)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   8   s   r   Úint)Úunused_tcp_portr   c                   s"   t ddddddœ‡ fdd„ƒ}|S )	Nr   r   r   zIterator[Server]r   c                 ;  sB   |d krˆ }t | fd|i|—Ž}| ¡  |V  | ¡  | ¡  d S )Nr   )r
   ÚstartZunlistenÚstop)r   r   r   Úserver©r   r   r   Úmsl=   s    zManagedServerLoop.<locals>.msl)Nr   )r   r"   r   r!   r   r   ;   s    r   )Ú__doc__Ú
__future__r   ÚloggingÚ	getLoggerr   ÚlogÚ
contextlibr   Útypingr   r   r   r   ZpytestZtyping_extensionsr	   Zbokeh.server.serverr
   Zbokeh.applicationr   Zpytest_pluginsÚ__all__r   Zfixturer   r   r   r   r   Ú<module>   s   
