
    >WBȇ                     L   d Z dZddl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 ej                  dk\  rddl
mZ ddlmZ nddlm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mZmZ ej                  dk\  re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 Z)d Z* G d dejV                        Z+ G d dejX                        Z, G d  d!ejZ                  ej\                        Z- G d" d#e      Z G d$ d%e/      Z0y)(au  
Command-line and common processing for Docutils front-end tools.

Exports the following classes:

* `OptionParser`: Standard Docutils command-line processing.
* `Option`: Customized version of `optparse.Option`; validation support.
* `Values`: Runtime settings; objects are simple structs
  (``object.attribute``).  Supports cumulative list settings (attributes).
* `ConfigParser`: Standard Docutils config file processing.

Also exports the following functions:

* Option callbacks: `store_multiple`, `read_config_file`.
* Setting validators: `validate_encoding`,
  `validate_encoding_error_handler`,
  `validate_encoding_and_error_handler`,
  `validate_boolean`, `validate_ternary`, `validate_threshold`,
  `validate_colon_separated_list`,
  `validate_comma_separated_list`,
  `validate_dependency_file`.
* `make_paths_absolute`.
* SettingSpec manipulation: `filter_settings_spec`.
reStructuredText    N)SUPPRESS_HELP   r   )RawConfigParser)getcwd)getcwdu)locale_encoding
SafeStringErrorOutputErrorStringc                     |D ]  }t        |j                  |d        |j                         D ]  \  }}t        |j                  ||        y)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           1lib/python3.12/site-packages/docutils/frontend.pystore_multipler   8   sL      0	y$/0lln +
UsE*+    c                     	 |j                  |      }|j                  j	                  |       y# t        $ r}|j                  |       Y d}~<d}~ww xY w)zQ
    Read a configuration file during option processing.  (Option callback.)
    N)get_config_file_settings
ValueErrorerrorr   update)r   r   r   r   new_settingsr    s         r   read_config_filer#   D   sN    66u= MMv.  Us   0 	AAAc                 p    	 t        j                  |       |S # t        $ r t        d| d|d      w xY w)Nz	setting "z": unknown encoding: "")codecslookupLookupErrorsettingr   option_parserconfig_parserconfig_sections        r   validate_encodingr.   N   sB    .e L  .$e- . 	..s    5c                 h    	 t        j                  |       |S # t        $ r t        d|z        w xY w)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_handlerr1   W   sI    5E" L  5, /445 	55s    1c                     d|v rZ|j                  d      \  }}t        | dz   ||||       |r|j                  || 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 was a separate setting/option.
    :_error_handler)splitr1   setr   r   r.   )r*   r   r+   r,   r-   encodinghandlers          r   #validate_encoding_and_error_handlerr9   c   s     e|!KK,''&&>	+ ng8H.H%' M(('4D*DgNgx#^5Or   c                     t        |t              r|S 	 |j                  |j                         j	                            S # t
        $ r t        d|z        w xY w)z|Check/normalize boolean settings:
         True:  '1', 'on', 'yes', 'true'
         False: '0', 'off', 'no','false', ''
    zunknown boolean value: "%s")
isinstanceboolbooleansstriplowerKeyErrorr(   r)   s        r   validate_booleanrA   y   s[     %A%%ekkm&9&9&;<< A7%?@@As	   *? Ac                     t        |t              s||S 	 |j                  |j                         j	                            S # t
        $ r |cY S w xY w)zCheck/normalize three-value settings:
         True:  '1', 'on', 'yes', 'true'
         False: '0', 'off', 'no','false', ''
         any other value: returned as-is.
    )r;   r<   r=   r>   r?   r@   r)   s        r   validate_ternaryrC      sP     %%-%%ekkm&9&9&;<< s   *A AAc                 <    t        |      }|dk  rt        d      |S )Nr   z(negative value; must be positive or zero)intr   r)   s        r   validate_nonnegative_intrF      s#    JEqyCDDLr   c                     	 t        |      S # t        $ rB 	 |j                  |j                            cY S # t        t
        f$ r t        d|z        w xY ww xY w)Nzunknown threshold: %r.)rE   r   
thresholdsr?   r@   AttributeErrorr(   r)   s        r   validate_thresholdrJ      sg    @5z @	@ ++EKKM::.) 	@6>??	@@s   
 	A6AAAc                     t        |t              s|j                  d      }|S |j                         }|j	                  |j                  d             |S )Nr3   )r;   listr5   popextend)r*   r   r+   r,   r-   lasts         r   $validate_colon_separated_string_listrP      sG    eT"C  L yy{TZZ_%Lr   c                     t        |t              s|g}|j                         }|j                  d      D cg c]%  }|j	                  d      s|j	                  d      ' }}|j                  |       |S c c}w )zHCheck/normalize list arguments (split at "," and strip whitespace).
    ,z 	
)r;   rL   rM   r5   r>   rN   )r*   r   r+   r,   r-   rO   ir   s           r   validate_comma_separated_listrT      si     eT" 99;D(,

4(8N1AGGH<MQWWXNEN	LLL Os   A6A6c                 8    |sy|j                  d      r|S |dz   S )Nz.//)endswithr)   s        r   validate_url_trailing_slashrX      s#    		s{r   c                     	 t         j                  j                  |      S # t        $ r" t         j                  j                  d       cY S w xY wN)docutilsutilsDependencyListIOErrorr)   s        r   validate_dependency_filer_      s@    3~~,,U33 3~~,,T223s   ! (AAc                     t        | ||||      }|D ]8  }t        j                  j                  |      }||k7  s(t	        d|d|d       |S )NzInvalid class value z
 (perhaps z?))rT   r[   nodesmake_idr   )r*   r   r+   r,   r-   cls
normalizeds          r   validate_strip_classre      se     *'5-*7IE  2^^++C0
* #Z1 2 22
 Lr   c           	         t        | ||||      }g }|D ]  }	 |j                  dd      \  }}|j                         }|j                  d      }	t        |	      dk(  r|	}n,t        |      dk7  rt	        d|j                  dd      z        |j                  ||f        |S # t        $ r |j                  |       Y t        $ r t	        d|j                  dd      z        w xY w)z~Check/normalize a comma separated list of smart quote definitions.

    Return a list of (language-tag, quotes) string tuples.r3      z4Invalid value "%s". Format is "<language>:<quotes>".asciibackslashreplace   z[Invalid value "%s". Please specify 4 quotes
    (primary open/close; secondary open/close).)rT   r5   rI   appendr   encoder>   len)
r*   r   r+   r,   r-   	lc_quotesitemlangquotesmultichar_quotess
             r   validate_smartquotes_localesrs      s#    *'5-*7IE I )
	I::c1-LD& !<<, A%%F[A B#{{74FGH I I 	$(+), '  	 T" 	I A#{{74FGH I I	Is   B""C%>'C%c                     |
t               }|D ]I  }|| v s| |   }t        |t              r|D cg c]  }t        ||       }}n|rt        ||      }|| |<   K yc c}w )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`.
    N)r   r;   rL   make_one_path_absolute)pathdictkeys	base_pathr   r   paths         r   make_paths_absoluterz      s{     H	 "(?SME%&%*,! 0	4@ , ,.y%@!HSM",s   Ac                 |    t         j                  j                  t         j                  j                  | |            S rZ   )osry   abspathjoin)rx   ry   s     r   ru   ru     s$    77??277<<	4899r   c           	         t        |       }t        dt        |      d      D ]  }g }||   D ]y  }|d   D cg c](  }|j                  d      r|dd j	                  dd      * c}d   }||v rB||j                         v r|j                  ||          i|j                  |       { t        |      ||<    t        |      S c c}w )	a  Return a copy of `settings_spec` excluding/replacing some settings.

    `settings_spec` is a tuple of configuration settings with a structure
    described for 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   rg   z--N-_r   )rL   rangerm   
startswithreplacerw   rk   tuple)	settings_specexcluder   settingsrS   newoptsopt_spec
opt_stringopt_names	            r   filter_settings_specr     s     M"H1c(mQ' %  	)H +31+&)44T: #12..sC8  H 7"7<<>)wx01x(	) Gn% ?s   -Cc                   (    e Zd ZdZd Zd Zd Zd Zy)Valuesz
    Updates list attributes by extension rather than by replacement.
    Works in conjunction with the `OptionParser.lists` instance attribute.
    c                     t        j                  j                  | g|i | t        | d      r| j                  $t
        j                  j                         | _        y y )Nrecord_dependencies)optparser   __init__hasattrr   r[   r\   r]   selfr   r   s      r   r   zValues.__init__9  sO      77734''/'/~~'D'D'FD$ 0r   c                    t        |t              r|j                  }|j                         }|j                  j                         D ].  }t        | |      s||v st        | |      }|s$|||   z  }||= 0 | j                  |       y rZ   )	r;   r   __dict__copylistsrw   r   getattr_update_loose)r   
other_dictr+   r*   r   s        r   r!   zValues.update@  s    j&)#,,J__&
$**//1 	,Gg&7j+@g.Z00E"7+	, 	:&r   c                 :    | j                  | j                        S )z Return a shallow copy of `self`.)defaults)	__class__r   )r   s    r   r   zValues.copyL  s    ~~t}}~55r   c                 N    t        | |d      t        | ||       t        | |      S )zUV.setdefault(n[,d]) -> getattr(V,n,d), also set D.n=d if n not in D or None.
        N)r   r   )r   namedefaults      r   
setdefaultzValues.setdefaultP  s,     4t$,D$(tT""r   N)__name__
__module____qualname____doc__r   r!   r   r    r   r   r   r   2  s    
G
'6#r   r   c                   H    e Zd Zej                  j
                  ddgz   Zd Zy)Option	validator	overridesc           	         t         j                  j                  | ||||      }| j                  }|r\| j                  r-t        ||      }	 | j	                  |||      }t        |||       | j                  rt        || j                  d       |S # t        $ r)}t        j                  d|dt        |            d}~ww xY w)z
        Call the validator function on applicable settings and
        evaluate the 'overrides' option.
        Extends `optparse.Option.process`.
        zError in option "z":
    N)r   r   processdestr   r   	ExceptionOptionValueErrorr   r   r   )	r   r   r   r   r   resultr*   	new_valuer    s	            r   r   zOption.process\  s     ((sE66J))~~05 $wv FI
 3~~5 ! 5"33E 245 55s   B 	C$B==CN)r   r   r   r   r   ATTRSr   r   r   r   r   r   X  s     OO!![+$>>Er   r   c                      e Zd ZdZg dZ	 dj                         Z	 dddddd	Z	 d
d
d
d
dddddd	Z	  e	e
j                  dd      xs exs dZdZddg ddg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d+d,d-gdedfd.d/gd0d1ifd2d3gd4ed5d6fd7d8gd9d!d:d:d;fd<d=gd9d!d>d?fd@dAgd9ddBfdCdDgddedEfdFdGgdHddBfdIdJgddKdedLfdMdNgddKdfdOdPgdedfdQdRgddSdfdTdUgdVdWdXedYfdZd[gdVd\dXedYfd]d^d_gedd`daedbfdcdddegd!dd`d$fdfdgdhgd!dd`d$fdidjgedkddaedlfdmdngd!ddkd$fdodpgedqddaedlfdrdsgdedfdtdugddvdfdwdxgdydzd{fd|d}gddedEfd~dgdddB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dzeddfddgdzdd4e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dVdedfedgddiffZ	 dddddZ	 dZdZdej<                  ej>                  xr dej>                  z  xs dde
j@                  j                         d   de
jB                  dĝZ"	 ddńZ#dƄ Z$dǄ Z%dȄ Z&dɄ Z'dʄ Z(d˄ Z)d̄ Z*d̈́ Z+d΄ Z,y)OptionParsera  
    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 restrict to using long options.
    )z/etc/docutils.confz./docutils.confz~/.docutilsz(info 1 warning 2 error 3 severe 4 none 5rg   r   r   rj      )infowarningr    severenoneTF)	1onyestrue0offnofalse r7   Nrh   ri   zGeneral Docutils Optionsz'Specify the document title as metadata.z--titlez2Include 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-datestampz&Include a "View document source" link.z--source-linkz-sz3Use <URL> for a source link; implies --source-link.z--source-urlmetavarz<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-classrk   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	tracebackziSpecify the encoding and optionally the error handler of input text.  Default: <locale-dependent>: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-handlerzDSpecify text encoding and error handler for error output.  Default: r3   .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)r   generalz%prog (Docutils z [%s]z	, Python r   z, on )c                 v   i | _         	 g | _        	 t        j                  j                  | g|t
        dt        j                  d      d| | j                  s| j                  | _        t        | j                        | _
        | ft        |      z   | _        | j                  | j                         | j                  |xs i        |r=| j                  d   s-	 | j!                         }| j                  j(                         yyy# t"        $ r$}| j%                  t'        |             Y d}~Fd}~ww xY w)z
        `components` is a list of Docutils components each containing a
        ``.settings_spec`` attribute.  `defaults` is a mapping of setting
        default overrides.
        NN   )width)option_classadd_help_option	formatterr   )r   config_filesr   r   r   r   TitledHelpFormatterr   version_templaterL   relative_path_settingsr   
componentspopulate_from_componentsset_defaults_from_dictr   get_standard_config_settingsr   r    r   r   )r   r   r   read_config_filesr   r   config_settingsr    s           r   r   zOptionParser.__init__O  s#    
(;&&	 	%t22<	 	 ||00DL&*4+F+F&G#'E*$55%%doo6##HN3T]]3D%E."&"C"C"E ''(@(@A &F  .

:e,--.s   D 	D8D33D8c                    |D ]
  }||j                   }| j                  j                  |j                         t        dt	        |      d      D ]  }|||dz    \  }}}|r)t        j                  | ||      }| j                  |       n| }|D ]H  \  }	}
} |j                  |
d|	i|}|j                  d      dk(  s0d| j                  |j                  <   J |j                  s| j                  j                  |j                           |D ]7  }|s|j                  s| j                  j                  |j                         9 y)aE  
        For each component, first 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   rk   T)r   r   rN   r   rm   r   OptionGroupadd_option_group
add_optiongetr   r   settings_defaultsr   r!   settings_default_overrides)r   r   	componentr   rS   titledescriptionoption_specgroup	help_textoption_stringsr   r   s                r   r   z%OptionParser.populate_from_componentso  s[    $ 	FI %33M''..0021c-0!4 F2?!A#2F/{K$00ukJE))%0 E;F 77Y-U--~ 89 8068Fzz(+x726

6;;/	7
 ..MM(()D)DEF	F( $ 	KIYAA$$Y%I%IJ	Kr   c                 x   	 t         j                  d   j                  t         j                        }t         j                  j                  }dt         j                  vr	 ddl}|D cg c]  }|j                         s ||       c}S # t        $ r | j
                  }Y ow xY w# t        $ r d }Y Pw xY wc c}w )z:Return list of config files, from environment or standard.DOCUTILSCONFIGHOMEr   Nc                     | S rZ   r   )xs    r   <lambda>z8OptionParser.get_standard_config_files.<locals>.<lambda>  s    1 r   )r|   environr5   pathsepr@   standard_config_filesry   
expanduserpwdImportErrorr>   )r   r   expandr  fs        r   get_standard_config_filesz&OptionParser.get_standard_config_files  s    	6::&67==bjjIL ###% $0=a1779q	==  	655L	6  %$%=s/   0B
 B% 'B7=
B7
B"!B"%B43B4c                     t               }| j                         D ]#  }|j                  | j                  |      |        % |S rZ   )r   r  r!   r   )r   r   filenames      r   r   z)OptionParser.get_standard_config_settings  sA    8668 	KHOOD99(CTJ	Kr   c                 2   t               }|j                  ||        | j                  j                  |j                         t
        j                  j                  |      }t               }t               }| j                  D ]h  }|st        |j                  xs d      |j                  fz   D ]9  }||v r|j                  |       |j                  |j!                  |      |        ; j t#        |j$                  | j&                  |       |j$                  S )zAReturns a dictionary containing appropriate config file settings.r   )ConfigParserreadr   rN   _filesr|   ry   dirnamer6   r   r   r   config_section_dependenciesr-   addr!   get_sectionrz   r   r   )r   config_filer   rx   appliedr   r
  sections           r   r   z%OptionParser.get_config_file_settings  s    K&  /GGOOK0	%8 	CI!)"G"G"M2N(779: Cg%G$ 2 27 ;TBC	C 	t::I	G   r   c                     | j                  |      \  |_        |_        t        |j                  | j
                         | j                  |_        |S )z/Store positional arguments as runtime settings.)
check_argsr   r   rz   r   r   r   r   )r   r   r   s      r   check_valueszOptionParser.check_values  sA    .2ood.C++FOOT-H-HI#00r   c                     d x}}|r|j                  d      }|dk(  rd }|r|j                  d      }|dk(  rd }|r| j                  d       |r||k(  r| j                  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.)rM   r    )r   r   sourcedestinations       r   r.  zOptionParser.check_args  s}    ##XXa[F}((1+Kc!"JJ56f+JJ H I{""r   c                 :    | j                   j                  |       y rZ   )r   r!   r   r   s     r   r   z#OptionParser.set_defaults_from_dict  s    X&r   c                 R    t        | j                        }| j                  |_        |S )z(Needed to get custom `Values` instances.)r   r   r   r   r4  s     r   get_default_valueszOptionParser.get_default_values  s#    $--(!%!2!2r   c                     | j                   | gz   D ](  }|j                  D ]  }|j                  |k(  s|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   r  r   s       r   get_option_by_destzOptionParser.get_option_by_dest  sY     ''4&0 	"E++ ";;$&!M"	" 3d:;;r   )r   NN)-r   r   r   r   r  r5   threshold_choicesrH   r=   r   sysstderrr
   default_error_encoding$default_error_encoding_error_handlerrA   r   re   rJ   r9   r1   r_   r#   r   rP   r   r  r   r-   r[   __version____version_details__r   platformr   r   r   r  r   r   r/  r.  r   r6  r:  r   r   r   r   r   s  sQ   I CHHJGAANJ@tD$eePH?$SZZ%)+ I.=IAH  ,>( 	#a	
3+r
 a	
>$
L/?"A
Ba	
 /
L
Na	 ?T
}z%02
3a	 +T
}&:%02
3a	 4
'24
5a	" 3D
!l1A$C
D#a	( @
Y0
2)a	, :
^9;
<-a	4 A"
#"mg
 5a	< = 
!"me
L
N=a	B 8
 "m
<
>Ca	H C!
"!a(*
+Ia	P <$
%'=
A
CQa	V = 
!!?&68
9Wa	^ 3#
$"O
<
>_a	d <
!0@
A
Cea	j C
",<
=
?ka	p# )
)'D.BD	
Eqa	|# 
.BD	
E}a	HKt
*;'5),>@
AIa	R A
-!(6 8
9Sa	X @d
&46
7Ya	^9*"3\"#	$68
9_a	h C,=1!-/
0ia	n6
):&9)*y+=?
@oa	z @+,=MN
P{a	~ -.]GD
Fa	B :.#3I
KCa	F >/lt)9;
<Ga	L 2
{mL
NMa	PNt
$(;=
>Qa	ZB+
,-L
M
O[a	b,
%(W;=
>ca	l5 -
--L
M	
Oma	z $%IK t
$(5K;=	
>wa	B(01 ,
,:79	
:Ca	N I
T,4!6
7Oa	T 6"
#-E
Ua	\ C,Hh#-;KM
N]a	b 9
)4
6ca	f -T
Xv.
0ga	l -9b/	:ma	n ,-	3/?	@oa	r +,x.F	Gsa	t ,-,/G	Hua	v -.<0H	Iwa	x -.<0H	Iya	z 78'9<>
?{a	@ ,-,/G	HAa	dMJ0 -1$()-*.0 Q0N $//#77 @"8#?#??FCEF;;,,.q13<<	A
 #B@K>>(!*#"'<r   r   c                   F    e Zd ZddddZ	 dZdZd Zd Zd	 Zd
 Z	d Z
d Zy)r#  )pep_html writer
stylesheet)rD  stylesheet_path)rD  template)pep_stylesheetpep_stylesheet_pathpep_templatea	  
The "[option]" section is deprecated.  Support for old-format configuration
files will be removed in a future Docutils release.  Please revise your
configuration files.  See <http://docutils.sf.net/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.
c                 d    t        j                  | g|i | g | _        	 t               | _        y rZ   )r   r   r%  r   _stderrr   s      r   r   zConfigParser.__init__  s0      7778"}Dr   c                 l   t        |      t        t        fv r|g}|D ]  }	 t        j                  |dd      }	 t        j                  dk  rt        j                  | ||       nt        j                  | ||       |j                          | j                   j#                  |       | j%                  d      r| j'                  |       | j)                  ||        y # t
        $ r Y w xY w# t        $ r> | j                  j                  | j                  ||fz         |j                          Y w xY w)Nrr   r   options)r   strunicoder&   openr^   r<  version_infor   readfp	read_fileUnicodeDecodeErrorrL  writenot_utf8_errorcloser%  rk   has_sectionhandle_old_configvalidate_settings)r   	filenamesr+   r!  fps        r   r$  zConfigParser.read  s   	?sGn,"I! 	<H[[38##f,#**4X>#--dBA
 HHJKKx(	*&&x0""8];'	<   & ""4#6#6(H9M#MN
s$   CAC,	C)(C),AD32D3c                    t        j                  | j                  t        |d       | j	                  d      }| j                  d      s| j                  d       |j                         D ]r  \  }}|| j                  v r5| j                  |   \  }}| j                  |      s| j                  |       nd}|}| j                  ||      r`| j                  |||       t | j                  d       y )Nr   rO  r   )warningswarn_explicitold_warningConfigDeprecationWarningr)  rZ  add_sectionr   old_settings
has_optionr6   remove_section)r   r!  rO  r   r   r,  r*   s          r   r[  zConfigParser.handle_old_config%  s    t//1I'	,""9-	*Y'!--/ 		2JCd'''#'#4#4S#9 ''0$$W-#??7G4'51		2 	I&r   c                    | j                         D ]  }| j                  |      D ]  }	 |j                  |      }|j                  r<| j                  ||      }	 |j	                  |||| |      }| j                  |||       |j                  sj| j                  ||j                  d         y# t        $ r Y w xY w# t        $ r(}t        d|d|dt        |      d|d|
      d}~ww xY w)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)sectionsrO  r:  r@   r   r  r   r   r   r6   r   )	r   r!  r+   r,  r*   r   r   r   r    s	            r   r\  zConfigParser.validate_settings7  s   
 }} 	>G<<0 >*==gFF ## HHWg6E
0$*$4$4#UM*.w %5 %H	 HHWgy9##HHWf&6&6=)>	>    % 0(  (+e2D&	/0 00s)   B1C 1	B=<B= 	C1	#C,,C1c                 B    |j                         j                  dd      S )zW
        Transform '-' to '_' so the cmdline form of option names can be used.
        r   r   )r?   r   )r   	optionstrs     r   optionxformzConfigParser.optionxformS  s      ((c22r   c                     i }| j                  |      r+| j                  |      D ]  }| j                  ||      ||<    |S )zf
        Return a given section as a dictionary (empty if the section
        doesn't exist).
        )rZ  rO  r  )r   r,  section_dictr   s       r   r)  zConfigParser.get_sectionY  sL    
 G$,,w/ A'+xx'@V$Ar   N)r   r   r   re  rb  rX  r   r$  r[  r\  rl  r)  r   r   r   r#  r#    sG     <E79LPKN
E<0'$>83	r   r#  c                       e Zd ZdZy)rc  z3Warning for deprecated configuration file features.N)r   r   r   r   r   r   r   rc  rc  e  s    =r   rc  )NNrZ   )1r   __docformat__r|   os.pathr<  r`  r&   r   r   rS  configparserr   r   r#  r	   r[   docutils.utilsdocutils.nodesdocutils.utils.error_reportingr
   r   r   r   rP  rQ  r   r#   r.   r1   r9   rA   rC   rF   rJ   rP   rT   rX   r_   re   rs   rz   ru   r   r   r   r   SettingsSpecFutureWarningrc  r   r   r   <module>rx     sq  
2 # 	  
    "v,,$   F F vG
+/ :> HL
 GK. 9=A 9= AE ;?@ GK HL  GK AE3 =A =A!F"(:<##X__ ##LX__ 6y<8(((*?*? y<xs? sl>} >r   