
    -Phr                       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mZ ddlmZmZmZmZ dd	lmZ erdd
lmZmZ ddlmZ ddlmZ  eh d          Ze eh d          z  Zd&dZd'dZd(dZ d)d%Z!dS )*z7Sphinx extension for auto-generating API documentation.    )annotationsN)Path)TYPE_CHECKING)bold)create_modules_toc_filerecurse_tree)LOGGERApidocDefaultsApidocOptions_remove_old_files)__)
CollectionSequence)Any)Sphinx>   no_headingsfollow_linksmodule_firstinclude_privateseparate_modulesimplicit_namespaces>   path	max_depthdestinationexclude_patternsautomodule_optionsappr   returnNonec                   t          j        | j                  }| j        j        }| j        }| j        }t          j        t          t          d                               t          |          D ]\  }}t          |||||           dS )zRun the apidoc extension.zRunning apidocoptionsdefaultssrcdirconfdirN)r
   from_configconfigapidoc_modulesr$   r%   r	   infor   r   	enumerate_run_apidoc_module)r   r#   r(   r$   r%   imodule_optionss          \/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/sphinx/ext/apidoc/_extension.py
run_apidocr/   +   s    )#*55H/2z/HN:FKG
KR())**+++ '~66 
 
>"	
 	
 	
 	
 	

 
    r,   intr"   dict[str, Any]r#   r
   r$   r   r%   c               J   t          | ||||          }|dS d |j        D             }t          |j        |||j                  \  }}|j        r/|                    t          |||j        |j                             |j        rt          ||j
        |j                   dS dS )zRun apidoc for a single module.r!   Nc                Z    g | ](}t          j        t          j        |                    )S  )recompilefnmatch	translate).0excludes     r.   
<listcomp>z&_run_apidoc_module.<locals>.<listcomp>N   s:     8 8 83:
7$W--..8 8 8r0   )_parse_module_optionsexclude_patternr   module_pathtemplate_dirtoc_fileappendr   
remove_oldr   dest_dirsuffix)	r,   r"   r#   r$   r%   argsexclude_patterns_compiledwritten_filesmoduless	            r.   r+   r+   ?   s     !	7Xfg  D |8 8>B>R8 8 8 *3T4;L M7 } 
#GT4=$BSTT	
 	
 	
  E-DDDDDE Er0   ApidocOptions | Nonec                  t          |t                    s&t          j        t	          d          | d           d S 	 t          |d                   }ne# t          $ r( t          j        t	          d          | d           Y d S t          $ r( t          j        t	          d          | d           Y d S w xY w|z  }|                                s't          j        t	          d          | |d           d S 	 t          |d                   }ne# t          $ r( t          j        t	          d	          | d           Y d S t          $ r( t          j        t	          d
          | d           Y d S w xY w|	                                r&t          j        t	          d          | d           d S ||z  }	 |
                    dd           nB# t          $ r5}	t          j        t	          d          | |	j        d           Y d }	~	d S d }	~	ww xY wfdt          | |d|j                  D             }
|j        }d|v rIt          |d         t                     s&t          j        t	          d          | dd           n|d         }i }t#          t$                    D ]y}||vrt'          ||          ||<   t          ||         t(                    s9t          j        t	          d          | |d           t'          ||          ||<   n||         ||<   zt+          t          | |d|j                            }|                                t0          z
  x}rEt          j        t	          d          | d                    t#          |                    d           t5          |||
|d|d         |d         |d         |d         |d         |d         ||j                  S )Nz%apidoc_modules item %i must be a dictapidoctyper   z-apidoc_modules item %i must have a 'path' keyz.apidoc_modules item %i 'path' must be a stringz;apidoc_modules item %i 'path' is not an existing folder: %sr   z4apidoc_modules item %i must have a 'destination' keyz5apidoc_modules item %i 'destination' must be a stringz>apidoc_modules item %i 'destination' should be a relative pathT)parentsexist_okz>apidoc_modules item %i cannot create destination directory: %sc                4    g | ]}t          |z            S r5   )str)r:   patternr%   s     r.   r<   z)_parse_module_options.<locals>.<listcomp>   s6     # # # 	Gg# # #r0   r   )keydefaultr   z*apidoc_modules item %i '%s' must be an intz-apidoc_modules item %i '%s' must be a booleanr   z.apidoc_modules item %i has unexpected keys: %sz, r   r   r   r   r   r   )rD   r?   r>   r   quietr   r   r   r   r   r   r   header)
isinstancedictr	   warningr   r   KeyError	TypeErroris_diris_absolutemkdirOSErrorstrerror_check_collection_of_stringsr   r   r1   sorted
_BOOL_KEYSgetattrbool	frozensetr   keys_ALLOWED_KEYSjoinr   name)r,   r"   r#   r$   r%   r   r?   r   	dest_pathexcr   r   bool_optionsrT   r   diffs       `           r.   r=   r=   ]   s    gt$$ rABBAHUUUUtGFO$$   >??	
 	
 	
 	
 tt   ?@@!(	
 	
 	
 	
 tt	
 D.K LMM		
 	
 	
 	
 t7=122   EFF	
 	
 	
 	

 tt   FGG	
 	
 	
 	

 tt    OPP	
 	
 	
 	

 t$I	t4444   OPPL		
 	
 	
 	
 ttttt# # # #3w.8Q
 
 
# # # "Ig'+.44 	-N?@@	      ,I$&Lj!! - -g '# 6 6LGCL$// 		-NBCC	    !(# 6 6L 'L #$w0(:U	
 	
 	
  ||~~--t 
?@@IIfTll##		
 	
 	
 	
 (!.1%&89$%67 /!.1()>?-   sG   A .B6-B65B6:D .E2-E21E25G 
H*HHindexrT   rR   rU   Collection[str]c               d   ||vr|S t          ||         t          t          z  t          z  t          z            s't          j        t          d          | |d           |S ||         D ]@}t          |t                    s)t          j        t          d          | |d           |c S A||         S )zCheck that a key's value is a collection of strings in the options.

    :returns: The value of the key, or None if invalid.
    z.apidoc_modules item %i '%s' must be a sequencerL   rM   z0apidoc_modules item %i '%s' must contain strings)	rX   listtuplesetrg   r	   rZ   r   rR   )rp   r"   rT   rU   items        r.   rb   rb      s     'gclD5L3$6$BCC ?@@		
 	
 	
 	
   $$$ 	NEFF	    NNN	 3<r0   )r   r   r   r   )r,   r1   r"   r2   r#   r
   r$   r   r%   r   r   r   )r,   r1   r"   r2   r#   r
   r$   r   r%   r   r   rJ   )
rp   r1   r"   r2   rT   rR   rU   rq   r   rq   )"__doc__
__future__r   r8   r6   pathlibr   typingr   sphinx._cli.util.colourr   sphinx.ext.apidoc._generater   r   sphinx.ext.apidoc._sharedr	   r
   r   r   sphinx.localer   collections.abcr   r   r   sphinx.applicationr   rg   rd   ri   r/   r+   r=   rb   r5   r0   r.   <module>r      s   = = " " " " " "  				                   ( ( ( ( ( ( M M M M M M M M                  *44444444))))))Y     
 YY ( ( (   
 
 
 
(E E E E<I I I IX     r0   