§
    ¯eîi˜  ã                   ód   — d Z ddlmZ ddlmZ ddlmZ ddlZdd„Zdd„Zdd„Zdd	„Z	dd
„Z
d„ ZdS )zCA module for dealing with unknown string and environment encodings.é    )Úabsolute_import)Údivision)Úunicode_literalsNc                 ó   — ~| S )z·Encode the text string to a byte string.

  Args:
    string: str, The text string to encode.
    encoding: The suggested encoding if known.

  Returns:
    str, The binary string.
  © )ÚstringÚencodings     úY/home/div/.hermes/hermes-agent/venv/lib/python3.11/site-packages/fire/console/encoding.pyÚEncoder      s   € ð Ø	€-ó    c                 óž  — | €dS t          | t          ¦  «        st          | t          ¦  «        r| }nt          | ¦  «        }t          |t          ¦  «        r|S 	 |                     d¦  «        S # t          $ r Y nw xY w|r&	 |                     |¦  «        S # t          $ r Y nw xY w	 |                     d¦  «        S # t          $ r Y nw xY w	 |                     t          j        ¦   «         ¦  «        S # t          $ r Y nw xY w	 |                     t          j        ¦   «         ¦  «        S # t          $ r Y nw xY w|                     d¦  «        S )a§  Returns string with non-ascii characters decoded to UNICODE.

  UTF-8, the suggested encoding, and the usual suspects will be attempted in
  order.

  Args:
    data: A string or object that has str() and unicode() methods that may
      contain an encoding incompatible with the standard output encoding.
    encoding: The suggested encoding if known.

  Returns:
    A text string representing the decoded byte string.
  NÚasciiÚutf8z
iso-8859-1)Ú
isinstanceÚstrÚbytesÚdecodeÚUnicodeErrorÚsysÚgetfilesystemencodingÚgetdefaultencoding)Údatar	   r   s      r
   ÚDecoder   (   s¡  € ð 
€\Øˆ4õ �•cÑÔð �j¨­uÑ5Ô5ð Ø€F€Fõ �‰YŒY€Få��ÑÔð à€Mð	à�=Š=˜Ñ!Ô!Ð!øÝ	ð 	ð 	ð 	à€Dð	øøøð
 ð ðØ�]Š]˜8Ñ$Ô$Ð$øÝð ð ð à
€dðøøøð	Ø�=Š=˜Ñ Ô Ð øÝ	ð 	ð 	ð 	à€Dð	øøøð
	Ø�=Š=�Ô2Ñ4Ô4Ñ5Ô5Ð5øÝ	ð 	ð 	ð 	à€Dð	øøøð
	Ø�=Š=�Ô/Ñ1Ô1Ñ2Ô2Ð2øÝ	ð 	ð 	ð 	à€Dð	øøøð& 
�Š�|Ñ	$Ô	$Ð$sZ   ÁA. Á.
A;Á:A;ÂB Â
B#Â"B#Â'B< Â<
C	ÃC	Ã%C3 Ã3
D Ã?D Ä%D* Ä*
D7Ä6D7c                 óp   — t          |¦  «        }|                      |¦  «        }|€|S t          |¦  «        S )zíReturns the decoded value of the env var name.

  Args:
    env: {str: str}, The env dict.
    name: str, The env var name.
    default: The value to return if name is not in env.

  Returns:
    The decoded value of the env var name.
  )r   Úgetr   )ÚenvÚnameÚdefaultÚvalues       r
   ÚGetEncodedValuer    |   s6   € õ 
�‰Œ€$Ø
�'Š'�$‰-Œ-€%Ø
€]Ø€Nõ 
�‰ŒÐr   c                 ó„   — t          ||¬¦  «        }|€|                      |d¦  «         dS t          ||¬¦  «        | |<   dS )a!  Sets the value of name in env to an encoded value.

  Args:
    env: {str: str}, The env dict.
    name: str, The env var name.
    value: str or unicode, The value for name. If None then name is removed from
      env.
    encoding: str, The encoding to use or None to try to infer it.
  ©r	   N)r   Úpop)r   r   r   r	   s       r
   ÚSetEncodedValuer$   �   sN   € õ& 
�˜xÐ	(Ñ	(Ô	(€$Ø
€]Ø‡G‚GˆD�$ÑÔÐØ
€FÝ�U XÐ.Ñ.Ô.€#€d�)€)€)r   c                 ód   ‡— ‰pt          ¦   «         Šˆfd„|                      ¦   «         D ¦   «         S )a%  Encodes all the key value pairs in env in preparation for subprocess.

  Args:
    env: {str: str}, The environment you are going to pass to subprocess.
    encoding: str, The encoding to use or None to use the default.

  Returns:
    {bytes: bytes}, The environment to pass to subprocess.
  c                 óX   •— i | ]&\  }}t          |‰¬ ¦  «        t          |‰¬ ¦  «        “Œ'S )r"   )r   )Ú.0ÚkÚvr	   s      €r
   ú
<dictcomp>zEncodeEnv.<locals>.<dictcomp>µ   sI   ø€ ð 
ð 
ð 
á
ˆ!ˆQõ ˆQ˜Ð"Ñ"Ô"¥F¨1°xÐ$@Ñ$@Ô$@ð
ð 
ð 
r   )Ú_GetEncodingÚitems)r   r	   s    `r
   Ú	EncodeEnvr-   ª   sF   ø€ ð Ð'�™œ€(ð
ð 
ð 
ð 
à—)’)‘+”+ð
ñ 
ô 
ð r   c                  óN   — t          j        ¦   «         pt          j        ¦   «         S )z!Gets the default encoding to use.)r   r   r   r   r   r
   r+   r+   »   s   € å	Ô	"Ñ	$Ô	$Ð	@­Ô(>Ñ(@Ô(@Ð@r   )N)Ú__doc__Ú
__future__r   r   r   r   r   r   r    r$   r-   r+   r   r   r
   ú<module>r1      sÔ   ðð" JÐ Ià &Ð &Ð &Ð &Ð &Ð &Ø Ð Ð Ð Ð Ð Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'à 
€
€
€
ðð ð ð ðQ%ð Q%ð Q%ð Q%ðhð ð ð ð(/ð /ð /ð /ð4ð ð ð ð"Að Að Að Að Ar   