o
    b                     @   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	   \/var/www/secure340b-portal/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Z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)textZas_utf8Z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 )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   Zx0   r   )lengroup)mr	   r	   r   
ReplaceHexe   s   
zCUnescape.<locals>.ReplaceHexZstring_escapezutf-8unicode_escapeZraw_unicode_escape)_CUNESCAPE_HEXsubr#   PY2decodeencode)r+   r2   resultr	   r	   r   	CUnescape[   s   
	
r:   )__doc__rer#   r(   ranger   itemsbytestringr"   r,   compiler4   r:   r	   r	   r	   r   <module>   s0   


