o
    $[iu                     @   s   d dl Z d dlmZ d dlmZmZmZmZmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZmZ G dd	 d	ZG d
d de
ZdS )    N)Path)AnyDictListSetUnion)ChannelOwner)Error)async_readfile)set_test_id_attribute_nametest_id_attribute_namec                   @   sx   e Zd ZdejdeddfddZ			ddeded	eee	f d
e
ddf
ddZdeddfddZdddZdddZdS )	Selectorsloopdispatcher_fiberreturnNc                 C   s   || _ t | _g | _|| _d S N)_loopset	_channels_registrations_dispatcher_fiber)selfr   r    r   [/var/www/html/flask_server/venv/lib/python3.10/site-packages/playwright/_impl/_selectors.py__init__   s   
zSelectors.__init__namescriptpathcontentScriptc                    sp   |s	|s	t d|rt|I d H  }t||d}|r d|d< | jD ]}|jd|I d H  q#| j| d S )Nz)Either source or path should be specified)r   sourceTr   register)	r	   r
   decodedictr   _channelsendr   append)r   r   r   r   r   paramschannelr   r   r   r        s   
zSelectors.registerattributeNamec                 C   s*   t | | jD ]}|jdd|i qd S )NsetTestIdAttributeNametestIdAttributeName)r   r   r#   send_no_reply)r   r(   r'   r   r   r   set_test_id_attribute2   s   
zSelectors.set_test_id_attributer'   SelectorsOwnerc                 C   s>   | j | | jD ]}|jd| |jddt i q	d S )Nr    r)   r*   )r   addr   r#   r+   r   )r   r'   r&   r   r   r   _add_channel9   s   
zSelectors._add_channelc                 C   s   || j v r| j | d S d S r   )r   remove)r   r'   r   r   r   _remove_channelC   s   
zSelectors._remove_channel)NNN)r'   r-   r   N)__name__
__module____qualname__asyncioAbstractEventLoopr   r   strr   r   boolr    r,   r/   r1   r   r   r   r   r      s&    	



r   c                
       s2   e Zd Zdededededdf
 fddZ  ZS )	r-   parenttypeguidinitializerr   Nc                    s   t  |||| d S r   )superr   )r   r9   r:   r;   r<   	__class__r   r   r   I   s   zSelectorsOwner.__init__)r2   r3   r4   r   r7   r   r   __classcell__r   r   r>   r   r-   H   s    r-   )r5   pathlibr   typingr   r   r   r   r   playwright._impl._connectionr   playwright._impl._errorsr	   playwright._impl._helperr
   playwright._impl._locatorr   r   r   r-   r   r   r   r   <module>   s   /