o
    3Ih
                     @   s   d Z ddlZddlmZmZ ddl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   )as_filefiles)TraversalErrorc                 G   s   t | |dS )z8Open for binary reading the *resource* within *package*.rb)_get_resourceopenanchor
path_names r   _/home/air/sanwanet/gpt-api/venv/lib/python3.10/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      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#   r   r   c                 G   s&   zt | | W S  ty   Y dS w )zjReturn ``True`` if there is a resource named *name* in the package,

    Otherwise returns ``False``.
    F)r   is_filer   r	   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   contents3   s   r'   c                 C   s$   |t u rt| dkrtddS |S )Nr   z5'encoding' argument required with multiple path nameszutf-8)_MISSINGlen	TypeError)r   r   r   r   r   r   B   s   r   c                 C   s   | d u rt dt| j| S )Nz)anchor must be module or string, got None)r*   r   joinpathr	   r   r   r   r   Q   s   r   )__doc__r#   _commonr   r   abcr   objectr(   r   r   r   r   r   r   r'   r   r   r   r   r   r   <module>   s    