
    Ng%                        d Z ddlZd Zd Z e            Zd  edd          D             Ze                    e           e                    d  edd          D                        d	 Zd
e	fdZ
 ej        d          Zde	d
efdZdS )zEncoding related utilities.    Nc                     | dk    o| dk     S )N        )is    Y/var/www/html/ai-engine/env/lib/python3.11/site-packages/google/protobuf/text_encoding.py_AsciiIsPrintr	      s    	
b	QW    c                  6   i } t          dd          D ]}t          |          s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$ii.#c$ii.#c$ii.#c#hh-#c$ii.#c$ii.	*r
   c                 .    i | ]}|t          |          S r   )chr.0r   s     r   
<dictcomp>r      s     222qCFF222r
      c                     i | ]}|d |z  	S )r   r   r   s     r   r   r   !   s    ???!aA???r
   r   c                 |   d}| r	 ||                      d                              t                    z  }d} n# t          $ rt}|| d |j                                      d                              t                    z  }|t
          | |j                          z  }| |j        dz   d          } Y d }~nd }~ww xY w| |S )N utf-8   )decode	translate_str_escapesUnicodeDecodeErrorstart_byte_escapes)
text_bytesr   es      r   _DecodeUtf8EscapeErrorsr+   $   s    
# **	Zw''11,???cjj * * *	Z!((11;;LIIIc	]:ag.//cagaijj)jjjjjj*	 	 * 
*s   29 
B7A*B22B7returnc                     t          | t                    }|r+|r|                     t                    S t	          |           S |r|                     d          } d                    d | D                       S )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    c                 (    g | ]}t           |         S r   )r(   )r   cs     r   
<listcomp>zCEscape.<locals>.<listcomp>J   s    333M!$333r
   )
isinstancestrr$   r%   r+   encodejoin)textas_utf8text_is_unicodes      r   CEscaper8   1   s}      tS))/ 5 +^^L)))$T*** "[[!!d7733d333444r
   z"(\\+)x([0-9a-fA-F])(?![0-9a-fA-F])r5   c                    d }t                               ||           }|                    d                              d          }|                    d                              d          }|                    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          |                     d                    dz  r.|                     d          dz   |                     d          z   S |                     d          S )Nr"   x0   r   )lengroup)ms    r   
ReplaceHexzCUnescape.<locals>.ReplaceHexY   sU     1771:: ,WWQZZ$++771::r
   raw_unicode_escaper!   unicode_escapezlatin-1)_CUNESCAPE_HEXsubr3   r#   )r5   r@   results      r   	CUnescaperF   P   s       j$//& ==-..556JKK& ==!!(()9::&	y	!	!!r
   )__doc__rer	   r   r%   r   r(   updater+   r2   r8   compilerC   bytesrF   r   r
   r   <module>rL      s   " ! 				        32EE!SMM222   \ " " "   ??uuS#??? @ @ @
 
 
5c 5 5 5 58 ABB"C "E " " " " " "r
   