
    -Ph8                       d Z ddlmZ ddlZddlZddlZddlZddlZddlm	Z	 ddl
mZ ddlZddlZddlmZ ddlmZ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 ddlmZ erddlm Z m!Z! ddl
m"Z"m#Z# ddl$m%Z% ej&        fdHdZ'dIdZ(dJd!Z)dKd$Z*dLd'Z+dMd-Z,dNd1Z-dOd5Z.dPd7Z/dQd<Z0dRdAZ1dKdBZ2dSdCZ3dTdKdEZ4e5dFk    r! e6 e4ej7        dGd                             dS )Uz+Build documentation from a provided source.    )annotationsN)Path)TYPE_CHECKING)__display_version__)disable_colourterminal_supports_colour)Sphinx)__)TeeStripANSI_StrPath)docutils_namespacepatch_docutils)	ensuredir)
CollectionSequence)AnyTextIO)	ExtensionappSphinx | Noneargsr   	exceptionBaseExceptionstderrr   returnNonec                    | !| j         }| j                                        }ndx}}t          j        j        j                            |||j        |j	        p|j
        ||          S )N r   use_pdbprint_tracebackmessage_log
extensions)
messagelogr$   valuessphinx_cliutilerrorshandle_exceptionpdb	verbosity	traceback)r   r   r   r   r#   r$   s         P/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/sphinx/cmd/build.pyr+   r+      sq     %(^,/N,A,A,C,C

#%%j;"338$. 4       valuestrintc                    | dk    rt          j                    S t          |           }|dk    r!t          j        t          d                    |S )zParse the ``--jobs`` flag.

    Return the number of CPUs if 'auto' is used,
    otherwise ensure *value* is a positive integer.
    autor   z&job number should be a positive number)multiprocessing	cpu_countr3   argparseArgumentTypeErrorr
   )r1   jobss     r/   jobs_argumentr;   4   sX     (***5zz199,;<<   Kr0   argparse.ArgumentParserc                 	   t          j        dt          d          t          d                    } |                     ddddt           	           |                     d
dt          d                     |                     ddt          d                     |                     ddt          d                     |                     t          d                    }|                    dddddt          d                     |                    dddd t          d!t          d"          #           |                    d$d%d&d't          d(          )           |                    d*d+d&d,t          d-          )           |                     t          d.                    }|                    d/d0d1d2t          d3          4           |                    d5d6d1d7t          d8          4           |                     d9          }|                    d:d;d&d<t          d=          )           |                    d>d?d@dAdBg t          dC          D           |                    dEdFdGdAdHg t          dI          D           |                    dJdKdLdAdMg t          dN          D           |                    dOdPd&dQt          dR          )           |                     t          dS                    }|                    dTdUdVdWdXt          dY          Z           |                    d[d\d&d]t          d^          )           |                    d_d`d&dat          db          )           |                    dcdddedfdgt          dh          i           |                    djdkdddedlt          dm          n           |                     t          do                    }|                    dpdqdrdst          dt          4           |                    dudvd&dwt          dx          )           |                    dyd&t           j        z           |                    d{d|d&d}t          d~          )           |                    ddd&dt          d          )           |                    dd&dt          d          )           | j        dk    rd| _        | S )Nz5%(prog)s [OPTIONS] SOURCEDIR OUTPUTDIR [FILENAMES...]z:For more information, visit <https://www.sphinx-doc.org/>.a  
Generate documentation from source files.

sphinx-build generates documentation from the files in SOURCEDIR and places it
in OUTPUTDIR. It looks for 'conf.py' in SOURCEDIR for the configuration
settings. The 'sphinx-quickstart' tool may be used to generate template files,
including 'conf.py'

sphinx-build can create documentation in different formats. A format is
selected by specifying the builder name on the command line; it defaults to
HTML. Builders can also perform other tasks related to documentation
processing.

By default, everything that is outdated is built. Output only for selected
files can be built by specifying individual filenames.
)usageepilogdescriptionz	--versionversionshow_versionz	%(prog)s )actiondestrA   	sourcedir
SOURCE_DIRz"path to documentation source files)metavarhelp	outputdir
OUTPUT_DIRzpath to output directory	filenames*zS(optional) a list of specific files to rebuild. Ignored if --write-all is specified)nargsrH   zgeneral optionsz	--builderz-bBUILDERbuilderhtmlz builder to use (default: 'html'))rG   rD   defaultrH   z--jobsz-jN   r:   zTrun in parallel with N processes, when possible. 'auto' uses the number of CPU cores)rG   rQ   typerD   rH   z--write-allz-a
store_true	force_allz;write all files (default: only write new and changed files))rC   rD   rH   z--fresh-envz-Efreshenvz4don't use a saved environment, always read all fileszpath optionsz--doctree-dirz-dPATH
doctreedirzKdirectory for doctree and environment files (default: OUTPUT_DIR/.doctrees))rG   rD   rH   z
--conf-dirz-cconfdirzDdirectory for the configuration file (conf.py) (default: SOURCE_DIR)zbuild configuration optionsz
--isolatedz-Cnoconfigz<use no configuration file, only use settings from -D optionsz--definez-Dzsetting=valueappenddefinez(override a setting in configuration file)rG   rC   rD   rQ   rH   z--html-definez-Az
name=value
htmldefinez pass a value into HTML templatesz--tagz-tTAGtagsz*define tag: include "only" blocks with TAGz
--nitpickyz-nnitpickyz0nitpicky mode: warn about all missing referenceszconsole output optionsz	--verbosez-vcountr-   r   z$increase verbosity (can be repeated))rC   rD   rQ   rH   z--quietz-qquietz,no output on stdout, just warnings on stderrz--silentz-Qreally_quietz#no output at all, not even warningsz--colorstore_constcoloryesr5   z-do emit colored output (default: auto-detect))rC   rD   constrQ   rH   z
--no-colorz-Nnoz1do not emit colored output (default: auto-detect))rC   rD   rh   rH   zwarning control optionsz--warning-filez-wFILEwarnfilez)write warnings (and errors) to given filez--fail-on-warningz-Wwarningiserrorzturn warnings into errorsz--keep-going)rC   rH   z--show-tracebackz-Tr.   z show full traceback on exceptionz--pdbz-Pr,   zrun Pdb on exceptionz--exception-on-warningexception_on_warningzraise an exception on warningsz__main__.pyzsphinx-build)	r8   ArgumentParserr
   add_argumentr   add_argument_groupr;   SUPPRESSprog)parsergroups     r/   
get_parserru   F   sk   $ENOO     F* 1/11	     \3W0X0X     \3M0N0N     2
 
     %%b):&;&;<<E	233     
2
 
     
MNN     
FGG     %%b&8&899E	.
 
  	 	 	 
VWW     %%&CDDE	NOO     
:;;     
233     
<==     
BCC     %%b)A&B&BCCE	677     
>??     
566     
?@@     
CDD     %%b)B&C&CDDE	;<<     
+,,     
~lARSSS	233     
lR@V=W=W     
 #011	     {m##$Mr0   argvSequence[str]c                H    ddl m} |                    | dd                   S )zSphinx build "make mode" entry.r   	make_moderS   N)
sphinx.cmdrz   run_make_moderv   rz   s     r/   	make_mainr~   #  s0    $$$$$$""48,,,r0   rs   argparse.Namespacec                0    |                      |          }|S N)
parse_args)rs   rv   r   s      r/   _parse_argumentsr   *  s     T""DKr0   r[   boolrZ   rE   
str | Nonec                    | rd S |s|S |S r   r   )r[   rZ   rE   s      r/   _parse_confdirr   1  s"     t Nr0   rY   rI   r   c                D    | rt          |           S t          |d          S )Nz	.doctreesr   )rY   rI   s     r/   _parse_doctreedirr   9  s(     $
###I{+++r0   rV   rK   	list[str]c                Z    |r&|r&|                      t          d                     d S d S d S )Nz&cannot combine -a option and filenames)errorr
   )rs   rV   rK   s      r/   _validate_filenamesr   ?  sN    
  CY CR@AABBBBBC C C Cr0   colourc                ^    | dk    s| dk    rt                      st                       d S d S d S )Nri   r5   )r   r   )r   s    r/   _validate_colour_supportr   H  sA    ~~&F**3K3M3M* +***r0   rc   rd   rk   :tuple[TextIO | None, TextIO | None, TextIO, TextIO | None]c                   t           j        }t           j        }t           j        }|rd }|rd x}}d }|r|r	 t          |                                          }t          |j                   t          |dd          }n># t          $ r1}	| 	                    t          d          ||	fz             Y d }	~	nd }	~	ww xY wt          ||          }|}||||fS )Nwzutf-8)encodingz!cannot open warning file '%s': %s)sysstdoutr   r   resolver   parentopen	Exceptionr   r
   r   )
rs   rc   rd   rk   statuswarningr   warnfp	warn_fileexcs
             r/   _parse_loggingr   M  s
     JF ZGJE   F 	8 		UX..00Ii&''')S7;;;FF 	U 	U 	ULL?@@IsCSSTTTTTTTT	Uw//7E6))s   AA> >
B9'B44B9r]   r^   ra   dict[str, Any]c                   i }|D ]T}	 |                     dd          \  }}n2# t          $ r% |                     t          d                     Y nw xY w|||<   U|D ]}	 |                     d          \  }}n2# t          $ r% |                     t          d                     Y nw xY wt	          j        t                    5  t          |          }d d d            n# 1 swxY w Y   ||d| <   |rd|d<   |S )N=rS   z1-D option argument must be in the form name=valuez1-A option argument must be in the form name=valuezhtml_context.Tra   )split
ValueErrorr   r
   
contextlibsuppressr3   )rs   r]   r^   ra   confoverridesvalkeys          r/   _parse_confoverridesr   l  s    %'M ! !	Ryya((HC 	R 	R 	RLLOPPQQQQQ	R c 3 3	Ryy~~HC 	R 	R 	RLLOPPQQQQQ	R ,, 	 	c((C	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 03+c++,, )$(j!s3   ",AAA88,B'&B'CC#	&C#	c           	        t                      }t          ||           }t          |j        |j        |j                  |_        t          |j        |j                  |_        t          ||j
        |j                   t          |j                   t          ||j        |j        |j                  \  |_        |_        |_        }t+          ||j        |j        |j                  |_        d}	 |j        p|j        }t5          |          5  t7                      5  t9          di d|j        d|j        d|j        d|j        d|j        d|j        d|j        d	|j        d
|j        d|j        d|j         d|j!        d|j"        ddd|j#        d|j$        }|%                    |j
        |j                   |j&        cddd           cddd           ||'                                 S S # 1 swxY w Y   ddd           n# 1 swxY w Y   n# tP          tR          f$ r}|!|j*        }|j+        ,                                }ndx}}tZ          j.        j/        j0        1                    ||j        |j#        |j!        p|j2        ||           Y d}~||'                                 dS dS d}~ww xY w||'                                 dS dS # ||'                                 w w xY w)z'Sphinx build "main" command-line entry.NsrcdirrZ   outdirrY   buildernamer   r   r   rW   rl   r`   r-   parallel
keep_goingFr,   rm   r   r       )3ru   r   r   r[   rZ   rE   r   rY   rI   r   rV   rK   r   rf   r   rc   rd   rk   r   r   r   r   r]   r^   ra   r   r   r   r	   rO   rW   rl   r`   r-   r:   r,   rm   build
statuscodecloser   KeyboardInterruptr%   r$   r&   r'   r(   r)   r*   r+   r.   )	rv   rs   r   r   r   rZ   r   r#   r$   s	            r/   
build_mainr     s   \\FFD))D!$-t~NNDL'HHDO???TZ(((4B
D-t}5 51DKtz6 .T_dm D C),0$.G$$ 	" 	"&8&:&: 	" 	"   ~~ ~~  ??	
 !LL #00 {{    $22 YY ..  !5 HH  &*%>%>!C$ IIdndn555>)	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"J LLNNNN K	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"* ()   ?),K030E0E0G0GJJ'))K*00:H N<dn#! 	1 	
 	
 	
 qqqLLNNNNN !  LLNNNNN 6LLNNNN s   0H HB,G8HH 8G<	<H?G<	 HH HH HH K J;,A,J6K 6J;;K K1c                    ddl m } m} dd l}dd l}dd l}t          d           t          d           t          dt          j          d |              d           t          dt          j         d           t          d	 |                        t          d
t          j	                    t          d|j
                    t          d|j
                    t          d|j
                    t          d           dS )Nr   )platformpython_implementationz<Please paste all output below into the bug report template

z```textzPlatform:              z; ()zPython version:        zPython implementation: zSphinx version:        zDocutils version:      zJinja2 version:        zPygments version:      z```)r   r   docutilsjinja2pygmentsprintr   rA   r'   r   __version__)r   r   r   r   r   s        r/   _bug_report_infor     s1   88888888OOOMMMOOO	
JKKK	)	
BCL
B
BXXZZ
B
B
BCCC	
2CK
2
2
2333	
=$9$9$;$;
=
=>>>	
@F$>
@
@AAA	
:H$8
:
:;;;	
8F$6
8
8999	
:H$8
:
:;;;	%LLL1r0   r   c                  t          j        t           j        d           t          j                                          | st
          j        dd          } | d d         dgk    r
| dd          } | d d         dgk    rt                      S | d d         dgk    r#ddlm	} |
                    | dd                    S t          |           S )N rS   r   z--bug-reportz-Mr   ry   )locale	setlocaleLC_ALLr'   init_consoler   rv   r   r{   rz   r|   r   r}   s     r/   mainr     s    
V]B'''
M    x| BQBxG9ABBxBQBxN###!!!BQBxD6((((((&&tABBx000$r0   __main__rS   )
r   r   r   r   r   r   r   r   r   r   )r1   r2   r   r3   )r   r<   )rv   rw   r   r3   )rs   r<   rv   rw   r   r   )r[   r   rZ   r2   rE   r2   r   r   )rY   r2   rI   r2   r   r   )rs   r<   rV   r   rK   r   r   r   )r   r2   r   r   )
rs   r<   rc   r   rd   r   rk   r   r   r   )
rs   r<   r]   r   r^   r   ra   r   r   r   )r   r3   )r   )8__doc__
__future__r   r8   r   r   r6   r   pathlibr   typingr   sphinx._cli.util.errorsr'   sphinx.localer   sphinx._cli.util.colourr   r   sphinx.applicationr	   r
   sphinx.util._ior   sphinx.util._pathlibr   sphinx.util.docutilsr   r   sphinx.util.osutilr   collections.abcr   r   r   r   sphinx.extensionr   r   r+   r;   ru   r~   r   r   r   r   r   r   r   r   r   r   __name__
SystemExitrv   r   r0   r/   <module>r      s   1 1 " " " " " "           



                           & & & & & & L L L L L L L L % % % % % %       ( ( ( ( ( ( ) ) ) ) ) ) C C C C C C C C ( ( ( ( ( ( +44444444""""""""****** Z	    *   $Z Z Z Zz- - - -      , , , ,C C C C   
* * * *>   >9 9 9 9x   (         * z
*TT#(122,''
(
(( r0   