o
    ˷ex                     @   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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	   T/var/www/ideatree/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   0   r       c                 C   r   r	   r
   r   r	   r	   r   r   1   r      c                 C   r   r   r	   r   r	   r	   r   r   2   r   c                    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>M   s    zCEscape.<locals>.<lambda> c                 3       | ]	}t  | V  qd S r   )_cescape_unicode_to_strr   cord_r	   r   	<genexpr>O       zCEscape.<locals>.<genexpr>c                 3   r   r   )_cescape_byte_to_strr   r   r	   r   r!   P   r"   )
isinstancestr	translate_cescape_chr_to_symbol_mapordjoin)textas_utf8text_is_unicoder	   r   r   CEscape8   s   

r-   z"(\\+)x([0-9a-fA-F])(?![0-9a-fA-F])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   
ReplaceHex`   s   
zCUnescape.<locals>.ReplaceHexzutf-8unicode_escaperaw_unicode_escape)_CUNESCAPE_HEXsubencodedecode)r*   r4   resultr	   r	   r   	CUnescapeV   s   
	r<   )__doc__rer'   ranger   itemsbytestringr#   r-   compiler7   r<   r	   r	   r	   r   <module>   s.   


