mò iã¸Ec@s"dZdZdkZdkZdkZdkZdkZdkZdklZl Z dk l Z l Z dk l Z lZde fd„ƒYZde fd „ƒYZd fd „ƒYZd e fd „ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZd„Zd„Zd„Zde fd„ƒYZd„Zd„Zdd„Zd„Zd„Zdd„Z d„Z!d „Z"d!„Z#d"d#„Z$hd$d%<d&d%<d'd(<d)d(<d*d(<d+d(R2((RRµs cOs|id||ŽS(s§ Level-1, "INFO": a minor issue that can be ignored. Typically there is no effect on processing, and level-1 system messages are not reported. iN(RRR>R2(RR>R2((Rtinfo¾scOs|id||ŽS(s‘ Level-2, "WARNING": an issue that should be addressed. If ignored, there may be unpredictable problems with the output. iN(RRR>R2(RR>R2((RtwarningÅscOs|id||ŽS(sz Level-3, "ERROR": an error that should be addressed. If ignored, the output will contain errors. iN(RRR>R2(RR>R2((RterrorÌscOs|id||ŽS(sâ Level-4, "SEVERE": a severe error that must be addressed. If ignored, the output will contain severe errors. Typically level-4 system messages are turned into exceptions which halt processing. iN(RRR>R2(RR>R2((RtsevereÓs(R R t__doc__tsplitR9RRR(R+R-R/RRR?R@RARB(((RR "s  :       tExtensionOptionErrorcBstZRS(N(R R (((RREÜstBadOptionErrorcBstZRS(N(R R (((RRFÝstBadOptionDataErrorcBstZRS(N(R R (((RRGÞstDuplicateOptionErrorcBstZRS(N(R R (((RRHßscCst|ƒ}t||ƒ}|S(sC Return a dictionary mapping extension option names to converted values. :Parameters: - `field_list`: A flat field list without field arguments, where each field body consists of a single paragraph only. - `options_spec`: Dictionary mapping known option names to a conversion function such as `int` or `float`. :Exceptions: - `KeyError` for unknown option names. - `ValueError` for invalid option values (raised by the conversion function). - `TypeError` for invalid option value types (raised by conversion function). - `DuplicateOptionError` for duplicate options. - `BadOptionError` for invalid fields. - `BadOptionDataError` for invalid option data (missing name, missing data, bad quotes, etc.). N(textract_optionst field_listt option_listtassemble_option_dictt options_spect option_dict(RJRMRNRK((Rtextract_extension_optionsâs cCs*g}x|D]}t|diƒiƒƒdjotdƒ‚nt|diƒiƒƒ}|d}t|ƒdjo d}n‡t|ƒdjpKt |dtiƒ p3t|dƒdjpt |ddtiƒ otd|ƒ‚n|ddiƒ}|i||fƒq W|S(s¤ Return a list of option (name, value) pairs from field names & bodies. :Parameter: `field_list`: A flat field list, where each field name is a single word and each field body consists of a single paragraph only. :Exceptions: - `BadOptionError` for invalid fields. - `BadOptionDataError` for invalid option data (missing name, missing data, bad quotes, etc.). iis:extension option field name may not contain multiple wordssMextension option field body may contain a single paragraph only (option "%s")N(RKRJtfieldtlenRRDRFtstrtlowertnametbodyRtdatat isinstanceR8t paragraphtTextRGR)(RJRURTRPRKRV((RRIûs #  ^cCsÆh}x¹|D]±\}}||}|djot|ƒ‚n|i|ƒot d|ƒ‚ny||ƒ||(RKRMRTR\RaR]R[((RRLs   1tNameValueErrorcBstZRS(N(R R (((RRd<scCsÍg}xÀ|o¸|idƒ}|djotdƒ‚n|| iƒ}|djp| otdƒ‚n||diƒ}|ptd|ƒ‚n|ddjo°|i|ddƒ}|djotd ||dfƒ‚nt |ƒ|djo3||diƒotd ||dfƒ‚n|d|!}||diƒ}nK|id ƒ}|djo|}d }n|| }||diƒ}|i |i ƒ|fƒq W|S(sÆ Return a list of (name, value) from a line of the form "name=value ...". :Exception: `NameValueError` for invalid input (missing name, missing data, bad quotes, etc.). t=iÿÿÿÿs missing "="is!missing attribute name before "="ismissing value after "%s="s'"s%attribute "%s" missing end quote (%s)s8attribute "%s" end quote (%s) not followed by whitespaceRZRN(tattlistR1tfindtequalsRdtstriptattnametlstriptendquoteRQRVtspaceR)RS(R1RlRmRVRhRjRf((Rtextract_name_value?s:  ,    c Cs@t||i|id|id|id|id|iƒ}|S(sè Return a new Reporter object. :Parameters: `source` : string The path to or description of the source text of the document. `settings` : optparse.Values object Runtime settings. RRRRN( R t source_pathtsettingsRRtwarning_streamRterror_encodingterror_encoding_error_handlertreporter(RoRpRt((Rt new_reporterks  cCs^|djotiƒiƒ}nt||ƒ}ti ||d|ƒ}|i |dƒ|S(s Return a new empty document object. :Parameters: `source` : string The path to or description of the source text of the document. `settings` : optparse.Values object Runtime settings. If none provided, a default set will be used. RiÿÿÿÿN( RpRtfrontendt OptionParsertget_default_valuesRuRoRtR8tdocumentt note_source(RoRpRtRy((Rt new_document|s  cCsŒt|ƒdjout|dtiƒo^|d}xQ|D]E\}}|i |i ƒ}|o |i ||i ƒ|_ dSq;q;WndS(Nii( RQRXRWR8RYttextnodetkeyword_substitutionstpatternt substitutiontsearchRVtmatchtsub(RXR}R|R~RR((Rtclean_rcs_keywordss*  cCsîtii|pdƒitiƒ}tii|ƒitiƒ}|d |d jodi |ƒSn|i ƒ|i ƒx<|o4|o-|d|djo|i ƒ|i ƒq€W|i ƒdgt |ƒd|}di |ƒS(sš Build and return a path to `target`, relative to `source` (both files). If there is no common prefix, return the absolute path to `target`. t dummy_fileit/iÿÿÿÿs..iN(tostpathtabspathRRDtsept source_partsttargett target_partsRctreversetpopRQtparts(RR‹RŠRŒR((Rt relative_path–s%  #  cCsX|ioC|i p td‚|djo |i}nt||iƒSn|iSdS(sC Retrieve a stylesheet reference from the settings object. s6stylesheet and stylesheet_path are mutually exclusive.N(Rptstylesheet_patht stylesheettAssertionErrort relative_toRt _destinationR(RpR”((Rtget_stylesheet_reference®s   cCs<|idjo!t|dƒo |idjSn|iSdS(së Return whether or not to trim footnote space. If trim_footnote_reference_space is not None, return it. If trim_footnote_reference_space is None, return False unless the footnote reference style is 'superscript'. tfootnote_referencest superscriptN(Rpttrim_footnote_reference_spaceRthasattrR—(Rp((Rtget_trim_footnote_ref_space»s!cCsDx=|o5|ip |io|i|ifSn|i}qWdS(sk Return the "source" and "line" attributes from the `node` given or from its closest ancestor. N(NN(tnodeRR1tparentR(Rœ((RR6ÊscCs—g}d}x„|id|ƒ}|djo"|i||ƒdi|ƒSn|i|||!ƒ|id||d|d!ƒ|d}qWdS( s;Return a string with escape-backslashes converted to nulls.iis\iÿÿÿÿRtiN(RtstartttextRgtfoundR)Rc(R R¡RRŸ((Rt escape2nullÕs  icCsU|o|iddƒSn7x/dddgD]}di|i|ƒƒ}q+W|SdS(sw Return a string with nulls removed or restored to backslashes. Backslash-escaped spaces are also removed. Ržs\t t RN(trestore_backslashesR RR‰RcRD(R R¥R‰((RtunescapeâstWitFtNaitHtNtAcCsWt|tiƒo6d}x%|D]}|tti|ƒ7}q W|Sn t |ƒSdS(Ni( RWR ttypesRttotaltcteast_asian_widthst unicodedatateast_asian_widthRQ(R R¯R®((Rteast_asian_column_widthøsR²tDependencyListcBsAtZdZegd„Zd„Zd„Zd„Zd„ZRS(s­ List of dependencies, with file recording support. Note that the output file is not automatically closed. You have to explicitly call the close() method. cCs/|i|ƒx|D]}|i|ƒqWdS(s³ Initialize the dependency list, automatically setting the output file to `output_file` (see `set_output()`) and adding all supplied dependencies. N(Rt set_outputt output_filet dependenciestitadd(RR¶R·R¸((RRs  cCsPg|_|djoti|_n'|ot|dƒ|_n d|_dS(sH Set the output file and clear the list of already added dependencies. `output_file` must be a string. The specified file is immediately overwritten. If output_file is '-', the output will be written to stdout. If it is None, no file output is done when calling add(). t-RN(RtlistR¶RtstdouttfileRR(RR¶((RRµs   cCsI||ijo5|ii|ƒ|idj o|i|IJqEndS(s¥ If the dependency `filename` has not already been added, append it to self.list and print it to self.file if self.file is not None. N(tfilenameRR»R)R½R(RR¾((RR¹-s cCs|iiƒd|_dS(s( Close the output file. N(RR½tcloseR(R((RR¿8s cCs:|io|ii}nd}d|ii||ifS(Ns %s(%r, %s)(RR½RTR¶RRbR R»(RR¶((Rt__repr__?s ( R R RCRRRµR¹R¿RÀ(((RR´s   (+RCt __docformat__RR†tos.pathR­R$R±RRtdocutilstApplicationErrort DataErrorRvR8RR R RERFRGRHRORIRLRdRnRuRR{RƒRR–R›R6R¢R¦R°R³Ršt column_widthRQR´(%R–R°RvR6RÁROR´RR RLRnRRER{RÅR$RÄR¢RRRHRÆRƒR8R­R³R±R¦RuRFRdR›RRIRGR R†((Rt? sL      º  ! ,     <