o
    ‹¨Êh÷  ã                   @   sî   d Z ddlZddlZi Zded< ded< ded< d	ed
< ded< ded< dd„ eddƒD ƒZe ¡ D ]\ZZeee< q2dd„ eddƒD ƒdd„ eddƒD ƒ dd„ eddƒD ƒ Z	e ¡ D ]\ZZee	e< q][[dd„ Z
e d¡Zdd„ ZdS )zEncoding related utilities.é    Nz\té	   z\né
   z\ré   z\"é"   z\'é'   z\\é\   c                 C   ó   g | ]}t |ƒ‘qS © ©Úchr©Ú.0Úir	   r	   úO/var/www/html/env/lib/python3.10/site-packages/google/protobuf/text_encoding.pyÚ
<listcomp>-   ó    r   é   c                 C   ó   g | ]}d | ‘qS ©z\%03or	   r   r	   r	   r   r   2   r   é    c                 C   r   r	   r
   r   r	   r	   r   r   3   r   é   c                 C   r   r   r	   r   r	   r	   r   r   4   r   c                    sl   t jrt| tƒ}|r|r|  t¡S |rtndd„ ‰ nt‰ |r*d ‡ fdd„| D ƒ¡S d ‡ f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).
  c                 S   s   | S ©Nr	   )Úxr	   r	   r   Ú<lambda>P   s    zCEscape.<locals>.<lambda>Ú c                 3   ó   � | ]	}t ˆ |ƒ V  qd S r   )Ú_cescape_unicode_to_str©r   Úc©Úord_r	   r   Ú	<genexpr>T   ó   € zCEscape.<locals>.<genexpr>c                 3   r   r   )Ú_cescape_byte_to_strr   r   r	   r   r!   U   r"   )ÚsixÚPY3Ú
isinstanceÚstrÚ	translateÚ_cescape_chr_to_symbol_mapÚordÚjoin)ÚtextÚas_utf8Útext_is_unicoder	   r   r   ÚCEscape:   s   

r/   z"(\\+)x([0-9a-fA-F])(?![0-9a-fA-F])c                 C   s:   dd„ }t  || ¡}tjr| d¡S | d¡ d¡ d¡S )z”Unescape 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                 S   s4   t |  d¡ƒd@ r|  d¡d |  d¡ S |  d¡S )Né   Úx0é   r   )ÚlenÚgroup)Úmr	   r	   r   Ú
ReplaceHexe   s   
zCUnescape.<locals>.ReplaceHexÚstring_escapezutf-8Úunicode_escapeÚraw_unicode_escape)Ú_CUNESCAPE_HEXÚsubr$   ÚPY2ÚdecodeÚencode)r,   r6   Úresultr	   r	   r   Ú	CUnescape[   s   
	
ýr@   )Ú__doc__Úrer$   r)   Úranger   ÚitemsÚbyteÚstringr#   r/   Úcompiler:   r@   r	   r	   r	   r   Ú<module>   s0   
ÿþ

