a
    õ£Be›  ã                   @   s&   d dl Zd dlmZ G dd„ dƒZdS )é    N)ÚOptionalc                   @   sN   e Zd Zddœdd„Zee ddœdd„Zeddœdd	„Zeed
œdd„ZdS )ÚSimpleCookieJarN)Úreturnc                 C   s   t ƒ | _d S )N)ÚdictÚjar)Úself© r   úW/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/websocket/_cookiejar.pyÚ__init__   s    zSimpleCookieJar.__init__)Ú
set_cookier   c                 C   s€   |r|t j |¡}| ¡ D ]b\}}| d¡}|r| d¡s@d| }| j |¡rX| j |¡nt j ¡ }| |¡ || j| ¡ < qd S ©NÚdomainÚ.)	ÚhttpÚcookiesÚSimpleCookieÚitemsÚgetÚ
startswithr   ÚupdateÚlower)r   r   ÚsimpleCookieÚkÚvr   Úcookier   r   r	   Úadd   s    

"
zSimpleCookieJar.addc                 C   sT   |rPt j |¡}| ¡ D ]6\}}| d¡}|r| d¡s@d| }|| j| ¡ < qd S r   )r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r	   Úset*   s    

zSimpleCookieJar.set)Úhostr   c              	   C   sx   |sdS g }| j  ¡ D ]<\}}| ¡ }| |¡s@||dd … kr| | j  |¡¡ qd td tdd„ td |ƒD ƒƒƒ¡S )NÚ é   z; c                 S   s,   g | ]$}|  ¡ D ]\}}d ||jf ‘qqS )z%s=%s)r   Úvalue)Ú.0r   r   r   r   r   r	   Ú
<listcomp>A   ó    z'SimpleCookieJar.get.<locals>.<listcomp>)	r   r   r   ÚendswithÚappendr   ÚjoinÚfilterÚsorted)r   r   r   r   r   r   r   r	   r   5   s    ÿÿzSimpleCookieJar.get)	Ú__name__Ú
__module__Ú__qualname__r
   r   Ústrr   r   r   r   r   r   r	   r      s   r   )Úhttp.cookiesr   Útypingr   r   r   r   r   r	   Ú<module>   s   