
                             S r SSKr/ SQr " S S\5      r SSKJr  S rS rS rS rg! \ a    Sr	Sr
/ S	QrS
 rS r N f = f)aK  
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-1335  USA

    N)NoLockvalidate_utf8extract_err_messageextract_error_codec                        \ rS rSrS rS rSrg)r      c                     g N )selfs    #lib/third_party/websocket/_utils.py	__enter__NoLock.__enter__           c                     g r
   r   )r   exc_type	exc_value	tracebacks       r   __exit__NoLock.__exit__    r   r   r   N)__name__
__module____qualname____firstlineno__r   r   __static_attributes__r   r   r   r   r      s    r   r   )Utf8Validatorc                 :    [        5       R                  U 5      S   $ Nr   )r   validateutfbytess    r   _validate_utf8r#   (   s    ''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$   r0   r$   r$   r$   r$   r$   r0   r$   r0   r$   r$   r$   r$   r$   r$   r$   r$   r$   r0   r$   r$   r$   r$   r$   r0   r$   r$   r$   r$   r$   r$   r$   r0   r$   r$   r$   r$   r$   r$   r$   r$   r$   r1   r$   r1   r$   r$   r$   r1   r$   r$   r$   r$   r$   r1   r$   r1   r$   r$   r$   r1   r$   r$   r$   r$   r$   r$   r$   r$   r$   r$   c                 r    [         U   nU [        :w  a  US-  US-  -  OSU-	  U-  n[         SU -   U-      n X4$ )N?   r.         )_UTF8D_UTF8_ACCEPT)statecodepchtps       r   _decoderA   F   sS    BZ \! duz*)-r(9 	sU{R'(|r   c                     [         nSnU  H=  n[        R                  (       a  [        U5      n[	        XU5      u  pU[
        :X  d  M=    g   g)Nr   FT)r<   sixPY2ordrA   _UTF8_REJECT)r"   r=   r>   is       r   r#   r#   O   sD    AwwF"53LE$  r   c                     [        U 5      $ )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                 D    U R                   (       a  U R                   S   $ g r   )args	exceptions    r   r   r   e   s    ~~~~a  r   c                     U R                   (       aM  [        U R                   5      S:  a3  [        U R                   S   [        5      (       a  U R                   S   $ S $ g g )Nr%   r   )rJ   len
isinstanceintrK   s    r   r   r   l   sI    ~~#inn-1$.y~~a/@#$F$Fy~~a PDP 2~r   )__doc__rC   __all__objectr   wsaccel.utf8validatorr   r#   ImportErrorr<   rF   r;   rA   r   r   r   r   r   r   <module>rV      sp   * 
RV 6 45h$QC  . LL/F(
I.s   	* A A