a
    £Ê›e1  ã                   @   sæ   d dl mZ g d¢ZG dd„ dƒZz(d dlmZ eeef edœdd„Z	W nN e
y˜   d Zd	Zg d
¢Zeeeedœdd„Zeeef edœdd„Z	Y n0 eeef edœdd„Zeeedf dœdd„Zeeedf dœdd„ZdS )é    )ÚUnion)ÚNoLockÚvalidate_utf8Úextract_err_messageÚextract_error_codec                   @   s(   e Zd Zddœdd„Zddœdd„ZdS )r   N)Úreturnc                 C   s   d S ©N© )Úselfr	   r	   úK/var/www/html/efn/efnconsultor/selenium/selenium-4.34.2/websocket/_utils.pyÚ	__enter__   s    zNoLock.__enter__c                 C   s   d S r   r	   )r
   Úexc_typeÚ	exc_valueÚ	tracebackr	   r	   r   Ú__exit__   s    zNoLock.__exit__)Ú__name__Ú
__module__Ú__qualname__r   r   r	   r	   r	   r   r      s   r   )ÚUtf8Validator)Úutfbytesr   c                 C   s   t ƒ  | ¡d }|S ©Nr   )r   Úvalidate)r   Úresultr	   r	   r   Ú_validate_utf8%   s    r   é   (l  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   é   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   é	   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   é   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   é   r   é   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   é
   é   r!   r!   r!   r!   r!   r!   r!   r!   r!   r!   r!   é   r!   r!   é   é   r$   r$   é   r   r   r   r   r   r   r   r   r   r   r   r   r   é   é$   é<   é`   éT   r   r   r   é0   éH   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r&   r   r   r   r   r   r&   r   r&   r   r   r   r   r   r   r   r   r   r&   r   r   r   r   r   r&   r   r   r   r   r   r   r   r&   r   r   r   r   r   r   r   r   r   r'   r   r'   r   r   r   r'   r   r   r   r   r   r'   r   r'   r   r   r   r'   r   r   r   r   r   r   r   r   r   r   )ÚstateÚcodepÚchr   c                 C   sD   t | }| tkr |d@ |d> B n
d|? |@ }t d|  |  } | |fS )Né?   r$   éÿ   é   )Ú_UTF8DÚ_UTF8_ACCEPT)r-   r.   r/   Útpr	   r	   r   Ú_decode£  s
    "ÿr6   c                 C   s8   t }d}| D ]&}t||t|ƒƒ\}}|tkr dS qdS )Nr   FT)r4   r6   ÚintÚ_UTF8_REJECT)r   r-   r.   Úir	   r	   r   r   ­  s    c                 C   s   t | ƒS )zš
    validate utf8 byte string.
    utfbytes: utf byte string to check.
    return value: if valid utf8 string, return true. Otherwise, return false.
    )r   )r   r	   r	   r   r   ¸  s    r   N)Ú	exceptionr   c                 C   s   | j r| j d }|S d S d S r   )Úargs)r:   Zexception_messager	   r	   r   r   Á  s    
r   c                 C   s6   | j r2t| j ƒdkr2t| j d tƒr.| j d S d S d S )Nr   r   )r;   ÚlenÚ
isinstancer7   )r:   r	   r	   r   r   É  s    r   )Útypingr   Ú__all__r   Zwsaccel.utf8validatorr   ÚstrÚbytesÚboolr   ÚImportErrorr4   r8   r3   r7   Útupler6   r   Ú	Exceptionr   r   r	   r	   r	   r   Ú<module>   s      u
	