
    -Phl                        d Z dZddlZddlZddlZddlmZ ddlZddlZddlm	Z	 ddl
Z
ddlZddlZddlmZmZ d Zd Z	 	 d%d	Z	 	 d%d
Z	 d&dZ	 	 d%dZ	 	 d%dZ	 	 d%dZ	 	 d%dZ	 	 d%dZ	 	 d%dZ	 	 d%dZ	 	 d%dZ	 	 d%dZ	 	 d%dZ	 	 d%dZd'dZd Z d Z! G d dej"                  Z" G d dej#                  Z# G d dej$        ej%                  Z$ G d  d!ej&                  Z' G d" d#e(          Z)d$ Z*dS )(a	  
Command-line and common processing for Docutils front-end tools.

This module is provisional.
Major changes will happen with the switch from the deprecated
"optparse" module to "arparse".

Applications should use the high-level API provided by `docutils.core`.
See https://docutils.sourceforge.io/docs/api/runtime-settings.html.

Exports the following classes:

* `OptionParser`: Standard Docutils command-line processing.
  Deprecated. Will be replaced by an ArgumentParser.
* `Option`: Customized version of `optparse.Option`; validation support.
  Deprecated. Will be removed.
* `Values`: Runtime settings; objects are simple structs
  (``object.attribute``).  Supports cumulative list settings (attributes).
  Deprecated. Will be removed.
* `ConfigParser`: Standard Docutils config file processing.
  Provisional. Details will change.

Also exports the following functions:

Interface function:
  `get_default_settings()`.  New in 0.19.

Option callbacks:
  `store_multiple()`, `read_config_file()`. Deprecated.

Setting validators:
  `validate_encoding()`, `validate_encoding_error_handler()`,
  `validate_encoding_and_error_handler()`,
  `validate_boolean()`, `validate_ternary()`,
  `validate_nonnegative_int()`, `validate_threshold()`,
  `validate_colon_separated_string_list()`,
  `validate_comma_separated_list()`,
  `validate_url_trailing_slash()`,
  `validate_dependency_file()`,
  `validate_strip_class()`
  `validate_smartquotes_locales()`.

  Provisional.

Misc:
  `make_paths_absolute()`, `filter_settings_spec()`. Provisional.
reStructuredText    N)SUPPRESS_HELP)Path)ioutilsc                     |D ]}t          |j        |d           |                                D ]\  }}t          |j        ||           dS )z
    Store multiple values in `parser.values`.  (Option callback.)

    Store `None` for each attribute named in `args`, and store the value for
    each key (attribute name) in `kwargs`.
    N)setattrvaluesitems)optionoptvalueparserargskwargs	attributekeys           Q/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/docutils/frontend.pystore_multipler   F   sf      0 0	y$////llnn + +
UsE****+ +    c                     	 |                     |          }n,# t          $ r}|                    |           Y d}~nd}~ww xY w|j                            ||           dS )zQ
    Read a configuration file during option processing.  (Option callback.)
    N)get_config_file_settings
ValueErrorerrorr
   update)r   r   r   r   new_settingserrs         r   read_config_filer   S   sz    66u==   S
Mv.....s    
A<Ac                     || }|dk    rd S 	 t          j        |           n$# t          $ r t          d| d|d          w xY w|S )N z	setting "z": unknown encoding: "")codecslookupLookupErrorsettingr   option_parserconfig_parserconfig_sections        r   validate_encodingr*   ^   s|    
 }{{t.e . . .k$WWeee- . . 	.. Ls	   # !Ac                 z    || }	 t          j        |           n # t          $ r t          d|z            w xY w|S )Nzunknown encoding error handler: "%s" (choices: "strict", "ignore", "replace", "backslashreplace", "xmlcharrefreplace", and possibly others; see documentation for the Python ``codecs`` module))r"   lookup_errorr$   r%   s        r   validate_encoding_error_handlerr-   o   sj    
 }5E"""" 5 5 5, /445 5 	55 Ls    8c                     d|v r^|                     d          \  }}t          |           |r|                    || dz   |           nt          |j        | dz   |           n|}t          |          S )z
    Side-effect: if an error handler is included in the value, it is inserted
    into the appropriate place as if it were a separate setting/option.
    :_error_handler)splitr-   setr	   r
   r*   )r&   r   r'   r(   r)   encodinghandlers          r   #validate_encoding_and_error_handlerr5      s     e||!KK,,''000 	Ong8H.H%' ' ' ' M('4D*DgNNNNX&&&r   c                     || }t          |t                    r|S 	 t          j        |                                                                         S # t          $ r t          d|z            w xY w)a+  Check/normalize boolean settings:
         True:  '1', 'on', 'yes', 'true'
         False: '0', 'off', 'no','false', ''

    All arguments except `value` are ignored
    (kept for compatibility with "optparse" module).
    If there is only one positional argument, it is interpreted as `value`.
    Nzunknown boolean value: "%s")
isinstanceboolOptionParserbooleansstriplowerKeyErrorr$   r%   s        r   validate_booleanr>      s     }% A$U[[]]%8%8%:%:;; A A A7%?@@@As   5A A0c                     || }t          |t                    s||S 	 t          j        |                                                                         S # t          $ r |cY S w xY w)aY  Check/normalize three-value settings:
         True:  '1', 'on', 'yes', 'true'
         False: '0', 'off', 'no','false', ''
         any other value: returned as-is.

    All arguments except `value` are ignored
    (kept for compatibility with "optparse" module).
    If there is only one positional argument, it is interpreted as `value`.
    )r7   r8   r9   r:   r;   r<   r=   r%   s        r   validate_ternaryr@      st     }% %-$U[[]]%8%8%:%:;;   s   5A A$#A$c                 V    || }t          |          }|dk     rt          d          |S )Nr   z(negative value; must be positive or zero)intr   r%   s        r   validate_nonnegative_intrC      s6    
 }JJEqyyCDDDLr   c                     || }	 t          |          S # t          $ rO 	 t          j        |                                         cY S # t
          t          f$ r t          d|z            w xY ww xY w)Nzunknown threshold: %r.)rB   r   r9   
thresholdsr<   r=   AttributeErrorr$   r%   s        r   validate_thresholdrG      s    
 }@5zz @ @ @	@*5;;==9999.) 	@ 	@ 	@6>???	@@s     
A.#AA.$A**A.c                     || }t          |t                    s|                    d          }n<|                                }|                    |                    d                     |S )Nr/   )r7   listr1   popextend)r&   r   r'   r(   r)   lasts         r   $validate_colon_separated_string_listrM      sa     }eT"" &C  yy{{TZZ__%%%Lr   c                     || }t          |t                    s|g}|                                }d |                    d          D             }|                    |           |S )zCheck/normalize list arguments (split at "," and strip whitespace).

    All arguments except `value` are ignored
    (kept for compatibility with "optparse" module).
    If there is only one positional argument, it is interpreted as `value`.
    Nc                 b    g | ],}|                     d           |                     d           -S )z 	
)r;   ).0is     r   
<listcomp>z1validate_comma_separated_list.<locals>.<listcomp>   s5    KKK!!''':J:JKQWWWKKKr   ,)r7   rI   rJ   r1   rK   )r&   r   r'   r(   r)   rL   r   s          r   validate_comma_separated_listrT      sl     } eT""  99;;DKKtzz#KKKE	LLLr   c                 Z   || }d}d}|sg S |                     d          }|d                                         }	 |d         }	n# t          $ r d}	Y nw xY w||vrt          d| d	| d
          |dk    r0|	                                }
|
|vrt          d|	 d| d
          |
}	||	gS )aQ  Check "math-output" setting, return list with "format" and "options".

    See also https://docutils.sourceforge.io/docs/user/config.html#math-output

    Argument list for compatibility with "optparse" module.
    All arguments except `value` are ignored.
    If there is only one positional argument, it is interpreted as `value`.
    N)htmllatexmathmlmathjax)r    latexmlttm	blahtexmlpandoc   )maxsplitr   r    zUnknown math output format: "z",
    choose from .rX   zMathML converter "z!" not supported,
    choose from )r1   r<   
IndexErrorr$   )r&   r   r'   r(   r)   formatstex2mathml_convertersr
   formatoptions	converters              r   validate_math_outputrg      s2    }4GI 	[[![$$FAY__F)   W 8% 8 8-48 8 8 9 9 	9MMOO	111 J7 J J1FJ J J K K KGs   A AAc                 J    || }|sdS |                     d          r|S |dz   S )Nz.//)endswithr%   s        r   validate_url_trailing_slashrk   $  s>    
 } t			 s{r   c                 |    || }	 t          j        |          S # t          $ r t          j        d           cY S w xY wN)r   DependencyListOSErrorr%   s        r   validate_dependency_filerp   3  sV    
 }*#E*** * * *#D)))))*s    ;;c                     || }t          |          }|D ]=}t          j                            |          }||k    rt	          d|d|d          >|S )NzInvalid class value z
 (perhaps z?))rT   docutilsnodesmake_idr   )r&   r   r'   r(   r)   cls
normalizeds          r   validate_strip_classrw   A  s|    
 })%00E 2 2^++C00
** #ZZZ1 2 2 2  Lr   c           	      :   || }t          |          }g }|D ]}	 |                    dd          \  }}nT# t          $ r |                    |           Y ?t          $ r' t	          d|                    dd          z            w xY w|                                }|                    d          }	t          |	          dk    r|	}n9t          |          dk    r&t	          d|                    dd          z            |                    ||f           |S )	a2  Check/normalize a comma separated list of smart quote definitions.

    Return a list of (language-tag, quotes) string tuples.

    All arguments except `value` are ignored
    (kept for compatibility with "optparse" module).
    If there is only one positional argument, it is interpreted as `value`.
    Nr/   r^   z4Invalid value "%s". Format is "<language>:<quotes>".asciibackslashreplace   z[Invalid value "%s". Please specify 4 quotes
    (primary open/close; secondary open/close).)rT   r1   rF   appendr   encoder;   len)
r&   r   r'   r(   r)   	lc_quotesitemlangquotesmultichar_quotess
             r   validate_smartquotes_localesr   S  sp    })%00EI ) )
	I::c1--LD&& 	 	 	 T"""H 	I 	I 	I A#{{74FGGH I I I	I
 !<<,,  A%%%FF[[A O#{{74FGGH I I I 	$((((s   6B0Bc                    t          j                    nt                    |D ]]}|| v rW| |         }t          |t                    rfd|D             }n&|r$t	          |z                                            }|| |<   ^dS )z
    Interpret filesystem path settings relative to the `base_path` given.

    Paths are values in `pathdict` whose keys are in `keys`.  Get `keys` from
    `OptionParser.relative_path_settings`.
    Nc                 X    g | ]&}t          |z                                            'S  )strresolve)rP   path	base_paths     r   rR   z'make_paths_absolute.<locals>.<listcomp>  s1    KKKTin557788KKKr   )r   cwdr7   rI   r   r   )pathdictkeysr   r   r   s     `  r   make_paths_absoluter   |  s     HJJ		OO	 " "(??SME%&& 9KKKKUKKK 9Yu_557788!HSM" "r   c                     t          j        dt          d           t          j                            t          j                            | |                    S )NzCfrontend.make_one_path_absolute() will be removed in Docutils 0.23.   
stacklevel)warningswarnDeprecationWarningosr   abspathjoin)r   r   s     r   make_one_path_absoluter     sM    M &'9aI I I I7??27<<	488999r   c                    t          |           }t          dt          |          d          D ]}g }||         D ]f}d |d         D             d         }||v r||                                v r|                    ||                    Q|                    |           gt          |          ||<   t          |          S )aj  Return a copy of `settings_spec` excluding/replacing some settings.

    `settings_spec` is a tuple of configuration settings
    (cf. `docutils.SettingsSpec.settings_spec`).

    Optional positional arguments are names of to-be-excluded settings.
    Keyword arguments are option specification replacements.
    (See the html4strict writer for an example.)
    r      c                 t    g | ]5}|                     d           |dd                             dd          6S )z--r   N-_)
startswithreplace)rP   
opt_strings     r   rR   z(filter_settings_spec.<locals>.<listcomp>  sS     8 8 8&%00668
122..sC88 8 8 8r   r^   r   )rI   ranger~   r   r|   tuple)settings_specexcluder   settingsrQ   newoptsopt_specopt_names           r   filter_settings_specr     s     M""H1c(mmQ'' % %  
	) 
	)H8 8*21+8 8 889;H 7""7<<>>))wx01111x((((Gnn??r   c                   4     e Zd ZdZ fdZd Zd Zd Z xZS )ValueszStorage for option values.

    Updates list attributes by extension rather than by replacement.
    Works in conjunction with the `OptionParser.lists` instance attribute.

    Deprecated. Will be removed.
    c                     t          j        dt          d            t                      j        |i | t          | dd           t          j                    | _        d S d S )Nz@frontend.Values class will be removed in Docutils 0.21 or later.r   r   record_dependencies)	r   r   r   super__init__getattrr   rn   r   selfr   r   	__class__s      r   r   zValues.__init__  sv     3(Q	8 	8 	8 	8 	$)&)))4.55=',';'='=D$$$ >=r   c                 &   t          |t                    r|j        }t          |          }|j                                        D ]6}t          | |          r$||v r t          | |          }|r|||         z  }||= 7|                     |           d S rm   )	r7   r   __dict__dictlistsr   hasattrr   _update_loose)r   
other_dictr'   r&   r   s        r   r   zValues.update  s    j&)) 	-#,J*%%
$*//11 	, 	,GtW%% ,'Z*?*?g.. ,Z00E"7+:&&&&&r   c                     t          j                    5  t          j        dt                     |                     | j                  cddd           S # 1 swxY w Y   dS )z Return a shallow copy of `self`.ignorecategory)defaultsN)r   catch_warningsfilterwarningsr   r   r   )r   s    r   copyzValues.copy  s    $&& 	: 	:#H7IJJJJ>>4=>99	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:s   6AAAc                 f    t          | |d          t          | ||           t          | |          S )znReturn ``self.name`` or ``default``.

        If ``self.name`` is unset, set ``self.name = default``.
        N)r   r	   )r   namedefaults      r   
setdefaultzValues.setdefault  s8    
 4t$$,D$(((tT"""r   )	__name__
__module____qualname____doc__r   r   r   r   __classcell__r   s   @r   r   r     so         > > > > >
' 
' 
': : :# # # # # # #r   r   c                   N     e Zd ZdZej        j        ddgz   Z fdZ fdZ xZ	S )Optionz`Add validation and override support to `optparse.Option`.

    Deprecated. Will be removed.
    	validator	overridesc                 r    t          j        dt          d            t                      j        |i | d S )NzDThe frontend.Option class will be removed in Docutils 0.21 or later.r   r   )r   r   r   r   r   r   s      r   r   zOption.__init__  sJ     3(Q	8 	8 	8 	8 	$)&)))))r   c           	         t                                          ||||          }| j        }|r| j        rxt	          ||          }	 |                     |||          }n># t
          $ r1}t          j        d|dt          j	        |                    d}~ww xY wt          |||           | j        rt          || j        d           |S )z
        Call the validator function on applicable settings and
        evaluate the 'overrides' option.
        Extends `optparse.Option.process`.
        zError in option "z":
    N)r   processdestr   r   	ExceptionoptparseOptionValueErrorr   error_stringr	   r   )
r   r   r   r
   r   resultr&   	new_valuer   r   s
            r   r   zOption.process  s     eVV<<) 	6~ 4007 $wv F FII  7 7 7"3333 4 4 467 7 77 333~ 6555s   A 
B),BB)
r   r   r   r   r   r   ATTRSr   r   r   r   s   @r   r   r     sq         
 O![+$>>E* * * * *        r   r   c                       e Zd ZdZg dZ	 d                                Z	 dddddd	Z	 d
d
d
d
dddddd	Z	  e	e
j        dd          pej        pdZdZddg ddgddifddgddifdddgdedfddgd d!d"fd#d$d%gd&d'd(d)fd*d+d,gd&d-d(d)fd.d/gd&dd(d)fd0d1gd2d3d4fd5d6d7gdedfd8d9gdd:ifd;d<gd=ed>d?fd@dAgdBd&dCdCdDfdEdFgdBd&dGdHfdIdJgdBd dKfdLdMgdd
edNfdOdPgdQd dKfdRdSgddTd
edUfdVdWgd dTd"fdXdYgdedfdZd[gd d\d"fd]d^gd_d`daedbfdcddgd_dedaedbfdfdgdhgeddidjedkfdldmdngd&ddid)fdodpdqgd&ddid)fdrdsgedtddjedufdvdwgd&ddtd)fdxdygedzddjedufd{d|gdedfd}d~gd dd"fddgdddfddgddedNfddgdd dKfdddgdedfddgdedfdddgddedfddgdedfdededddgdeedfdez  dgeedfdddgddddfddgdeddfddgddd=edfdddgddifdddgddifedgddifedgddifedgddifedgddifedgddifedgddifedgd_dedÜfedgddifR fZ	 dddddŜZ	 dZdej        ej        r
dej        z  pdde
j                                         d         de
j!        d̝Z"	 d؈ fd΄	Z#dτ Z$e%dЄ             Z&dф Z'd҄ Z(dӄ Z)dԄ Z*dՄ Z+dք Z,dׄ Z- xZ.S )r9   a  
    Settings parser for command-line and library use.

    The `settings_spec` specification here and in other Docutils components
    are merged to build the set of command-line options and runtime settings
    for this process.

    Common settings (defined below) and component-specific settings must not
    conflict.  Short options are reserved for common settings, and components
    are restricted to using long options.

    Deprecated.
    Will be replaced by a subclass of `argparse.ArgumentParser`.
    )z/etc/docutils.confz./docutils.confz~/.docutilsz(info 1 warning 2 error 3 severe 4 none 5r^   r   r   r{      )infowarningr   severenoneTF)	1onyestrue0offnofalser    r3   Nry   rz   zGeneral Docutils OptionszaOutput destination name. Obsoletes the <destination> positional argument. Default: None (stdout).z--outputmetavarz<destination>z'Specify the document title as metadata.z--titlez<title>z2Include a "Generated by Docutils" credit and link.z--generatorz-g
store_true)actionr   z"Do not include a generator credit.z--no-generatorstore_false	generator)r   r   z2Include the date at the end of the document (UTC).z--datez-dstore_constz%Y-%m-%d	datestamp)r   constr   zInclude the time & date (UTC).z--timez-tz%Y-%m-%d %H:%M UTCz'Do not include a datestamp of any kind.z--no-datestampzVBase directory for absolute paths when reading from the local filesystem. Default "/".z--root-prefixri   z<path>)r   r   z&Include a "View document source" link.z--source-linkz-sz3Use <URL> for a source link; implies --source-link.z--source-urlz<URL>z-Do not include a "View document source" link.z--no-source-linkcallback)source_link
source_url)r   r   callback_argsz4Link from section headers to TOC entries.  (default)z--toc-entry-backlinkstoc_backlinksentry)r   r   r   r   z0Link from section headers to the top of the TOC.z--toc-top-backlinkstop)r   r   r   z+Disable backlinks to the table of contents.z--no-toc-backlinks)r   r   z6Link from footnotes/citations to references. (default)z--footnote-backlinks)r   r   r   z/Disable backlinks from footnotes and citations.z--no-footnote-backlinksfootnote_backlinksz0Enable section numbering by Docutils.  (default)z--section-numberingsectnum_xform)r   r   r   r   z&Disable section numbering by Docutils.z--no-section-numberingz/Remove comment elements from the document tree.z--strip-commentsz6Leave comment elements in the document tree. (default)z--leave-commentsstrip_commentszRemove all elements with classes="<class>" from the document tree. Warning: potentially dangerous; use with caution. (Multiple-use option.)z--strip-elements-with-classr|   strip_elements_with_classesz<class>)r   r   r   r   zRemove all classes="<class>" attributes from elements in the document tree. Warning: potentially dangerous; use with caution. (Multiple-use option.)z--strip-classstrip_classeszReport system messages at or higher than <level>: "info" or "1", "warning"/"2" (default), "error"/"3", "severe"/"4", "none"/"5"z--reportz-rreport_levelz<level>)choicesr   r   r   r   z4Report all system messages.  (Same as "--report=1".)z	--verbosez-vz3Report no system messages.  (Same as "--report=5".)z--quietz-qzdHalt execution at system messages at or above <level>.  Levels as in --report.  Default: 4 (severe).z--halt
halt_level)r  r   r   r   r   z6Halt at the slightest problem.  Same as "--halt=info".z--strictzjEnable a non-zero exit status for non-halting system messages at or above <level>.  Default: 5 (disabled).z--exit-statusexit_status_levelz3Enable debug-level system messages and diagnostics.z--debugz Disable debug output.  (default)z
--no-debugdebugz-Send the output of system messages to <file>.z
--warningswarning_streamz<file>)r   r   z1Enable Python tracebacks when Docutils is halted.z--tracebackz%Disable Python tracebacks.  (default)z--no-traceback	tracebackzdSpecify the encoding and optionally the error handler of input text.  Default: <auto-detect>:strict.z--input-encodingz-iz<name[:handler]>)r   r   zlSpecify the error handler for undecodable characters.  Choices: "strict" (default), "ignore", and "replace".z--input-encoding-error-handlerstrict)r   r   z^Specify the text encoding and optionally the error handler for output.  Default: utf-8:strict.z--output-encodingz-outf-8)r   r   r   zSpecify error handler for unencodable output characters; "strict" (default), "ignore", "replace", "xmlcharrefreplace", "backslashreplace".z--output-encoding-error-handlerzOSpecify text encoding and optionally error handler for error output.  Default: r/   r`   z--error-encodingz-ezSSpecify the error handler for unencodable characters in error output.  Default: %s.z--error-encoding-error-handlerz<Specify the language (as BCP 47 language tag).  Default: en.z
--languagez-llanguage_codeenz<name>)r   r   r   z)Write output file dependencies to <file>.z--record-dependencies)r   r   r   z6Read configuration settings from <file>, if it exists.z--configstring)r   typer   r   z,Show this program's version number and exit.z	--versionz-Vr   versionz Show this help message and exit.z--helpz-hhelpz--id-prefixr   r    z--auto-id-prefix%z--dump-settingsz--dump-internalsz--dump-transformsz--dump-pseudo-xmlz--expose-internal-attributeexpose_internals)r   r   r   z--strict-visitor)_disable_config_source_destination_config_filesgeneralz%prog (Docutils z [%s]z	, Python r   z, on )r   c                 j   i | _         	 g | _        	 dg| _        t          j        dt
          d            t                      j        |t          dt          j
        d          d| | j        s| j        | _        | g|R | _        |                     | j                   | j                            |pi            |rp| j        d	         se	 |                                 }n,# t$          $ r}|                     |           Y d}~nd}~ww xY w| j                            |j                   dS dS dS )
zSet up OptionParser instance.

        `components` is a list of Docutils components each containing a
        ``.settings_spec`` attribute.
        `defaults` is a mapping of setting default overrides.
        r  ztThe frontend.OptionParser class will be replaced by a subclass of argparse.ArgumentParser in Docutils 0.21 or later.r   r   NN   )width)option_classadd_help_option	formatterr  )r   config_filesrelative_path_settingsr   r   r   r   r   r   r   TitledHelpFormatterr  version_template
componentspopulate_from_componentsr   r   get_standard_config_settingsr   r   r   )	r   r!  r   read_config_filesr   r   config_settingsr   r   s	           r   r   zOptionParser.__init__  s    
(;'7&8# 3 )Q	8 	8 	8 	8 	 '-d#+#?b#I#I#I	* 	*"(	* 	* 	* | 	10DL-*--%%do666X^,,, 	;T]3D%E 	; "&"C"C"E"E      

3 M  !9:::::	; 	; 	; 	;s   C$ $
D.DDc                 L   |D ]}||j         }| j                            |j                   t          dt	          |          d          D ]}|||dz            \  }}}|r,t          j        | ||          }|                     |           n| }|D ]=\  }	}
} |j        |
d|	i|}|	                    d          dk    rd| j
        |j        <   >|j        r| j                            |j                   |D ]*}|r&|j        r| j                            |j                   +dS )ao  Collect settings specification from components.

        For each component, populate from the `SettingsSpec.settings_spec`
        structure, then from the `SettingsSpec.settings_defaults` dictionary.
        After all components have been processed, check for and populate from
        each component's `SettingsSpec.settings_default_overrides` dictionary.
        Nr   r   r  r   r|   T)r   r  rK   r   r~   r   OptionGroupadd_option_group
add_optiongetr   r   settings_defaultsr   r   settings_default_overrides)r   r!  	componentr   rQ   titledescriptionoption_specgroup	help_textoption_stringsr   r   s                r   r"  z%OptionParser.populate_from_components  s    $ 	F 	FI %3M'..02 2 21c-00!44 F F2?!A#2F/{K !$0ukJJE))%0000 E;F 7 77Y-U-~ 89 8068 8Fzz(++x7726
6;/. FM(()DEEEF $ 	K 	KI KYA K$$Y%IJJJ	K 	Kr   c                     dt           j        v r0t           j        d                             t           j                  }n| j        }d |D             S )z:Return list of config files, from environment or standard.DOCUTILSCONFIGc                 t    g | ]5}|                                 t          j                            |          6S r   )r;   r   r   
expanduser)rP   fs     r   rR   z:OptionParser.get_standard_config_files.<locals>.<listcomp>?  s5    III!qwwyyI""1%%IIIr   )r   environr1   pathsepstandard_config_files)ru   r  s     r   get_standard_config_filesz&OptionParser.get_standard_config_files8  sL     rz)):&67==bjIILL4LII|IIIIr   c                 .   t          j                    5  t          j        dt                     t	                      }d d d            n# 1 swxY w Y   |                                 D ]+}|                    |                     |          |            ,|S )Nr   r   )r   r   r   r   r   r<  r   r   )r   r   filenames      r   r#  z)OptionParser.get_standard_config_settingsA  s    $&& 	  	 #H7IJJJJxxH	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  6688 	K 	KHOOD99(CCTJJJJs   *A

AAc                    t                      }t                      }t          j                    5  t          j        dt
                     | xj        |                    ||           z  c_        t                      }ddd           n# 1 swxY w Y   | j	        D ]r}|st          |j        pd          |j        fz   D ]M}||v r|                    |           |                    |          r|                    ||         |            Nst!          |j        | j        t&          j                            |                     |j        S )zAReturns a dictionary containing appropriate config file settings.r   r   Nr   )ConfigParserr2   r   r   r   r   r  readr   r!  r   config_section_dependenciesr)   addhas_sectionr   r   r   r  r   r   dirname)r   config_filer(   appliedr   r-  sections          r   r   z%OptionParser.get_config_file_settingsI  s   $%%$&& 	  	 #H7IJJJJ!3!3K!F!FFxxH	  	  	  	  	  	  	  	  	  	  	  	  	  	  	   		B 		BI !)"G"M2NN(79: B Bg%%G$$$ ,,W55 BOOM'$:DAAAB 	H- 7GOOK88	: 	: 	:   s   AB

BBc                     |                      |          \  |_        |_        t          |j        | j                   | j        |_        |S )z/Store positional arguments as runtime settings.)
check_argsr  r  r   r   r  r  r  )r   r
   r   s      r   check_valueszOptionParser.check_valuesa  sB    .2ood.C.C++FOT-HIII#0r   c                     d x}}|r|                     d          }|dk    rd }|r|                     d          }|dk    rd }|r|                     d           |r||k    r|                     d           ||fS )Nr   r   zMaximum 2 arguments allowed.z_Do not specify the same file for both source and destination.  It will clobber the source file.)rJ   r   )r   r   sourcedestinations       r   rJ  zOptionParser.check_argsh  s    ## 	XXa[[F}} 	#((1++Kc!!" 	7JJ5666 	If++JJ H I I I{""r   c                 r    t          j        dt          d           | j                            |           d S )NzlOptionParser.set_defaults_from_dict() will be removed in Docutils 0.22 or with the switch to ArgumentParser.r   r   )r   r   r   r   r   r   r   s     r   set_defaults_from_dictz#OptionParser.set_defaults_from_dicty  sD     O(Q	8 	8 	8 	8 	X&&&&&r   c                     t          j                    5  t          j        dt                     t	          | j                  }ddd           n# 1 swxY w Y   | j        |_        |S )z(Needed to get custom `Values` instances.r   r   N)r   r   r   r   r   r   r  r  rP  s     r   get_default_valueszOptionParser.get_default_values  s    $&& 	- 	-#H7IJJJJdm,,H	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- "&!2s   0AAAc                 x    | j         | gz   D ]}|j        D ]}|j        |k    r|c c S t          d|z            )a  
        Get an option by its dest.

        If you're supplying a dest which is shared by several options,
        it is undefined which option of those is returned.

        A KeyError is raised if there is no option with the supplied
        dest.
        zNo option with dest == %r.)option_groupsoption_listr   r=   )r   r   r1  r   s       r   get_option_by_destzOptionParser.get_option_by_dest  si     '4&0 	" 	"E+ " ";$&&!MMMMM '" 3d:;;;r   )r   NF)/r   r   r   r   r;  r1   threshold_choicesrE   r:   r   sysstderrr   _locale_encodingdefault_error_encoding$default_error_encoding_error_handlerr>   r   rw   rG   r5   r-   rp   r   r   rM   r   r+  r)   rr   __version____version_details__r  platformr   r   r"  classmethodr<  r#  r   rK  rJ  rQ  rS  rW  r   r   s   @r   r9   r9     s,
          
 CHHJJGAANNJ@dDuEEuF FH?%gcj*dCC )!#!4)!(  ,>( 	#i	 9,O4
6 i	 4+	9-
/i	
 ?$
L/?"A "A
Bi	 /
LL
Ni	 ?T
}z%02 2
3i	 +T
}&:%02 2
3i	" 4
'24 4
5#i	(4
h
/
/
1)i	0 3D
!l1A$C $C
D1i	6 @
Y0
27i	: :
^9; ;
<;i	B A"
#"mg 
 Ci	J = 
!"me
L
L
NKi	P 8
 "m
<
<
>Qi	V C!
"!d(* *
+Wi	^ <$
%'=
A
A
C_i	d = 
!!?)9; ;
<ei	l 3#
$"O
<
<
>mi	r <
!0@
A
A
Csi	x C
",<
=
=
?yi	~# )
)'D.BD D	
Ei	J# 
.BD D	
EKi	VKt
*;'5),>@ @
AWi	` A
-!(6 8  8
9ai	f @d
&46 6
7gi	l9*"3\"#	$68 8
9mi	v C,=1!-/ /
0wi	|6
):&9)*y+=? ?
@}i	H @+,%57 7
8Ii	N -.]GDD
FOi	R :.#3II
KSi	V >/lt)9; ;
<Wi	\ 2
{mLL
N]i	`It
$(;= =
>ai	jB+
,-L
M
M
Oki	r,
%(W;= =
>si	|5 -
--L
M
M	
O}i	 i	J $##%I%I%IK t
$(5K;= =	
>Gi	R(01 ,
,:79 9	
:Si	^ I
T,4!6 !6
7_i	d 6"
#-E 
ei	l C,Hh#-;KM M
Nmi	r 9
)4
6si	v -T
Xv.
0wi	| -9b/	:}i	~ ,-	3/?	@i	B +,x.F	GCi	D ,-,/G	HEi	F -.<0H	IGi	H -.<0H	IIi	J 78'9<> >
?Ki	P ,-,/G	HQi	 i	lMZ0 -1$()-*.0 0
 NN $//#7 D&x'CCJGIJ J;,,..q1113<<<	A
 #"; "; "; "; "; ";HK K K@ J J [J  ! ! !0  # # #"' ' '  < < < < < < <r   r9   c                   R     e Zd ZdZddddZ	 dZdZd fd		Zd
 Zd Z	d Z
d Z xZS )r@  aZ  Parser for Docutils configuration files.

    See https://docutils.sourceforge.io/docs/user/config.html.

    Option key normalization includes conversion of '-' to '_'.

    Config file encoding is "utf-8". Encoding errors are reported
    and the affected file(s) skipped.

    This class is provisional and will change in future versions.
    )pep_html writer
stylesheet)rc  stylesheet_path)rc  template)pep_stylesheetpep_stylesheet_pathpep_templateu  The "[option]" section is deprecated.
Support for old-format configuration files will be removed in Docutils 2.0.  Please revise your configuration files.  See <https://docutils.sourceforge.io/docs/user/config.html>, section "Old-Format Configuration Files".zhUnable to read configuration file "%s": content not encoded as UTF-8.
Skipping "%s" configuration file.
Nc                    |t          j        dt          d           g }t          |t                    r|g}|D ]}	 |t                                          |d          z  }n9# t          $ r, t          j	        
                    | j        ||fz             Y _w xY wd| v r|                     |           ||                     ||           |S )Nzbfrontend.ConfigParser.read(): parameter "option_parser" will be removed in Docutils 0.21 or later.r   r   r  )r3   re   )r   r   r   r7   r   r   rA  UnicodeDecodeErrorrY  rZ  writenot_utf8_errorhandle_old_configvalidate_settings)r   	filenamesr'   read_okr>  r   s        r   rA  zConfigParser.read  s    $M 7 -< < < < i%% 	$"I! 
	@ 
	@H577<<7<CCC%   
  !4(7K!KLLL D  &&x000(&&x???s   &A&&3BBc                    t          j        | j        t          |d           |                     d          }|                     d          s|                     d           |                                D ]z\  }}|| j        v r;| j        |         \  }}|                     |          s|                     |           nd}|}| 	                    ||          s| 
                    |||           {|                     d           d S )Nr   re   r  )r   warn_explicitold_warningConfigDeprecationWarningget_sectionrD  add_sectionr   old_settings
has_optionr2   remove_section)r   r>  re   r   r   rH  r&   s          r   rn  zConfigParser.handle_old_config  s   t/1I'	, 	, 	,""9--	** 	(Y'''!--// 		2 		2JCd'''#'#4S#9 ''00 .$$W---#??7G44 2'5111I&&&&&r   c                    |                                  D ]}|                     |          D ]}	 |                    |          }n# t          $ r Y %w xY w|j        r|                     ||          }	 |                    |||| |          }nB# t          $ r5}t          d| d| dt          j	        |           d| d| 
          d}~ww xY w| 
                    |||           |j        r| 
                    ||j        d           ߌdS )zi
        Call the validator function and implement overrides on all applicable
        settings.
        )r(   r)   zError in config file "z", section "[z]":
    z	
        z = N)sectionsre   rW  r=   r   r*  r   r   r   r   r2   r   )	r   r>  r'   rH  r&   r   r   r   r   s	            r   ro  zConfigParser.validate_settings  s   
 }} 	> 	>G<<00 > >*==gFFFF   H# : HHWg66EI$*$4$4#UM*.w %5 %H %H		 % I I I( *H( *H *H6=*H *H020D0D*H *H 5<*H *H AF*H *H I I II
 HHWgy999# >HHWf&6===%>	> 	>s)   A
AA3B
C0CCc                 R    |                                                     dd          S )z
        Lowercase and transform '-' to '_'.

        So the cmdline form of option names can be used in config files.
        r   r   )r<   r   )r   	optionstrs     r   optionxformzConfigParser.optionxform  s$       ((c222r   c                     t          j        dt          d           	 t          | |                   S # t          $ r i cY S w xY w)z
        Return a given section as a dictionary.

        Return empty dictionary if the section doesn't exist.

        Deprecated. Use the configparser "Mapping Protocol Access" and
        catch KeyError.
        zNfrontend.OptionParser.get_section() will be removed in Docutils 0.21 or later.r   r   )r   r   r   r   r=   )r   rH  s     r   rv  zConfigParser.get_section  sc     	 C(Q	8 	8 	8 	8	W&&& 	 	 	III	s   3 AArm   )r   r   r   r   rx  rt  rm  rA  rn  ro  r  rv  r   r   s   @r   r@  r@    s        
 
 <E79 9L
	4 N
     0' ' '$> > >43 3 3      r   r@  c                       e Zd ZdZdS )ru  z3Warning for deprecated configuration file features.N)r   r   r   r   r   r   r   ru  ru    s        ====r   ru  c                      t          j                    5  t          j        dt                     t	          |                                           cddd           S # 1 swxY w Y   dS )a|  Return default runtime settings for `components`.

    Return a `frontend.Values` instance with defaults for generic Docutils
    settings and settings from the `components` (`SettingsSpec` instances).

    This corresponds to steps 1 and 2 in the `runtime settings priority`__.

    __ https://docutils.sourceforge.io/docs/api/runtime-settings.html
       #settings-priority
    r   r   N)r   r   r   r   r9   rS  )r!  s    r   get_default_settingsr    s     
	 	"	" = =3EFFFFJ''::<<= = = = = = = = = = = = = = = = = =s   <AA!$A!)NNNN)NNrm   )+r   __docformat__r"   configparserr   r   r   os.pathpathlibr   rY  r   rr   r   r   r   r   r*   r-   r5   r>   r@   rC   rG   rM   rT   rg   rk   rp   rw   r   r   r   r   r   r   r9   SettingsSpecRawConfigParserr@  FutureWarningru  r  r   r   r   <module>r     s  
. .` #       " " " " " " 				        



          
+ 
+ 
+/ / / :>9=   " HLGK   & GK' ' ' '& 9=8<A A A A( 9=8<   * AE@D
 
 
 
 ;?:>@ @ @ @" ,0+/     FJEI   , =A<@! ! ! !H DHCG    AE@D* * * * =A<@   $ EIDH& & & &R" " " "*: : :  :+# +# +# +# +#X_ +# +# +#\" " " " "X_ " " "JN< N< N< N< N<8((*? N< N< N<b| | | | |</ | | |~> > > > >} > > >= = = = =r   