
    
_d                         d dl Z d dlZd dlZd dlZd dlmZmZmZmZm	Z	m
Z
mZ ddlmZmZmZ g dZ G d de j"                        Z G d	 d
e      Ze G d de             Z G d de      Zy)    N)AnyBinaryIOIterableIteratorNoReturnTextOptional   )runtime_checkableProtocolStrPath)ResourceReaderTraversableTraversableResourcesc                       e Zd ZdZej
                  dedefd       Zej
                  dedefd       Z	ej
                  dede
fd       Zej
                  dee   fd       Zy	)
r   zDAbstract base class for loaders to provide resource reading support.resourcereturnc                     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   s     L/usr/lib/python3/dist-packages/setuptools/_vendor/importlib_resources/abc.pyopen_resourcezResourceReader.open_resource   s
          c                     t         )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   s     r   resource_pathzResourceReader.resource_path   s
      r   pathc                     t         )zjReturn True if the named 'path' is a resource.

        Files are resources, directories are not.
        r   r   r   s     r   is_resourcezResourceReader.is_resource)   s
      r   c                     t         )z+Return an iterable of entries in `package`.r   r   s    r   contentszResourceReader.contents1   s
      r   N)__name__
__module____qualname____doc__abcabstractmethodr   r   r   r   boolr!   r   strr$    r   r   r   r      s    N	 d 	 x 	  	  	
 d 
 t 
  
  	        	 (3-    r   r   )	metaclassc                       e Zd Zy)TraversalErrorN)r%   r&   r'   r-   r   r   r0   r0   7   s    r   r0   c                   2   e Zd ZdZej
                  ded    fd       ZdefdZ	dde
e   defdZej
                  defd       Zej
                  defd	       Zd
edd fdZdedd fdZej
                  dd       Zeej
                  defd              Zy)r   z
    An object with a subset of pathlib.Path methods suitable for
    traversing directories and opening files.

    Any exceptions that occur when accessing the backing resource
    may propagate unaltered.
    r   c                      y)z3
        Yield Traversable objects in self
        Nr-   r#   s    r   iterdirzTraversable.iterdirE       r   c                 p    | j                  d      5 }|j                         cddd       S # 1 sw Y   yxY w)z0
        Read contents of self as bytes
        rbNopenread)r   strms     r   
read_byteszTraversable.read_bytesK   s/     YYt_ 	99;	 	 	s   ,5Nencodingc                 r    | j                  |      5 }|j                         cddd       S # 1 sw Y   yxY w)z/
        Read contents of self as text
        )r<   Nr7   )r   r<   r:   s      r   	read_textzTraversable.read_textR   s2     YYY) 	T99;	 	 	s   -6c                      y)z4
        Return True if self is a directory
        Nr-   r#   s    r   is_dirzTraversable.is_dirY   r4   r   c                      y)z/
        Return True if self is a file
        Nr-   r#   s    r   is_filezTraversable.is_file_   r4   r   descendantsc                 L   |s| S t         j                  j                  d t        t        j
                  |      D              }t        |      fd| j                         D        }	 t        |      } |j                  | S # t        $ r t        dt        |            w xY w)z
        Return Traversable resolved with any descendants applied.

        Each descendant should be a path segment relative to self
        and each may contain multiple levels separated by
        ``posixpath.sep`` (``/``).
        c              3   4   K   | ]  }|j                     y wN)parts).0r   s     r   	<genexpr>z'Traversable.joinpath.<locals>.<genexpr>o   s      .
DJJ.
   c              3   B   K   | ]  }|j                   k(  s|  y wrF   name)rH   traversabletargets     r   rI   z'Traversable.joinpath.<locals>.<genexpr>s   s$      
'[=M=MQW=WK
s   z"Target not found during traversal.)	itertoolschainfrom_iterablemappathlibPurePosixPathnextr3   StopIterationr0   listjoinpath)r   rC   namesmatchesmatchrO   s        @r   rY   zTraversable.joinpathe   s     K-- .
#&w'<'<k#J.
 
 e
+/<<>
	ME
 u~~u%%	  	 4fd5k 	s   )B  B#childc                 $    | j                  |      S )z2
        Return Traversable child in self
        )rY   )r   r]   s     r   __truediv__zTraversable.__truediv__~   s     }}U##r   c                      y)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kwargss       r   r8   zTraversable.open   r4   r   c                      y)zM
        The base name of this object without any parent references.
        Nr-   r#   s    r   rM   zTraversable.name   r4   r   rF   )r)r%   r&   r'   r(   r)   r*   r   r3   bytesr;   r	   r,   r>   r+   r@   rB   r   rY   r_   r8   propertyrM   r-   r   r   r   r   ;   s     	-0  
E (3- 3  	  
 	  
&W & &2$ $] $ 	  c   r   r   c                       e Zd ZdZej
                  dd       Zdedej                  fdZ
dedefdZdedefdZdee   fd	Zy
)r   zI
    The required interface for providing traversable
    resources.
    r   c                      y)z3Return a Traversable object for the loaded package.Nr-   r#   s    r   fileszTraversableResources.files   r4   r   r   c                 ^    | j                         j                  |      j                  d      S )Nr6   )rj   rY   r8   r   s     r   r   z"TraversableResources.open_resource   s$    zz|$$X.33D99r   c                     t        |      rF   r   r   s     r   r   z"TraversableResources.resource_path   s    ))r   r   c                 \    | j                         j                  |      j                         S rF   )rj   rY   rB   r    s     r   r!   z TraversableResources.is_resource   s"    zz|$$T*2244r   c                 L    d | j                         j                         D        S )Nc              3   4   K   | ]  }|j                     y wrF   rL   )rH   items     r   rI   z0TraversableResources.contents.<locals>.<genexpr>   s     =d		=rJ   )rj   r3   r#   s    r   r$   zTraversableResources.contents   s    =djjl&:&:&<==r   N)r   r   )r%   r&   r'   r(   r)   r*   rj   r   ioBufferedReaderr   r   r   r   r+   r!   r   r,   r$   r-   r   r   r   r      sr    
 	B B:g :"2C2C :*c *h *5 5D 5>(3- >r   r   )r)   rq   rP   rT   typingr   r   r   r   r   r   r	   _compatr   r   r   __all__ABCMetar   	Exceptionr0   r   r   r-   r   r   <module>rx      sp    
 	   N N N 9 9 D' s{{ ' T	Y 	 W( W Wt>> >r   