
    DQc                         d Z ddlZg dZ G d de          Z	 ddlmZ d Zn# e$ r dZ	dZ
g d	Zd
 Zd ZY nw xY wd Zd Zd ZdS )aH  
websocket - WebSocket client library for Python

Copyright (C) 2010 Hiroki Ohtani(liris)

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

    N)NoLockvalidate_utf8extract_err_messageextract_error_codec                       e Zd Zd Zd ZdS )r   c                     d S N )selfs    0lib/python3.11/site-packages/websocket/_utils.py	__enter__zNoLock.__enter__           c                     d S r	   r
   )r   exc_type	exc_value	tracebacks       r   __exit__zNoLock.__exit__   r   r   N)__name__
__module____qualname__r   r   r
   r   r   r   r      s2              r   r   )Utf8Validatorc                 P    t                                          |           d         S Nr   )r   validateutfbytess    r   _validate_utf8r   (   s    ''11!44r      (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   c                     t           |         }| t          k    r|dz  |dz  z  nd|z	  |z  }t           d| z   |z            } | |fS )N?   r)         )_UTF8D_UTF8_ACCEPT)statecodepchtps       r   _decoder<   F   sZ    BZ \!:duz**)-r(9 	sU{R'(e|r   c                     t           }d}| D ]?}t          j        rt          |          }t	          |||          \  }}|t
          k    r dS @dS )Nr   FT)r7   sixPY2ordr<   _UTF8_REJECT)r   r8   r9   is       r   r   r   O   se     	 	Aw FF"5%33LE5$ uu tr   c                      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   s    r   r   r   \   s     (###r   c                 .    | j         r| j         d         S d S r   )args	exceptions    r   r   r   e   s    ~ ~a  tr   c                     | j         rGt          | j                   dk    r1t          | j         d         t                    r| j         d         nd S d S d S )Nr    r   )rE   len
isinstanceintrF   s    r   r   r   l   sd    ~ Q#in--1 Q$.y~a/@#$F$FPy~a  DPQ Q Q Qr   )__doc__r>   __all__objectr   wsaccel.utf8validatorr   r   ImportErrorr7   rA   r6   r<   r   r   r   r
   r   r   <module>rQ      s   ( 



R
R
R    V   6 4333335 5 5 5  . . . LL/ / /F(  
 
 
 
 
I.b$ $ $  Q Q Q Q Qs   	$ ::