a
   ;qD                   @   sf   d dl Z e jd  dkZer(d dlmZ nd dlmZ dd Ze ZerRd dlmZ dd Z	d	d
 Z
dS )    N   )StringIOc                  C   s*   zddl m}  W n ty$   Y dS 0 | S )Nr   TYPE_CHECKINGF)typingr   ImportErrorr    r   1/usr/lib/python3.9/site-packages/dotenv/compat.pyis_type_checking   s
    r
   )Textc                 C   s   t r| t pdS | S dS )z^
    Encode a string the same way whether it comes from the environment or a `.env` file.
    utf-8N)PY2encodesysgetfilesystemencoding)textr   r   r	   to_env   s    r   c                 C   s   t r| dS | S dS )z
    Make a string Unicode if it isn't already.

    This is useful for defining raw unicode strings because `ur"foo"` isn't valid in
    Python 3.
    r   N)r   decode)stringr   r   r	   to_text&   s    
r   )r   version_infor   r   ior
   ZIS_TYPE_CHECKINGr   r   r   r   r   r   r   r	   <module>   s   	