
    s
e	                     |    d Z ddlZddlZddlmZmZmZmZ  ej                    Z	d Z
 e
            Zd Zd Zd ZdS )u   
Text encoding utilities, text file I/O.

Functions 'get_coding', 'decode' and 'encode' come from Eric4 source code (Utilities/__init___.py)

Copyright © 2003-2009 Detlev Offenbach
    N)is_binary_string	is_string
is_unicodeto_text_stringc                  >    t          j                    } | t          } | S )zU
    Query the filesystem for the encoding used to encode filenames and envvars.
    )sysgetfilesystemencodingPREFERRED_ENCODING)encodings    @lib/python3.11/site-packages/navigator_updater/utils/encoding.pyr	   r	   !   s"     (**H%O    c                     t          |           s#t          |                                 d          } nCt          |           r4	 |                     t
                    }|S # t          t          f$ r Y nw xY w| S )zT
    Return a unicode version of string decoded using the file system encoding.
    utf-8)r   r   toUtf8r   decodeFS_ENCODINGUnicodeError	TypeError)stringunics     r   to_unicode_from_fsr   /   s     V 	99F## 	}}[11  !),    Ms   A A32A3c                     t          |           r4	 |                     t                    }|S # t          t          f$ r Y nw xY w| S )zU
    Return a byte string version of unc encoded using the file system encoding.
    )r   encoder   r   r   )r   r   s     r   to_fs_from_unicoder   @   s_     $ 	[[--F M i( 	 	 	D	 Ks   - A Ac                 R    	 |                      d          S # t          $ r | cY S w xY w)z2Ensure a file is binary format. From conda/common.r   )r   AttributeError)values    r   ensure_binaryr   N   s?    ||G$$$    s    &&)__doc__localer   !navigator_updater.utils.py3compatr   r   r   r   getpreferredencodingr
   r	   r   r   r   r    r   r   <module>r$      s      



 e e e e e e e e e e e e 1V022    $#%%  "      r   