o
    ^+)h.                     @   sh   d dl Z d dlmZmZmZ ddlmZmZ G dd de jdZ	eG dd	 d	eZ
G d
d de	ZdS )    N)BinaryIOIterableText   )runtime_checkableProtocolc                   @   sp   e Zd ZdZejdedefddZejdedefddZ	ejdede
fd	d
Zejdee fddZdS )ResourceReaderzDAbstract base class for loaders to provide resource reading support.resourcereturnc                 C      t )zReturn an opened, file-like object for binary reading.

        The 'resource' argument is expected to represent only a file name.
        If the resource cannot be found, FileNotFoundError is raised.
        FileNotFoundErrorselfr	    r   iC:\Users\User\Downloads\Proyecto_IoT\venv\Lib\site-packages\setuptools/_vendor/importlib_resources/abc.pyopen_resource
   s   
zResourceReader.open_resourcec                 C   r   )zReturn the file system path to the specified resource.

        The 'resource' argument is expected to represent only a file name.
        If the resource does not exist on the file system, raise
        FileNotFoundError.
        r   r   r   r   r   resource_path   s   zResourceReader.resource_pathpathc                 C   r   )zjReturn True if the named 'path' is a resource.

        Files are resources, directories are not.
        r   r   r   r   r   r   is_resource#   s   zResourceReader.is_resourcec                 C   r   )z+Return an iterable of entries in `package`.r   r   r   r   r   contents+   s   zResourceReader.contentsN)__name__
__module____qualname____doc__abcabstractmethodr   r   r   r   boolr   r   strr   r   r   r   r   r      s    r   )	metaclassc                   @   s   e Zd ZdZejdd Zdd ZdddZejd	e	fd
dZ
ejd	e	fddZejdd Zdd ZejdddZejd	efddZdS )Traversablezt
    An object with a subset of pathlib.Path methods suitable for
    traversing directories and opening files.
    c                 C      dS )z3
        Yield Traversable objects in self
        Nr   r   r   r   r   iterdir8       zTraversable.iterdirc                 C   s6   |  d}| W  d   S 1 sw   Y  dS )z0
        Read contents of self as bytes
        rbNopenread)r   strmr   r   r   
read_bytes>   s   $zTraversable.read_bytesNc                 C   s8   | j |d}| W  d   S 1 sw   Y  dS )z/
        Read contents of self as text
        )encodingNr'   )r   r,   r*   r   r   r   	read_textE   s   $zTraversable.read_textr
   c                 C   r#   )z4
        Return True if self is a directory
        Nr   r   r   r   r   is_dirL   r%   zTraversable.is_dirc                 C   r#   )z/
        Return True if self is a file
        Nr   r   r   r   r   is_fileR   r%   zTraversable.is_filec                 C   r#   )2
        Return Traversable child in self
        Nr   r   childr   r   r   joinpathX   r%   zTraversable.joinpathc                 C   s
   |  |S )r0   )r3   r1   r   r   r   __truediv__^   s   
zTraversable.__truediv__rc                 O   r#   )z
        mode may be 'r' or 'rb' to open as text or binary. Return a handle
        suitable for reading (same as pathlib.Path.open).

        When opening as text, accepts encoding parameters such as those
        accepted by io.TextIOWrapper.
        Nr   )r   modeargskwargsr   r   r   r(   d   r%   zTraversable.openc                 C   r#   )zM
        The base name of this object without any parent references.
        Nr   r   r   r   r   namen   r%   zTraversable.nameN)r5   )r   r   r   r   r   r   r$   r+   r-   r   r.   r/   r3   r4   r(   abstractpropertyr    r9   r   r   r   r   r"   1   s"    


	r"   c                   @   s>   e Zd ZdZejdd Zdd Zdd Zdd	 Z	d
d Z
dS )TraversableResourceszI
    The required interface for providing traversable
    resources.
    c                 C   r#   )z3Return a Traversable object for the loaded package.Nr   r   r   r   r   files{   r%   zTraversableResources.filesc                 C   s   |   |dS )Nr&   )r=   r3   r(   r   r   r   r   r      s   z"TraversableResources.open_resourcec                 C   s   t |r:   r   r   r   r   r   r      s   z"TraversableResources.resource_pathc                 C   s   |   | S r:   )r=   r3   r/   r   r   r   r   r      s   z TraversableResources.is_resourcec                 C   s   dd |    D S )Nc                 s   s    | ]}|j V  qd S r:   )r9   ).0itemr   r   r   	<genexpr>   s    z0TraversableResources.contents.<locals>.<genexpr>)r=   r$   r   r   r   r   r      s   zTraversableResources.contentsN)r   r   r   r   r   r   r=   r   r   r   r   r   r   r   r   r<   u   s    
r<   )r   typingr   r   r   Z_compatr   r   ABCMetar   r"   r<   r   r   r   r   <module>   s    *C