m๒ ไภ#Oc@sึdZdZdkZdkZdkZdklZlZl Z l Z dk l Z dk lZdklZdklZdefd „ƒYZd efd „ƒYZd efd „ƒYZdefd„ƒYZdS(s Directives for table elements. treStructuredTextN(siosnodess statemachinesutils(s SafeString(sSystemMessagePropagation(s Directive(s directivestTablecBsktZdZdZeZhdei<deitZdZdZdZeZeZdZe i Z d„Z RS(s&CSV dialect for `csv_table` directive.t,t"s cCsฃd|jot|dƒ|_nd|jo t|_nd|jot|dƒ|_nd|jo t|_t|dƒ|_nt i i |ƒdS(NRPRQRRRS( RtstrRt delimitertFalsetskipinitialspacet quotechart doublequotet escapechartcsvtDialectt__init__(RR((RR`ชs      ( R2R3R4RXR[R6R\RZtlineterminatorR^t QUOTE_MINIMALtquotingR`(((RRTŸs  RcBs;tZdZdZdZdZeZeZ dZ e i Z RS(s0CSV dialect to use for the "header" option data.RURVs\s (R2R3R4RXR[R]RYR\R6RZRaR^RbRc(((RRทs cCsdS(N((R((Rtcheck_requirementsรscCspyp|iiii oed|ijpd|ijoE|iiid|i t i |i |i ƒd|i ƒ}|gSn|iƒ|iƒ\}}|iƒ\}}|iƒ\} } |i||i|iƒ|ƒ\}} t| | ƒ} |iiddƒ} |iiddƒ}|i || |ƒ| i!|| ƒ|| }|i#| ƒ}|i%| | |fƒWnt&j o}|i(dgSn`t)i*j oP}|iii+d|i |ft i |i |i ƒd|i ƒ}|gSnX|| |f}|ii-||i.|ƒ} | d c|iid gƒ7<|i0| ƒ|o| i1d|ƒn| g|S( NRMRNs9File and URL access deactivated; ignoring "%s" directive.Rs header-rowsis stub-columnss)Error with CSV data in "%s" directive: %sR>R(2RRtdocumenttsettingstfile_insertion_enabledRRR"R@RR R$R%R RdRRR t get_csv_datatcsv_dataRRRRRRTRR,tmaxRHR!R(R)Rt table_bodyR-R+R1R&tdetailtargsR^tErrorR#RFt build_tableRDRGRIRJ(RR(R@RFRiRRRlRkRGR,RRR!R+R RR#((RRKฦsF4  '     c Csค|iid|iiiiƒ}|io‰d|ijpd|ijoJ|i i i d|i t i|i|iƒd|iƒ}t|ƒ‚n|iidƒ}|i} n็d|ijoˆd|ijoJ|i i i d|i t i|i|iƒd|iƒ}t|ƒ‚ntiitii|iiiƒƒ}tiitii||idƒƒ}tid |ƒ}y_|iiiii |ƒt!i"d|d|d |iiii#d d ƒ}|i%ƒi&ƒ} Wqšt'j o[}|i i i(d |i t)|ƒft i|i|iƒd|iƒ}t|ƒ‚qšXnOd|ijo๘d k*}|id}y|i+|ƒi%ƒ}Wn€|i-t't.t/fj oe}|i i i(d |i |idt)|ƒft i|i|iƒd|iƒ}t|ƒ‚nXt!i0d|d|d|d |iiii#ƒ}|i%ƒi&ƒ} nG|i i i1d|i t i|i|iƒd|iƒ}t|ƒ‚| |fS(sr Get CSV data from the directive content, from an external file, or from a URL reference. RORMRNsF"%s" directive may not both specify an external file and have content.RisXThe "file" and "url" options may not be simultaneously specified for the "%s" directive.t source_patht error_handlerthandle_io_errorsu&Problems with "%s" directive path: %s.Ns*Problems with "%s" directive URL "%s": %s.Rs3The "%s" directive requires content; none supplied.(2RRRHRReRftinput_encodingROR?RR"R#RR R$R%R R&RRitostpathtdirnametabspathtcurrent_sourcet source_dirtnormpathtjointutilst relative_pathRtrecord_dependenciestaddtiot FileInputtinput_encoding_error_handlertcsv_filetreadt splitlinestIOErrortseveret SafeStringturllib2turlopentcsv_texttURLErrortOSErrort ValueErrort StringInputR@( RRORƒR‰R‹RyRR‡R#Ri((RRh๐sb!   ' "  , icCs |idƒS(Nsutf-8(tstdecode(R((Rtdecode_from_csv=scCs |idƒS(Nsutf-8(Rtencode(R((Rtencode_for_csv?scCs|S(N(R(R((RR’BscCs|S(N(R(R((RR”Dsc Csเtig}|D]} ||i| dƒq~d|ƒ}g}d} xŠ|D]‚}g} xQ|D]I}|i|ƒ} dddti| iƒd|ƒf} | i| ƒqcW|i| ƒt| t|ƒƒ} qPW|| fS(Ns tdialectiR(R^treadert_[1]RiRRR”R•t csv_readerRR,R'trow_datatcellR’t cell_textt statemachinet StringListR…Rt cell_datatappendRjR (RRiR•RR'RR˜RšR—R™R›R,RRž((RRIs1 ' (i(R2R3R8tnonnegative_intR:tpositive_int_listRuturiROR9t$single_char_or_whitespace_or_unicodetflagtsingle_char_or_unicodeR;R^R_RTRRdRKRhtsyst version_infoR’R”t staticmethodR(((RRL‹sข  * K      t ListTablecBsktZdZhdei<dei<dei<dei<deiR('RR?RR"R#RR R$R%R RRR RARBRRCRDtcheck_list_contenttnum_colsR+R—trow_listt_[2]titemtchildrent table_dataRRHR!R(R)R&RlRmtbuild_table_from_listRGRIRJ(RRBRR(RฌR RlRGR—RฐRซRฎR#R+RญR!((RRKks.   G   cCsิt|ƒdjpt|dtiƒ oJ|iiid|i ti |i |i ƒd|i ƒ}t |ƒ‚n|d}x9tt|ƒƒD]%}||}t|ƒdjpt|dtiƒ oT|iiid|i |dfti |i |i ƒd|i ƒ}t |ƒ‚q’|ot|dƒ|jod|iiid|i |dt|dƒ|fti |i |i ƒd|i ƒ}t |ƒ‚qทq’t|dƒ}q’W|i|ƒ}||fS(NiisUError parsing content block for the "%s" directive: exactly one bullet list expected.Rs‹Error parsing content block for the "%s" directive: two-level bullet list expected, but row %s does not contain a second-level bullet list.sฅError parsing content block for the "%s" directive: uniform two-level bullet list expected, but row %s does not contain the same number of items as row 1 (%s vs %s).(R RBRER t bullet_listRRR"R#RR$R%R R&t list_nodetranget item_indexRฎRซR-R+(RRBRซRฎRตRณR#R+((RRช†s.+  + 0cCs;tiƒ} tidt|ƒƒ}| |7} xL|D]D}tid|ƒ}|od|id<|d8}n||7}q5Wg} xX|D]P}ti ƒ}x.|D]&} tiƒ} | | 7} || 7}qฃW| i|ƒqŠW|o+tiƒ}|i| | ƒ||7}ntiƒ} | i| |ƒ|| 7}| S(Ntcolstcolwidthitstub(R RFttgroupR R+t col_widthtcolspecR(t attributesRRฐR'trow_nodeRštentryRŸR!ttheadRttbody(RRฐR+R!R(RบRนRปRฝRภRšRRพRFRฟR'((RRฑญs8         ( R2R3R4R8R RกR9R:R;RKRชRฑ(((RRฉ]s B  '(R4t __docformat__Rฆtos.pathRtR^tdocutilsR€R RœR|tdocutils.error_reportingRˆtdocutils.utilsR&tdocutils.parsers.rstt DirectiveR8RR=RLRฉ(RวRœRLR|RฉRมRฆR=R8R€RR&R R^RtRˆ((Rt?s       Zา