o
    Ñ­j  ã                   @   sö   d 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< q.d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< qY[[de	fdd„Z
e d¡Zde	def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	   úZ/var/www/html/CropPilot/venv/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      r   é    c                 C   r   r	   r
   r   r	   r	   r   r      r   é   c                 C   r   r   r	   r   r	   r	   r   r      r   Úreturnc                    s`   t | tƒ}|r|r|  t¡S |rtndd„ ‰ |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>5   s    zCEscape.<locals>.<lambda>Ú c                 3   ó   � | ]	}t ˆ |ƒ V  qd S r   )Ú_cescape_unicode_to_str©r   Úc©Úord_r	   r   Ú	<genexpr>7   ó   € zCEscape.<locals>.<genexpr>c                 3   r   r   )Ú_cescape_byte_to_strr   r    r	   r   r"   8   r#   )Ú
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])r+   c                 C   s*   dd„ }t  || ¡}| 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   Ú
ReplaceHexG   s   
zCUnescape.<locals>.ReplaceHexzutf-8Úunicode_escapeÚraw_unicode_escape)Ú_CUNESCAPE_HEXÚsubÚencodeÚdecode)r+   r5   Úresultr	   r	   r   Ú	CUnescape>   s   		ýr=   )Ú__doc__Úrer(   Úranger   ÚitemsÚbyteÚstringr$   r&   r.   Úcompiler8   Úbytesr=   r	   r	   r	   r   Ú<module>   s.   
ÿþ

