
    ]                     4   S r SSKr0 rS\S'   S\S'   S\S'   S	\S
'   S\S'   S\S'   \" SS5       V s/ s H  n \" U 5      PM     sn r\R                  5        H  u  rr\\\'   M     \" SS5       V s/ s H  n SU -  PM
     sn \" SS5       V s/ s H  n \" U 5      PM     sn -   \" SS5       V s/ s H  n SU -  PM
     sn -   r	\R                  5        H  u  rr\\	\'   M     CCS\
4S jr\R                  " S5      rS\
S\4S jrgs  sn f s  sn f s  sn f s  sn f )zEncoding related utilities.    Nz\t	   z\n
   z\r   z\""   z\''   z\\\          z\%03o   returnc                   ^ [        U [        5      nU(       a  U(       a  U R                  [        5      $ U(       a  [        OS mU(       a  SR                  U4S jU  5       5      $ SR                  U4S jU  5       5      $ )a]  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                     U $ N )xs    P/root/google-cloud-sdk/lib/third_party/cloudsdk/google/protobuf/text_encoding.py<lambda>CEscape.<locals>.<lambda>L   s    q     c              3   B   >#    U  H  n[         T" U5         v   M     g 7fr   )_cescape_unicode_to_str.0cord_s     r   	<genexpr>CEscape.<locals>.<genexpr>N   s     BT*473T   c              3   B   >#    U  H  n[         T" U5         v   M     g 7fr   )_cescape_byte_to_strr   s     r   r   r   O   s     =1%d1g.r   )
isinstancestr	translate_cescape_chr_to_symbol_mapordjoin)textas_utf8text_is_unicoder   s      @r   CEscaper+   8   s\      tS)/>>455[$77BTBBB	==	==r   z"(\\+)x([0-9a-fA-F])(?![0-9a-fA-F])r(   c                     S n[         R                  X5      nUR                  S5      R                  S5      R                  S5      $ )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                     [        U R                  S5      5      S-  (       a&  U R                  S5      S-   U R                  S5      -   $ U R                  S5      $ )N   x0   r   )lengroup)ms    r   
ReplaceHexCUnescape.<locals>.ReplaceHex^   sF     1771:WWQZ$++771:r   zutf-8unicode_escaperaw_unicode_escape)_CUNESCAPE_HEXsubencodedecode)r(   r4   results      r   	CUnescaper=   U   s@     j/&
--
 6"#6&')r   )__doc__rer%   rangechrr   itemsbytestringr!   r#   r+   compiler8   bytesr=   )is   0r   <module>rH      sf  > " 	  % 1 !& 2 !& 2 !& 2 !& 2 !& 2  ,1C=9=a3q6=9 .446LD&"($ 7 05Q|<|!A|<).r38AQ89/4S#?!A?@  /446LD&%t 7&>c >4 AB)C )E )U :
 =8?s   D1DD.D