
    g%                     6   d Z ddlZd Zd Z e       Z edd      D  ci c]  } |  e|        c} Zej                  e       ej                   edd      D  ci c]  } | d| z  
 c}        d Z	d	e
fd
Z ej                  d      Zde
d	efdZyc c} w c c} w )zEncoding related utilities.    Nc                     | dk\  xr | dk  S )N        is    R/var/www/openai/venv/lib/python3.12/site-packages/google/protobuf/text_encoding.py_AsciiIsPrintr
      s    	
b	QW    c                      i } t        dd      D ]  }t        |      rd|z  | |<    d| t        d      <   d| t        d      <   d| t        d	      <   d
| t        d      <   d| t        d      <   d| t        d      <   | S )Nr      \%03oz\t	z\n
z\rz\""z\''z\\\)ranger
   ord)retr   s     r	   _MakeStrEscapesr      s    
#C=a!|c!f  #c$i.#c$i.#c$i.#c#h-#c$i.#c$i.	*r      r   r   c                 R   d}| r-	 || j                  d      j                  t              z  }d} | r-|S # t        $ ri}|| d |j                   j                  d      j                  t              z  }|t
        | |j                        z  }| |j                  dz   d  } Y d }~rd }~ww xY w)N utf-8   )decode	translate_str_escapesUnicodeDecodeErrorstart_byte_escapes)
text_bytesr   es      r	   _DecodeUtf8EscapeErrorsr&   $   s    
#*	Zw'11,??cj 	 
*	  *	Z!((1;;LIIc	]:agg.//caggaij)j*s   )4 	B&AB!!B&returnc                     t        | t              }|r"|r| j                  t              S t	        |       S |r| j                  d      } dj                  | D cg c]  }t        |    c}      S c c}w )am  Escape a bytes string for use in an text protocol buffer.

  Args:
    text: A byte string to be escaped.
    as_utf8: Specifies if result may contain non-ASCII characters.
        In Python 3 this allows unescaped non-ASCII Unicode characters.
        In Python 2 the return value will be valid UTF-8 rather than only ASCII.
  Returns:
    Escaped string (str).
  r   r   )
isinstancestrr   r    r&   encodejoinr#   )textas_utf8text_is_unicodecs       r	   CEscaper1   1   sg      tS)/^^L))$T**[[!d77d3dM!$d3443s   A.z"(\\+)x([0-9a-fA-F])(?![0-9a-fA-F])r-   c                     d }t         j                  ||       }|j                  d      j                  d      }|j                  d      j                  d      }|j                  d      S )zUnescape a text string with C-style escape sequences to UTF-8 bytes.

  Args:
    text: The data to parse in a str.
  Returns:
    A byte string.
  c                     t        | j                  d            dz  r&| j                  d      dz   | j                  d      z   S | j                  d      S )Nr   x0   r   )lengroup)ms    r	   
ReplaceHexzCUnescape.<locals>.ReplaceHexY   sF     1771:WWQZ$++771:r   raw_unicode_escaper   unicode_escapezlatin-1)_CUNESCAPE_HEXsubr+   r   )r-   r9   results      r	   	CUnescaper?   P   sc     j$/& ==-.556JK& ==!(()9:&	y	!!r   )__doc__rer
   r   r    r   chrr#   updater&   r*   r1   compiler<   bytesr?   r   s   0r	   <module>rF      s    " 	   %*!SM2MqCFM2   \ "   uS#?!aAo? @
5c 58 AB"C "E "c 3?s   BB