U
    ?h[
                     @   s~   d Z ddlZddlmZmZ e Zdd Zeddd	d
Zdd Z	eddddZ
dd Zdd Zdd Zdd Zdd ZdS )z5Simplified function-based API for importlib.resources    N   )filesas_filec                 G   s   t | |dS )z8Open for binary reading the *resource* within *package*.rb)_get_resourceopenanchor
path_names r   Q/var/www/html/venv/lib/python3.8/site-packages/importlib_resources/_functional.pyopen_binary   s    r   strictencodingerrorsc                G   s$   t ||}t| |}|jd||dS )z6Open for text reading the *resource* within *package*.rr   )_get_encoding_argr   r   r	   r   r   r
   resourcer   r   r   	open_text   s    

r   c                 G   s   t | | S )zARead and return contents of *resource* within *package* as bytes.)r   
read_bytesr   r   r   r   read_binary   s    r   c                G   s"   t ||}t| |}|j||dS )z?Read and return contents of *resource* within *package* as str.r   )r   r   	read_textr   r   r   r   r      s    

r   c                 G   s   t t| |S )z@Return the path to the *resource* as an actual file system path.)r   r   r   r   r   r   path#   s    r   c                 G   s   t | | S )zjReturn ``True`` if there is a resource named *name* in the package,

    Otherwise returns ``False``.
    )r   is_filer   r   r   r   is_resource(   s    r   c                 G   s(   t jdtdd dd t| | D S )zReturn an iterable over the named resources within the package.

    The iterable returns :class:`str` resources (e.g. files).
    The iterable does not recurse into subdirectories.
    zPimportlib.resources.contents is deprecated. Use files(anchor).iterdir() instead.r   )
stacklevelc                 s   s   | ]}|j V  qd S )N)name).0r   r   r   r   	<genexpr><   s     zcontents.<locals>.<genexpr>)warningswarnDeprecationWarningr   iterdirr   r   r   r   contents0   s    r%   c                 C   s&   |t kr"t| dkrtdndS |S )Nr   z5'encoding' argument required with multiple path nameszutf-8)_MISSINGlen	TypeError)r
   r   r   r   r   r   ?   s    r   c                 C   s   | d krt dt| j| S )Nz)anchor must be module or string, got None)r(   r   joinpathr   r   r   r   r   N   s    r   )__doc__r!   Z_commonr   r   objectr&   r   r   r   r   r   r   r%   r   r   r   r   r   r   <module>   s   