U
    X7hm                     @   s   d dl Z d dlZd dlmZ ddlmZ ddlmZ dd Zdd	 Z	d
d Z
ejfeedddZejfeeddddZG dd deZdS )    N)ConfigParser   )py39)SetuptoolsDeprecationWarningc                 C   sT   t | trtd| S z$| d} td| } | d} W n tk
rN   Y nX | S )NZNFDutf-8)
isinstancestrunicodedata	normalizedecodeencodeUnicodeError)path r   R/var/www/formularioweb/env/lib/python3.8/site-packages/setuptools/unicode_utils.py	decompose
   s    

r   c              	   C   sZ   t | tr| S t pd}|df}|D ].}z| |W   S  tk
rR   Y q&Y q&X q&dS )z]
    Ensure that the given path is decoded,
    ``None`` when no expected encoding works
    r   N)r   r   sysgetfilesystemencodingr   UnicodeDecodeError)r   Zfs_enc
candidatesencr   r   r   filesys_decode   s    
r   c                 C   s(   z|  |W S  tk
r"   Y dS X dS )z/turn unicode encoding into a functional routineN)r   UnicodeEncodeError)stringr   r   r   r   
try_encode+   s    r   )filereturnc                 C   s   z0t | ddd}| W  5 Q R  W S Q R X W nP tk
r   tj| |d t | d|d}| W  5 Q R   Y S Q R X Y nX dS )a
  
    First try to read the file with UTF-8, if there is an error fallback to a
    different encoding ("locale" by default). Returns the content of the file.
    Also useful when reading files that might have been produced by an older version of
    setuptools.
    rr   encodingr   fallback_encodingN)openreadr   _Utf8EncodingNeededemit)r   r!   fr   r   r   _read_utf8_with_fallback3   s     r'   )cfgr   r   c                 C   sP   z| j |dd W n8 tk
rJ   tj||d |   | j ||d Y nX dS )zSame idea as :func:`_read_utf8_with_fallback`, but for the
    :meth:`ConfigParser.read` method.

    This method may call ``cfg.clear()``.
    r   r   r    N)r#   r   r$   r%   clear)r(   r   r!   r   r   r   _cfg_read_utf8_with_fallbackC   s    r*   c                   @   s   e Zd ZdZdZdS )r$   zZ
    `encoding="utf-8"` fails with {file!r}, trying `encoding={fallback_encoding!r}`.
    a  
    Fallback behaviour for UTF-8 is considered **deprecated** and future versions of
    `setuptools` may not implement it.

    Please encode {file!r} with "utf-8" to ensure future builds will succeed.

    If this file was produced by `setuptools` itself, cleaning up the cached files
    and re-building/re-installing the package with a newer version of `setuptools`
    (e.g. by updating `build-system.requires` in its `pyproject.toml`)
    might solve the problem.
    N)__name__
__module____qualname___SUMMARY_DETAILSr   r   r   r   r$   S   s   r$   )r   r	   configparserr   compatr   warningsr   r   r   r   ZLOCALE_ENCODINGr   r'   r*   r$   r   r   r   r   <module>   s    