mò ÷Ñ8Oc@sÖdZdZdkZdkZdkZdkZdkZdkZdk Z dk l Z dk Z dk Z dk Z dklZlZlZd„Zd„Zeed„Zeed„Zeed „Zeed „Zeed „Zeed „Zeed „Zeed„Zeed„Zeed„Zed„Zd„Z d„Z!de i"fd„ƒYZ"de i#fd„ƒYZ#de i$e i%fd„ƒYZ$dei&fd„ƒYZde'fd„ƒYZ(dS(sC 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_threshold`, `validate_colon_separated_string_list`, `validate_dependency_file`. * `make_paths_absolute`. * SettingSpec manipulation: `filter_settings_spec`. treStructuredTextN(s SUPPRESS_HELP(slocale_encodings ErrorOutputs ErrorStringcOsXx!|D]}t|i|dƒqWx-|iƒD]\}}t|i||ƒq1WdS(sÀ 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( targst attributetsetattrtparsertvaluestNonetkwargstitemstkeytvalue(toptiontoptR RRRRR ((tk/home/project-web/docutils/web-update/infrastructure/update-dir/aux/snapshots/docutils/docutils/frontend.pytstore_multiple,s cCsOy|i|ƒ}Wn"tj o}|i|ƒnX|ii||ƒdS(sQ Read a configuration file during option processing. (Option callback.) N(Rtget_config_file_settingsR t new_settingst ValueErrorterrorRtupdate(R R R RRR((R tread_config_file8s cCsTyti|ƒWn<tj o0td||fƒdtiƒdf‚nX|S(Ns$setting "%s": unknown encoding: "%s"i(tcodecstlookupR t LookupErrortsettingRtsystexc_info(RR t option_parsert config_parsertconfig_section((R tvalidate_encodingBs .cCsNyti|ƒWn6tj o*td|ƒdtiƒdf‚nX|S(Ns¿unknown encoding error handler: "%s" (choices: "strict", "ignore", "replace", "backslashreplace", "xmlcharrefreplace", and possibly others; see documentation for the Python ``codecs`` module)i(Rt lookup_errorR RRRR(RR RRR((R tvalidate_encoding_error_handlerLs (cCs™d|jol|idƒ\}}t|d||||ƒ|o|i ||d|ƒqt |i |d|ƒn|}t |||||ƒ|S(sš 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. t:t_error_handlerN( R tsplittencodingthandlerR RRRRtsetRRR(RR RRRR$R%((R t#validate_encoding_and_error_handlerYs     cCslt|tƒoXy|i|iƒiƒSWqhtj o*td|ƒdt i ƒdf‚qhXn|S(Nsunknown boolean value: "%s"i( t isinstanceR tunicodeRtbooleanststriptlowertKeyErrorRRRR(RR RRR((R tvalidate_booleanos ,cCs-t|ƒ}|djotdƒ‚n|S(Nis(negative value; must be positive or zero(tintR R(RR RRR((R tvalidate_nonnegative_intys  cCsyyt|ƒSWndtj oXy|i|iƒSWquttfj o'td|ƒdt i df‚quXnXdS(Nsunknown threshold: %r.i( R/R RRt thresholdsR,R-tAttributeErrorRRRR(RR RRR((R tvalidate_threshold€scCsIt|tƒo|idƒ}n#|iƒ}|i|idƒƒ|S(NR!(R(R R)R#tpoptlasttextend(RR RRRR5((R t$validate_colon_separated_string_list‹s  cCs3|pdSn!|idƒo|Sn |dSdS(Ns./t/(R tendswith(RR RRR((R tvalidate_url_trailing_slash”s cCs>ytii|ƒSWn#tj otiidƒSnXdS(N(tdocutilstutilstDependencyListR tIOErrorR(RR RRR((R tvalidate_dependency_file�sc Cs·t|tƒo |g}ntdg}|iƒidƒD]}||i ƒq=~ƒ}xG|D]?}t i i|ƒ} || jotd|| fƒ‚qcqcW|i|ƒ|S(Nt,s$invalid class value %r (perhaps %r?)(R(R R)tfilterRt_[1]R4R#tvR+t class_valuest class_valueR;tnodestmake_idt normalizedRR6( RR RRRRBRERDRCRH((R tvalidate_strip_class¤s ?  cCs¯|djotiƒ}nx‹|D]ƒ}||jop||}t|t ƒo.g}|D]}|t ||ƒq\~}n|ot ||ƒ}n|||d?ghd"d@<d@e<dAdBdCf for a source link; implies --source-link.s --source-urltmetavarss-Do not include a "View document source" link.s--no-source-linktcallbackt callback_argst source_linkt source_urls4Link from section headers to TOC entries. (default)s--toc-entry-backlinkst toc_backlinkstentrytdefaults0Link from section headers to the top of the TOC.s--toc-top-backlinksttops+Disable backlinks to the table of contents.s--no-toc-backlinkss6Link from footnotes/citations to references. (default)s--footnote-backlinkss/Disable backlinks from footnotes and citations.s--no-footnote-backlinkstfootnote_backlinkss0Enable section numbering by Docutils. (default)s--section-numberingt sectnum_xforms&Disable section numbering by Docutils.s--no-section-numberings/Remove comment elements from the document tree.s--strip-commentss6Leave comment elements in the document tree. (default)s--leave-commentststrip_commentss‹Remove all elements with classes="" from the document tree. Warning: potentially dangerous; use with caution. (Multiple-use option.)s--strip-elements-with-classRctstrip_elements_with_classesss”Remove all classes="" attributes from elements in the document tree. Warning: potentially dangerous; use with caution. (Multiple-use option.)s --strip-classt strip_classessReport system messages at or higher than : "info" or "1", "warning"/"2" (default), "error"/"3", "severe"/"4", "none"/"5"s--reports-rtchoicest report_levelss4Report all system messages. (Same as "--report=1".)s --verboses-vs3Report no system messages. (Same as "--report=5".)s--quiets-qsdHalt execution at system messages at or above . Levels as in --report. Default: 4 (severe).s--haltt halt_levels6Halt at the slightest problem. Same as "--halt=info".s--strictsjEnable a non-zero exit status for non-halting system messages at or above . Default: 5 (disabled).s --exit-statustexit_status_levels3Enable debug-level system messages and diagnostics.s--debugs Disable debug output. (default)s --no-debugtdebugs-Send the output of system messages to .s --warningstwarning_streamss1Enable Python tracebacks when Docutils is halted.s --tracebacks%Disable Python tracebacks. (default)s--no-tracebackt tracebacksiSpecify the encoding and optionally the error handler of input text. Default: :strict.s--input-encodings-isslSpecify the error handler for undecodable characters. Choices: "strict" (default), "ignore", and "replace".s--input-encoding-error-handlertstricts^Specify the text encoding and optionally the error handler for output. Default: UTF-8:strict.s--output-encodings-osutf-8sŠSpecify error handler for unencodable output characters; "strict" (default), "ignore", "replace", "xmlcharrefreplace", "backslashreplace".s--output-encoding-error-handlersJSpecify text encoding and error handler for error output. Default: %s:%s.s--error-encodings-esSSpecify the error handler for unencodable characters in error output. Default: %s.s--error-encoding-error-handlers<Specify the language (as BCP 47 language tag). Default: en.s --languages-lt language_codetenss)Write output file dependencies to .s--record-dependenciess6Read configuration settings from , if it exists.s--configttypetstrings,Show this program's version number and exit.s --versions-Vtversions Show this help message and exit.s--helps-hthelps --id-prefixs--auto-id-prefixtids--dump-settingss--dump-internalss--dump-transformss--dump-pseudo-xmls--expose-internal-attributetexpose_internalss--strict-visitort_disable_configt_sourcet _destinationt _config_filestgenerals+%%prog (Docutils %s [%s], Python %s, on %s)c Osh|_g|_tii|dtdddtiddƒ||Ž|i p|i |_ nt |iƒ|_|ft|ƒ|_|i|iƒ|i|phƒ|oX|id oIy|iƒ}Wn"tj o}|i|ƒnX|i|iƒndS(s¶ `components` is a list of Docutils components each containing a ``.settings_spec`` attribute. `defaults` is a mapping of setting default overrides. t option_classtadd_help_optiont formattertwidthiNR·N(RjRot config_filesRhR‚RiRwRtTitledHelpFormatterRRR³tversion_templateROtrelative_path_settingsRdt componentstpopulate_from_componentstset_defaults_from_dictRrtread_config_filestget_standard_config_settingstconfig_settingsRRRm(RjRÄRrRÇRRRRÉ((R Riýs&   c Cskx+|D]#}|djoqn|i}|ii|iƒxêtdt|ƒdƒD]Ð}|||d!\}}}|o&t i|||ƒ}|i|ƒn|}xY|D]Q\} } } |id| | | Ž} | idƒdjod|i| iMs(RKtenvironR#tpathsepRÀR-Rjtstandard_config_filesRPt expandusertexpandtpwdt ImportErrorRBtfR+(RjRâRÀRBRàRß((R tget_standard_config_files<s  cCs=tƒ}x-|iƒD]}|i|i|ƒ|ƒqW|S(N(RfRXRjRãtfilenameRR(RjRäRX((R RÈPs   cCsîtƒ}|i||ƒ|ii|iƒti i |ƒ}h}t ƒ}x�|iD]v}|pqWnx_t|ipfƒ|ifD]=}||joqŒnd||<|i|i|ƒ|ƒqŒWqWWt|i|i|ƒ|iS(sAReturns a dictionary containing appropriate config file settings.iN(t ConfigParserRtreadt config_fileRjRÀR6t_filesRKRPtdirnameRJtappliedRfRXRÄRÊRdtconfig_section_dependenciesRtsectionRt get_sectionRRRmRÃ(RjRçRêRXRRÊRJRì((R RVs&   !  !cCs>|i|ƒ\|_|_t|i|iƒ|i |_ |S(s/Store positional arguments as runtime settings.N( Rjt check_argsRRR¸R¹RRRmRÃRÀRº(RjRR((R t check_valuesks  cCs³d}}|o*|idƒ}|djo d}q;n|o*|idƒ}|djo d}qln|o|idƒn|o||jo|idƒn||fS(NiRUsMaximum 2 arguments allowed.s_Do not specify the same file for both source and destination. It will clobber the source file.(Rtsourcet destinationRR4RjR(RjRRðRñ((R Rîrs   cCs|ii|ƒdS(N(RjRrR(RjRr((R RƃscCst|iƒ}|i|_|S(s(Needed to get custom `Values` instances.N(RfRjRrRÀRº(RjRr((R tget_default_values†s cCs[xD|i|gD]2}x)|iD]}|i|jo|Sq!q!WqWtd|ƒ‚dS(s 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. sNo option with dest == %r.N(Rjt option_groupsRÏt option_listR R|R-(RjR|RÏR ((R tget_option_by_destŒs  (-RtRuRvRÝR#tthreshold_choicesR1R*RpRtstderrRtlocale_encodingtdefault_error_encodingt$default_error_encoding_error_handlerR.RRIR3R'R R?Rt SUPPRESS_HELPR7RWRÕRÃRR;t __version__t__version_details__R³tplatformRÂRiRÅRãRÈRRïRîRÆRòRõ(((R R‚#sJ  3W ÿÿÿÿÿÿÿ‰§* ,        RåcBsktZhdd<dd<dd, section "Old-Format Configuration Files". shUnable to read configuration file "%s": content not encoded as UTF-8. Skipping "%s" configuration file. cOs/tii|||Žg|_tƒ|_dS(N( tCPtRawConfigParserRiRjRRRèt ErrorOutputt_stderr(RjRR((R Ri²s cCs<t|ƒttfjo |g}nx|D]}yti|ddƒ}Wntj o q-nXyDt i djot i i |||ƒnt i i|||ƒWn=tj o1|ii|i||fƒ|iƒq-nX|iƒ|ii|ƒ|idƒo|i|ƒn|i||ƒq-WdS(Ntrsutf-8iitoptions(ii(R±t filenameststrR)RäRtopentfpR>Rt version_infoRRtreadfpRjt read_filetUnicodeDecodeErrorRtwritetnot_utf8_errortcloseRèRct has_sectionthandle_old_configtvalidate_settingsR(RjR RRRä((R Ræ»s*   cCsõti|it|dƒ|idƒ}|idƒp|i dƒnx˜|i ƒD]Š\}}||i jo8|i |\}}|i|ƒp|i |ƒq¶n d}|}|i||ƒp|i|||ƒqVqVW|idƒdS(NiR R»(twarningst warn_explicitRjt old_warningtConfigDeprecationWarningRäRíR Rt add_sectionRR R t old_settingsRìRt has_optionR&tremove_section(RjRäR RR RìR ((R RÓs   c Cs-x&|iƒD]}x|i|ƒD]þ}y|i|ƒ}Wntj o q#nX|i ož|i ||ƒ}y%|i |||d|d|ƒ}WnMt j oA}td||t|ƒ||fƒdtiƒdf‚nX|i|||ƒn|io|i||idƒq#q#Wq WdS(si Call the validator function and implement overrides on all applicable settings. RRsAError in config file "%s", section "[%s]": %s %s = %siN(RjtsectionsRìR RRRõR R-RxRÔR R}R~RRRäR€RRRR&Ry( RjRäRR RìRR RR}((R Rås&  = cCs|iƒiddƒS(sW Transform '-' to '_' so the cmdline form of option names can be used. RURVN(t optionstrR,R`(RjR"((R t optionxformscCsNh}|i|ƒo4x1|i|ƒD]}|i||ƒ||