U
    ^»{j[
  ã                   @   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   ú^/var/www/html/bwave/python/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 )zºReturn 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   