o
    :Di                     @   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	   V/var/www/Datamplify/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 )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                 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.   


