
    zi                        d Z ddlmZ ddlZddlZddlmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ dd	lmZmZ erdd
lmZ  ej        e          Zg dZ G d d          ZdS )z1Utility function and classes for Sphinx projects.    )annotationsN)glob)TYPE_CHECKING)__)logging)get_matching_files)path_stabilizerelpath)Iterable)z**/_sourcesz.#*z**/.#*z
*.lproj/**c                  @    e Zd ZdZddZdd
Z	 	 dddZddZddZdS ) Projectz;A project is the source code set of the Sphinx document(s).srcdirstr | os.PathLike[str]source_suffixIterable[str]returnNonec                    || _         t          |          | _        t          t	          | j                  d          | _        t                      | _        i | _        i | _	        d S )N )
r   tupler   nextiter_first_source_suffixsetdocnames_path_to_docname_docname_to_path)selfr   r   s      Y/var/www/tmov.alphamb/tmov_inventario/venv/lib/python3.11/site-packages/sphinx/project.py__init__zProject.__init__   s]     #=11$(d.@)A)A2$F$F! #&%% 1302    otherc                N    |j         | _         |j        | _        |j        | _        dS )z!Take over a result of last build.N)r   r   r   )r   r"   s     r   restorezProject.restore(   s'     % 6 % 6r!    z**exclude_pathsinclude_pathsset[str]c           
     v     j                                           j                                          j                                         t	           j        |g |t          z             D ]E}                     |          x}r*| j         v rt          j	        
                     j        |          dz   } fdt          |          D             }t                              t          d          ||                     |d          d           t          j        t          j	        
                     j        |          t          j                  r0 j                             |           | j        |<   | j        |<   t                              t          d          ||           G j         S )	zbFind all document files in the source directory and put them in
        :attr:`docnames`.
        z.*c                :    g | ]}t          |j                  S r%   )r
   r   ).0fr   s     r   
<listcomp>z$Project.discover.<locals>.<listcomp>@   s%    LLLWQ44LLLr!   zDmultiple files found for the document "%s": %r
Use %r for the build.T)absolute)oncezIgnored unreadable document %r.)location)r   clearr   r   r   r   EXCLUDE_PATHSpath2docospathjoinr   loggerwarningr   doc2pathaccessR_OKadd)r   r'   r(   filenamedocnamepatternfiless   `      r   discoverzProject.discover.   s    	##%%%##%%%*Km},
 
 	? 	?H
 --111w ?dm++ gll4;@@4GGLLLLd7mmLLLENN2 '> $? $?#*E4==SW=3X3X(, # . . . . Yrw||DKBBBGLL ?M%%g...6=D)(35=D)'22NN2&G#H#H#+g # ? ? ? }r!   r>   
str | Nonec                   	 | j         |         S # t          $ r t          j                            |          rVt          j        t                    5  t          j                            || j	                  }ddd           n# 1 swxY w Y   | j
        D ]Z}t          j                            |                              |          r&t          |                              |          c cY S [Y dS w xY w)zReturn the docname for the filename if the file is a document.

        *filename* should be absolute or relative to the source directory.
        N)r   KeyErrorr5   r6   isabs
contextlibsuppress
ValueErrorr
   r   r   basenameendswithr	   removesuffix)r   r>   suffixs      r   r4   zProject.path2docO   sI   
	(22 
	 
	 
	w}}X&& F(44 F F!wxEEHF F F F F F F F F F F F F F F , I I7##H--66v>> I)(33@@HHHHHHHI 44
	s;    AC4&B7C4B	C4
B	A"C4/C43C4r?   strr/   boolc                    	 | j         |         }n# t          $ r || j        z   }Y nw xY w|r%t          j                            | j        |          S |S )zReturn the filename for the document name.

        If *absolute* is True, return as an absolute path.
        Else, return as a relative path to the source directory.
        )r   rE   r   r5   r6   r7   r   )r   r?   r/   r>   s       r   r:   zProject.doc2pathb   si    	;,W5HH 	; 	; 	;!::HHH	;  	77<<X666s    ''N)r   r   r   r   r   r   )r"   r   r   r   )r%   r&   )r'   r   r(   r   r   r)   )r>   r   r   rC   )r?   rN   r/   rO   r   rN   )	__name__
__module____qualname____doc__r    r$   rB   r4   r:   r%   r!   r   r   r      s        EE3 3 3 37 7 7 7 7907    B   &     r!   r   )rT   
__future__r   rG   r5   r   typingr   sphinx.localer   sphinx.utilr   sphinx.util.matchingr   sphinx.util.osutilr	   r
   collections.abcr   	getLoggerrQ   r8   r3   r   r%   r!   r   <module>r]      s   7 7 " " " " " "     				                               3 3 3 3 3 3 6 6 6 6 6 6 6 6 )((((((		8	$	$>>>Z Z Z Z Z Z Z Z Z Zr!   