ifn< :dZdZddlmZddlZddlZddlZddlZGddZGdde Z d Z d\d Z Gd d ee Z GddeZGddeZGddeZGddZGddZGddZGddZGddZGddZGd d!eZGd"d#ZGd$d%ZGd&d'eZGd(d)eZGd*d+eZGd,d-eZGd.d/eZGd0d1ZGd2d3Z Gd4d5eZ!Gd6d7eZ"Gd8d9Z#Gd:d;eeeZ$Gd<d=eeeZ%Gd>d?eeeZ&Gd@dAeeZ'GdBdCeeZ(GdDdEeeZ)GdFdGeeZ*GdHdIeeZ+GdJdKeeZ,GdLdMeeZ-GdNdOeeZ.GdPdQeeZ/GdRdSeeZ0GdTdUeeZ1GdVdWeeZ2GdXdYeeZ3GdZd[eeZ4Gd\d]eeZ5Gd^d_eeZ6Gd`daeeZ7GdbdceeZ8GdddeeeZ9GdfdgeeZ:GdhdieeZ;GdjdkeeZ<GdldmeeZ=GdndoeeZ>GdpdqeeZ?GdrdseeZ@GdtdueeZAGdvdweeZBGdxdyeeZCGdzd{eeZDGd|d}eeZEGd~deeZFGddeeZGGddeeZHGddeeZIGddeeZJGddeeZKGddeeZLGddeeZMGddeeZNGddeeZOGddeeZPGddeeZQGddeeZRGddeeZSGddeeZTGddeeZUGddeeZVGddeeZWGddeeZXGddeeZYGddeeZZGddeeZ[GddeeZ\GddeeZ]GddeeZ^GddeeZ_GddeeZ`GddeeZaGddeeeZbGddeeeZcGddeee ee"ZdGddeeee#e"ZeGddeeee#e"ZfGddeeZgGd„deeZhGdĄdeeZiGdƄdeeZjGdȄdeeZkGdʄdeeZlGd̄deeZmGd΄deeZnGdЄdeeZoGd҄deeZpGdԄdeeZqGdքdeeeeZrGd؄deeeZsGdڄdee eeZtGd܄de eZuGdބde eZvGdde eZwGddee e!eZxGdde e!eZyGdde e!eZzGdde eZ{Gdde eZ|Gdde eZ}Gdde eZ~Gdde eZGdde eZGdde eZGddee eZGdde eZGdde eZGdde eZdZ GddZGddeZGddeZdZdZdZdZeeGd d eZGd d eZGd deZGddeZGddeZGddeZGddeZGddeZdZejdZejdZiddddd d!d"d#d$d%d&d'd(d)d*d)d+d,d-dd.d/d0d1d2d%d3d4d5d6d7d'd8d'id9d:d;d<d=d>d?d<d@d%dAd4dBd'dCdDdEd,dFdGdHd<dIdJdKdDdLdMdNdOdPd:ZdQdRdSdTdUdVZdWZdXZdYZdZZd[ZdS(]a Docutils document tree element class library. Classes in CamelCase are abstract base classes or auxiliary classes. The one exception is `Text`, for a text (PCDATA) node; uppercase is used to differentiate from element classes. Classes in lower_case_with_underscores are element classes, matching the XML element generic identifiers in the DTD_. The position of each node (the level at which it can occur) is significant and is represented by abstract base classes (`Root`, `Structural`, `Body`, `Inline`, etc.). Certain transformations will be easier because we can use ``isinstance(node, base_class)`` to determine the position of the node in the hierarchy. .. _DTD: https://docutils.sourceforge.io/docs/ref/docutils.dtd reStructuredText)CounterNceZdZdZdZ dZ dZ dZedZ e j dZ dZ ddZ dd Z d Zd Zd Zd ZdZdZdZdZ ddZ ddZ ddZdS)Nodez0Abstract base class of nodes in a document tree.NcL |jp |jjS#t$rYdSwxYw)zJReturn the `document` root node of the tree containing this Node. N) _documentparentdocumentAttributeErrorselfs n/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/docutils/nodes.pyr z Node.document6s; >9T[%9 9   44 s  ##c||_dSN)r)r values rr z Node.document?s cdS)a Node instances are always true, even if they're empty. A node is more than a simple container. Its boolean "truth" does not depend on having one or more subnodes in the doctree. Use `len()` to check node length. Tr s r__bool__z Node.__bool__Cs trcj| ddlmcm}|}||S)z6Return a DOM **fragment** representation of this Node.Nr)xml.dom.minidomdomminidomDocument _dom_noder rdomroots rasdomz Node.asdomMsA ; ) ) ) ) ) ) ) ) ),,..~~g&&&r rct)zs Return an indented pseudo-XML representation, for test purposes. Override in subclasses. NotImplementedError)r indentlevels rpformatz Node.pformatTs "!rct)zReturn a copy of self.r!r s rcopyz Node.copy\!!rct)z3Return a deep copy of self (also copying children).r!r s rdeepcopyz Node.deepcopy`r(rct)z,Return a string representation of this Node.r!r s rastextz Node.astextdr(rc||_|jr>|j|_|j|jj|_|j|jj|_dSdSdSr)r r sourcecurrent_sourceline current_liner childs r setup_childzNode.setup_childhsZ = 8!]EN|##}; z!!]7  8 8"!rc~d}|jjd|jjz ||n$#t tf$r|cYSt$rYnwxYw|j } |ddD]}| |rd}nn#t$rYnwxYwn#t$rd}YnwxYw|S)a Traverse a tree of `Node` objects, calling the `dispatch_visit()` method of `visitor` when entering each node. (The `walkabout()` method is similar, except it also calls the `dispatch_departure()` method before exiting each node.) This tree traversal supports limited in-place tree modifications. Replacing one node with one or more nodes is OK, as is removing an element. However, if the node removed or replaced occurs after the current node, the old node will still be traversed, and any new nodes will not. Within ``visit`` methods (and ``depart`` methods for `walkabout()`), `TreePruningException` subclasses may be raised (`SkipChildren`, `SkipSiblings`, `SkipNode`, `SkipDeparture`). Parameter `visitor`: A `NodeVisitor` object, containing a ``visit`` implementation for each `Node` subclass encountered. Return true if we should stop the traversal. Fz6docutils.nodes.Node.walk calling dispatch_visit for %sNT) r reporterdebug __class____name__dispatch_visit SkipChildrenSkipNode SkipDeparturechildrenwalk SkipSiblings StopTraversal)r visitorstopr>r3s rr?z Node.walkqs+.!'' Dn% & ' ' '  &&t,,,, (+         }H %aaa[Ezz'**#        DDD  s_AB+A(B+ A(%B+'A(( B+3&BB+ B'$B+&B''B++ B:9B:cd}d}|jjd|jjz ||n#t $r|cYSt$rd}YnwxYw|j} |ddD]}| |rd}nn#t$rYnwxYwn#t$rYnt$rd}YnwxYw|rA|jjd|jjz| ||S)a Perform a tree traversal similarly to `Node.walk()` (which see), except also call the `dispatch_departure()` method before exiting each node. Parameter `visitor`: A `NodeVisitor` object, containing a ``visit`` and ``depart`` implementation for each `Node` subclass encountered. Return true if we should stop the traversal. TFz;docutils.nodes.Node.walkabout calling dispatch_visit for %sNz?docutils.nodes.Node.walkabout calling dispatch_departure for %s)r r6r7r8r9r:r<r=r> walkaboutr@r;rAdispatch_departure)r rB call_departrCr>r3s rrEzNode.walkabouts !'' In% & ' ' '  $&&t,,,,      $ $ $#  $}H %aaa[Ew//#         D   DDD   -   % + +>23 4 4 4  & &t , , , seA B( A%B( A%"B($A%% B(0&BB( B$!B(#B$$B(( C4 CCc#|Kt||r|V|jD]}||Ed{VdS)z3Return iterator that only supports instance checks.N) isinstancer> _fast_findall)r clsr3s rrJzNode._fast_findallse dC  JJJ] 0 0E**3// / / / / / / / / 0 0rc#ZK|V|jD]}|Ed{VdS)z3Return iterator that doesn't check for a condition.N)r>_superfast_findallr2s rrMzNode._superfast_findallsS  ] 2 2E//11 1 1 1 1 1 1 1 1 2 2rTFc tjdtdt||||||S)zyReturn list of nodes following `self`. For looping, Node.findall() is faster and more memory efficient. z5nodes.Node.traverse() is obsoleted by Node.findall(). stacklevel)warningswarnPendingDeprecationWarninglistfindallr condition include_selfdescendsiblingsascends rtraversez Node.traversesR  M/A ? ? ? ?DLLL'!)63344 4rc#K|rd}|rT|rR|sP||Ed{VdSt|tr||Ed{VdSt|tr|}|fd}|r| ||r|V|r9t |jr%|D]"}||ddddEd{V#|s|r|}|jr|j|} |j| |ur-|j|| dz} |j| |u-|j| dzdD]"} | |d|ddEd{V#|sdS|j}|jdSdSdS)a Return an iterator yielding nodes following `self`: * self (if `include_self` is true) * all descendants in tree traversal order (if `descend` is true) * the following siblings (if `siblings` is true) and their descendants (if also `descend` is true) * the following siblings of the parent (if `ascend` is true) and their descendants (if also `descend` is true), and so on. If `condition` is not None, the iterator yields only nodes for which ``condition(node)`` is true. If `condition` is a node class ``cls``, it is equivalent to a function consisting of ``return isinstance(node, cls)``. If `ascend` is true, assume `siblings` to be true as well. If the tree structure is modified during iteration, the result is undefined. For example, given the following tree:: <--- emphasis.traverse() and <--- strong.traverse() are called. Foo Bar Baz Then tuple(emphasis.traverse()) equals :: (, , <#text: Foo>, <#text: Bar>) and list(strong.traverse(ascend=True) equals :: [, <#text: Foo>, <#text: Bar>, , <#text: Baz>] TNc"t||Sr)rI)node node_classs rrXzNode.findall..conditions!$ 333rF)rXrYrZr[r\) rMrItyperJlenr>rVr index) r rXrYrZr[r\rar3r`resiblings rrVz Node.findallsP  H  G H  22444444444It,, --i888888888 i & & 4"J+5 4 4 4 4  Y.))D//.JJJ  Gs4=)) G G G ==96:D27)GGGGGGGGGG  'v 'D+ ' ))$//k%(44 K--dEAI>>Ek%(44#{5788466G&"+%)7!&u / 6 666666666'E;D+ ' ' ' ' ' ' 'rc r t||||||S#t$rYdSwxYw)z Return the first node in the iterator returned by findall(), or None if the iterable is empty. Parameter list is the same as of traverse. Note that `include_self` defaults to False, though. N)nextrV StopIterationrWs r next_nodezNode.next_node9s[  Y %,h@@AA A   44 s %( 66rrr)NTTFF)NFTFF)r9 __module__ __qualname____doc__r r.r0rpropertyr setterrrr%r'r*r,r4r?rErJrMr]rVrjrrrrr(s}:: FF FL DNI X__''''"""""""""""""888,,,\)))V000222CG(- 4 4 4 4BF',Q'Q'Q'Q'fEI).      rrc"eZdZdZfdZxZS) reprunicodezR Deprecated backwards compatibility stub. Use the standard `str` instead. ctjdtdtdS)Nz`nodes.reprunicode() is not required with Python 3 and will be removed in Docutils 0.21 or later.rOrP)rRrSDeprecationWarningsuper__init__)r sr8s rrvzreprunicode.__init__MsE H(Q 8 8 8 8 r)r9rlrmrnrv __classcell__)r8s@rrrrrIsBrrrc>tjdtd|S)z@ Deprecated backwards compatibility stub returning `s`. z_nodes.ensure_str() is not required with Python 3 and will be removed in Docutils 0.21 or later.rOrP)rRrSrt)rws r ensure_strrzTs/ MD$4444 HrFc|r|ddSdD]*}d||}+|S)zw Return a string with nulls removed or restored to backslashes. Backslash-escaped spaces are also removed. \)z z r|)replacejoinsplit)textrestore_backslashesrespect_whitespaceseps runescaper_sQ ||FD))). , ,C774::c??++DD rcbeZdZdZdZdZ ddZddZdZd Z d Z d Z d Z ddZ ddZddZdS)Texta Instances are terminal nodes (leaves) containing text only; no child nodes or attributes. Initialize by passing a string to the constructor. Access the raw (null-escaped) text with ``str()`` and unescaped text with ``.astext()``. z#textrNct|trtd|tjdt dt ||S)zuAssert that `data` is not an array of bytes and warn if the deprecated `rawsource` argument is used. zexpecting str data, not bytesNz_nodes.Text: initialization argument "rawsource" is ignored and will be removed in Docutils 2.0.rOrP)rIbytes TypeErrorrRrSrtstr__new__)rKdata rawsources rrz Text.__new__|se dE " " =;<< <  ML, < < < <{{3%%%rc|}t||kr|d|dz dz}d|jdt|dS)N ...<: >)rdtagnamer)r maxlenrs r shortreprzText.shortreprsJ t99v    ?V+D!\\\3t999955rc.|dS)ND)r)rr s r__repr__z Text.__repr__s~~R~(((rcF|t|Sr)createTextNoder)r rs rrzText._dom_nodes%%c$ii000rc:tt|Sr)rrr s rr,z Text.astexts8D>>"""rcF|t|Sr)r8rr s rr'z Text.copys~~c$ii(((rc*|Sr)r'r s rr*z Text.deepcopysyy{{rrrc |jjjrGzd}fd|dD}d|g|RdzSn#t $rYnwxYwzfd|D}|sdSd|dzS)Nz<#text>c3HK|]}dzzt|zVdSrbN)repr.0r0r#r$s r zText.pformat..sK<<! q)DJJ6<<<<<z Text.pformat..sDDDDDDrr~)r settingsdetailed splitlinesrr r,)r r#r$tagliness `` rr%z Text.pformats }%. 7 &u ii8<<<<<%)__T%:%:<<<yy#//$66  7     D %DDDD)A)A)C)CDDD 2yy$&&sAA A*)A*c^|t||Sr)r8rrstripr charss rrz Text.rstrip"~~cjju55666rc^|t||Sr)r8rlstriprs rrz Text.lstriprrr)rrk)r9rlrmrnrr>rrrrr,r'r*r%rrrrrrrmsGH@ & & & &6666 )))111###))) ' ' ' '&7777777777rrceZdZdZdZ dZ eezZ edzZ dZ dZ dFdZ d Z d Z d Z d ZdGd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdGdZdZdZdGdZ eZ!dFdZ"d Z#d!Z$d"Z%dHd$Z&d%Z'd&e(j)fd'Z*d(Z+d)Z,d*Z-d+Z.d,Z/dId.Z0dId/Z1d0Z2d1Z3d2Z4e4d-d3fd4Z5 dJd5Z6 dJd6Z7 dJd7Z8dKd8Z9d9Z:d:Z;d;ZdLd?Z?d@Z@dAZAdBZBdMdCZCeDdDZEeDdEZFdS)NElementaV `Element` is the superclass to all specific elements. Elements contain attributes and child nodes. They can be described as a cross between a list and a dictionary. Elements emulate dictionaries for external [#]_ attributes, indexing by attribute name (a string). To set the attribute 'att' to 'value', do:: element['att'] = 'value' .. [#] External attributes correspond to the XML element attributes. From its `Node` superclass, Element also inherits "internal" class attributes that are accessed using the standard syntax, e.g. ``element.parent``. There are two special attributes: 'ids' and 'names'. Both are lists of unique identifiers: 'ids' conform to the regular expression ``[a-z](-?[a-z0-9]+)*`` (see the make_id() function for rationale and details). 'names' serve as user-friendly interfaces to IDs; they are case- and whitespace-normalized (see the fully_normalize_name() function). Elements emulate lists for child nodes (element nodes and/or text nodes), indexing by integer. To get the first child node, use:: element[0] to iterate over the child nodes (without descending), use:: for child in element: ... Elements may be constructed using the ``+=`` operator. To add one new child node to element, do:: element += node This is equivalent to ``element.append(node)``. To add a list of multiple child nodes at once, use the same ``+=`` operator:: element += [node1, node2] This is equivalent to ``element.extend([node1, node2])``. )idsclassesnamesdupnames)backrefs)r.Nz r~cd||_ g|_ ||i|_ |jD] }g|j|< |D]?\}}|}||jvr|dd|j|<5||j|<@|j|jj |_dSdSr) rr>extend attributeslist_attributesitemslowerrr8r9)r rr>rattrs rrvzElement.__init__s"  ; H4' & &C#%DOC $**,, - -JC))++Cd***',QQQx$$',$$ < >2DLLL rcl||j}|D]R\}}t|trdd|D}||d|zS|jD]*}|| |+|S)N c36K|]}t|VdSr serial_escapervs rrz$Element._dom_node..#s, K Kqq!;!; K K K K K Krz%s) createElementrattlistrIrUr setAttributer> appendChildr)r relement attributerr3s rrzElement._dom_nodes'' 55 $  : : Iu%&& L K KU K K KKK  D5L 9 9 9 9] : :E    8 8 9 9 9 9rc d}|jD];}||z }t|dkr|dddz}n<|dr/d|jjdd|dd |d Sd|jjd |d S) Nr~<8rrr "; z": rr)r>rrdr8r9r)r rcs rrzElement.__repr__)s  A AKKMM !D4yy2~~CRCy6) = @ @&*n&=&=&=&*iiW &>&>&>&>F F @"&!8!8!8$$$? ?rc~|dr,d|jjdd|ddSd|jzS)Nrrrrz"...>z<%s...>)r8r9rrr s rrzElement.shortrepr6sS = , ,%)^%<%<%<%)YYtG}%=%=%=%=? ?t|+ +rc|jrN|dd|jD|S|S)Nr~c34K|]}t|VdSr)r)rrs rrz"Element.__str__..@s(&E&E!s1vv&E&E&E&E&E&Er)r>starttagrendtagemptytagr s r__str__zElement.__str__=sc = ##}}!ww&E&Et}&E&E&EEEE#{{}}}. .==?? "rc|t}|jg}|D]\}}||d|z t |t r"d|D}d|}nt|}||}||d|dd|zS)Nz %s="True"c.g|]}t|Srrrs rrz$Element.starttag..Os"DDD-44DDDrr=z<%s>)pseudo_quoteattrrrappendrIrUrr)r quoteattrpartsnamervaluess rrzElement.starttagEs  (I<<>> 2 2KD%} [4/000%&& #DDeDDD((E Ie$$E LLDDD%%0 1 1 1 1''rcd|jzS)Nz)rr s rrzElement.endtagWs%%rcd|D}dd|jg|RzS)Nc3,K|]\}}|d|dVdS)z=""Nr)rnrs rrz#Element.emptytag..[s3DDTQ111aaa(DDDDDDrz<%s/>r)rrr)r rs rrzElement.emptytagZsADDT\\^^DDD 4<"=*"="=>>>>rc*t|jSr)rdr>r s r__len__zElement.__len__^s4=!!!rcPt|tr ||jvS||jvSr)rIrrr>r keys r __contains__zElement.__contains__as. c3   *$/) )dm##rc*t|tr |j|St|tr |j|St|t r,|jdvs Jd|j|j|jStdNNrbcannot handle slice with stridezFelement index must be an integer, a slice, or an attribute name string rIrrintr>slicestepstartrCrrs r __getitem__zElement.__getitem__gs c3   8?3' ' S ! ! 8=% % U # # 88y(((*K(((=38!34 4788 8rct|tr||jt|<dSt|tr!||||j|<dSt|t rE|jdvs Jd|D]}||||j|j|j <dStdr) rIrrrr4r>rrrrCr)r ritemr`s r __setitem__zElement.__setitem__ss c3   8(,DOCHH % % % S ! ! 8   T " " "!%DM#    U # # 88y(((*K((( ' '  &&&&04DM#)CH, - - -788 8rct|tr |j|=dSt|tr |j|=dSt|t r)|jdvs Jd|j|j|j=dStd)NrrzMelement index must be an integer, a simple slice, or an attribute name stringrrs r __delitem__zElement.__delitem__s c3   B$$$ S ! ! B c""" U # # B8y(((*K((( ci0111ABB Brc|j|zSrr>r others r__add__zElement.__add__s}u$$rc||jzSrrrs r__radd__zElement.__radd__st}$$rct|tr||n||||S)z4Append a node or a list of nodes to `self.children`.)rIrrrrs r__iadd__zElement.__iadd__sF eT " "  KK       KK    rcT|jd|jDS)Nc6g|]}|Sr)r,rr3s rrz"Element.astext..s >>>uELLNN>>>r)child_text_separatorrr>r s rr,zElement.astexts3(-->> >>>@@ @rc|i}|jD]\}}||r|||< |Sr)rris_not_default)r attsrrs rnon_default_attributeszElement.non_default_attributessM///11 " "JC""3'' "!S  rcht|Sr)sortedrrr s rrzElement.attlists(d113399;;<<rr rs rrzElement.appends2  T"""""rc:|D]}||dSrr)r rr`s rrzElement.extends0  D KK      rct|tr2|||j||dS| ||||<dSdSr)rIrr4r>insert)r rers rr.zElement.insertsh dD ! ! %   T " " " M  - - - - -   $Du    rc6|j|Sr)r>popr is rr1z Element.pops}  ###rc:|j|dSr)r>remover*s rr5zElement.removes T"""""rrc:|j|||Sr)r>re)r rrrCs rrez Element.indexs}""4555rc |j|}n#t$rYdSwxYw|dkr|j|dz ndS)z*Return preceding sibling node or ``None``.Nrrb)r rer r2s rprevious_siblingzElement.previous_siblings^  !!$''AA   44 #$q55t{1Q3d2s  ++c4||gkr ||jvrdSdS)Nrrbrrs rrzElement.is_not_defaults& 9??sd&:::11rct|tr|j}|jD],}||||g-dS)z Update basic attributes ('ids', 'names', 'classes', 'dupnames', but not 'source') from node or dictionary `dict_`. N)rIrrbasic_attributesappend_attr_listr)r dict_rs rupdate_basic_attszElement.update_basic_attssa eT " " %$E( ; ;C  ! !#uyyb'9'9 : : : : ; ;rcZ|D]'}|||vr|||(dS)z For each element in values, if it does not exist in self[attr], append it. NOTE: Requires self[attr] and values to be sequence type and the former should specifically be a list. Nr,)r rrrs rr=zElement.append_attr_listsE ) )EDJ&&T !!%((( ) )rct||ts ||g||<t|ts|g}|||dS)a  First, convert both self[attr] and value to a non-string sequence type; if either is not already a sequence, convert it to a list of one element. Then call append_attr_list. NOTE: self[attr] and value both must not be None. N)rIrrUr=)r rrs rcoerce_append_attr_listzElement.coerce_append_attr_listsd$((4..$// &t*DJ%&& GE dE*****rTcB|s|||||<dSdS)z If self[attr] does not exist or force is True or omitted, set self[attr] to value, otherwise do nothing. Nr)r rrforces r replace_attrzElement.replace_attrs0  DHHTNN*DJJJ+*rcd|||ur|||dSdS)a If attr is an attribute of self, set self[attr] to [self[attr], value], otherwise set self[attr] to value. NOTE: replace is not used by this function and is kept only for compatibility with the other copy functions. N)rrBr rrrs rcopy_attr_convertzElement.copy_attr_converts= 88D>> & &  ( (u 5 5 5 5 5 ' &rc|||urnt||tst|tr|||dS||||dSdS)a If attr is an attribute of self and either self[attr] or value is a list, convert all non-sequence values to a sequence of 1 element and then concatenate the two sequence, setting the result to self[attr]. If both self[attr] and value are non-sequences and replace is True or self[attr] is None, replace self[attr] with value. Otherwise, do nothing. N)rrIrUrBrFrHs rcopy_attr_coercezElement.copy_attr_coerce(s 88D>> & &$((4..$// 8%&& 8,,T599999!!$w77777 ' &rc|||urnt||tr-t|tr|||dS||||dSdS)aM If attr is an attribute of self and both self[attr] and value are lists, concatenate the two sequences, setting the result to self[attr]. If either self[attr] or value are non-sequences and replace is True or self[attr] is None, replace self[attr] with value. Otherwise, do nothing. N)rrIrUr=rFrHs rcopy_attr_concatenatezElement.copy_attr_concatenate8s 88D>> & &$((4..$// 8%&& 8%%dE22222!!$w77777 ' &rcf|||ur||||dSdS)zz If replace is True or self[attr] is None, replace self[attr] with value. Otherwise, do nothing. N)rrFrHs rcopy_attr_consistentzElement.copy_attr_consistentGs? 88D>> & &   dE7 3 3 3 3 3 ' &rFct|tr|j}|r|j}n|j}||t ||D]}||||||dS)a. Updates all attributes from node or dictionary `dict_`. Appends the basic attributes ('ids', 'names', 'classes', 'dupnames', but not 'source') and then, for all other attributes in dict_, updates the same attribute in self. When attributes with the same identifier appear in both self and dict_, the two values are merged based on the value of update_fun. Generally, when replace is True, the values in self are replaced or merged with the values in dict_; otherwise, the values in self may be preserved or merged. When and_source is True, the 'source' attribute is included in the copy. NOTE: When replace is False, and self contains a 'source' attribute, 'source' is not replaced even when dict_ has a 'source' attribute, though it may still be merged into a list depending on the value of update_fun. NOTE: It is easier to call the update-specific methods then to pass the update_fun method to this function. N)rIrris_not_list_attributeis_not_known_attributer?filter)r r> update_funr and_source filter_funrs rupdate_all_attszElement.update_all_attsOs* eT " " %$E  53JJ4J u%%%*e,, 7 7C JtS%*g 6 6 6 6 7 7rcJ||tj||dS)aC Updates all attributes from node or dictionary `dict_`. Appends the basic attributes ('ids', 'names', 'classes', 'dupnames', but not 'source') and then, for all other attributes in dict_, updates the same attribute in self. When attributes with the same identifier appear in both self and dict_ and replace is True, the values in self are replaced with the values in dict_; otherwise, the values in self are preserved. When and_source is True, the 'source' attribute is included in the copy. NOTE: When replace is False, and self contains a 'source' attribute, 'source' is not replaced even when dict_ has a 'source' attribute, though it may still be merged into a list depending on the value of update_fun. N)rWrrOr r>rrUs rupdate_all_atts_consistantlyz$Element.update_all_atts_consistantlyus2$ UG$@'' ) ) ) ) )rcJ||tj||dS)a Updates all attributes from node or dictionary `dict_`. Appends the basic attributes ('ids', 'names', 'classes', 'dupnames', but not 'source') and then, for all other attributes in dict_, updates the same attribute in self. When attributes with the same identifier appear in both self and dict_ whose values aren't each lists and replace is True, the values in self are replaced with the values in dict_; if the values from self and dict_ for the given identifier are both of list type, then the two lists are concatenated and the result stored in self; otherwise, the values in self are preserved. When and_source is True, the 'source' attribute is included in the copy. NOTE: When replace is False, and self contains a 'source' attribute, 'source' is not replaced even when dict_ has a 'source' attribute, though it may still be merged into a list depending on the value of update_fun. N)rWrrMrYs rupdate_all_atts_concatenatingz%Element.update_all_atts_concatenatings2* UG$A7' ) ) ) ) )rcJ||tj||dS)a[ Updates all attributes from node or dictionary `dict_`. Appends the basic attributes ('ids', 'names', 'classes', 'dupnames', but not 'source') and then, for all other attributes in dict_, updates the same attribute in self. When attributes with the same identifier appear in both self and dict_ whose values are both not lists and replace is True, the values in self are replaced with the values in dict_; if either of the values from self and dict_ for the given identifier are of list type, then first any non-lists are converted to 1-element lists and then the two lists are concatenated and the result stored in self; otherwise, the values in self are preserved. When and_source is True, the 'source' attribute is included in the copy. NOTE: When replace is False, and self contains a 'source' attribute, 'source' is not replaced even when dict_ has a 'source' attribute, though it may still be merged into a list depending on the value of update_fun. N)rWrrKrYs rupdate_all_atts_coercionz Element.update_all_atts_coercions2, UG$rUs rupdate_all_atts_convertzElement.update_all_atts_converts5$ UG$=(2  4 4 4 4 4rcg|_dSrrr s rclearz Element.clears  rc||}t|tr|||||<dS| ||||dz<dSdS)z8Replace one child `Node` with another child or children.Nrb)rerIrr4)r oldnewres rrzElement.replacesh 3 c4  &   S ! ! !DKKK _"%DuQw   _rcH|}t|ts |d}n#t$rd}YnwxYwt|tr||n(|jD] }||rJd|d||!|j||dS)zc Replace `self` node with `new`, where `new` is a node or a list of nodes. rNzLosing "z " attribute: )rIr IndexErrorrr?r<r r)r reupdaters r replace_selfzElement.replace_selfs #t$$  Q     fg & & F  $ $T * * * *, F F9FFF69cc499EFF}F D#&&&&&s " 11ct|ts|f}t|tt ||D]#}|D]}t|||r|ccS$dS)aM Return the index of the first child whose class exactly matches. Parameters: - `childclass`: A `Node` subclass to search for, or a tuple of `Node` classes. If a tuple, any of the classes may match. - `start`: Initial index to check. - `end`: Initial index to *not* check. N)rItuplerangeminrdr childclassrendrers rfirst_child_matching_classz"Element.first_child_matching_classs*e,, '$J5#c$ii"5"566 ! !E ! !d5k1--! LLLLL! !trct|ts|f}t|tt ||D](}|D]}t|j||rn |cS)dS)aI Return the index of the first child whose class does *not* match. Parameters: - `childclass`: A `Node` subclass to skip, or a tuple of `Node` classes. If a tuple, none of the classes may match. - `start`: Initial index to check. - `end`: Initial index to *not* check. N)rIrkrlrmrdr>rns rfirst_child_not_matching_classz&Element.first_child_not_matching_classs*e,, '$J5#c$ii"5"566  E  dmE2A66E trrcz|d}fd|jD}d|g|RS)Nrc3JK|]}|dzVdSr)r%)rrr#r$s rrz"Element.pformat..s5GGAQYYvuQw//GGGGGGrr~)rr>r)r r#r$tagline childrepss `` rr%zElement.pformats[$UllDMMOOOO<GGGGGGGG ww,),,---rc|jdd|ji|j}|j|_|j|_|j|_|S)Nrr)r8rrrr.r0r objs rr'z Element.copy sBdnIIt~III [ 9 rcv|}|d|jD|S)Nc6g|]}|Sr)r*rs rrz$Element.deepcopy..)s"AAA%U^^%%AAAr)r'rr>)r r's rr*zElement.deepcopy's7yy{{ AA4=AAABBB rctjdtdd|vsJ|d|dS)z+Add a new class to the "classes" attribute.zdocutils.nodes.Element.set_class() is deprecated; and will be removed in Docutils 0.21 or later.Append to Element['classes'] list attribute directlyrOrPrrN)rRrSrtrrr rs r set_classzElement.set_class,s] M)Q 8 8 8 8$ Ytzz||,,,,,rcd|_t|di|}t|di|}|r |Jd|_|r |Jd|_dSdS)zQNote that this Element has been referenced by its name `name` or id `id`.rbexpect_referenced_by_nameexpect_referenced_by_idN) referencedgetattrr)r ridby_nameby_ids rnote_referenced_byzElement.note_referenced_by5s $ ;R@@DDTJJ7<<@@DD  ####!"G   !>>> E    ! !rc||jvS)z Returns True if and only if the given attribute is NOT one of the basic list attributes defined for all Elements. r:rKrs rrQzElement.is_not_list_attributeFs 3...rc||jvS)zj Returns True if and only if the given attribute is NOT recognized by this class. )known_attributesrs rrRzElement.is_not_known_attributeNs 3///r)r~r)r/)T)TF)FrkNN)Gr9rlrmrnr<local_attributesrrrrrvrrrrrrrrrrrrrr r r,rrrrr r"has_keyr(rrr.r1r5sysmaxsizerer8rr?r=rBrFrIrKrMrOrWrZr\r^r`rbrrirqrsr%r'r*rr classmethodrQrRrrrrrs--^?C%K ')99O'4GG+"?3333< @ @ @,,,###(((($&&&???"""$$$ 8 8 8 8 8 8 B B B%%%%%%@@@===1111'''&&&8888G    ###%%%$$$$###!" 6666333 ;;; ) ) ) + + + 6 6 6 6888 8 8 84441E $$7$7$7$7L;?05))))*<@16))))07;,1))))24444*&&&''',<=#+&@A+.;,....  ---!!!!"//[/00[000rrc eZdZdZdZ ddZdS) TextElementa An element which directly contains text. Its children are all `Text` or `Inline` subclass nodes. You can check whether an element's context is inline simply by checking whether its immediate parent is a `TextElement` instance (including subclasses). This is handy for nodes like `image` that can appear both inline and as standalone body elements. If passing children to `__init__()`, make sure to set `text` to ``''`` or some other suitable value. r~c|dkr(t|}tj|||g|Ri|dStj||g|Ri|dSNr~)rrrv)r rrr>rtextnodes rrvzTextElement.__init__is 2::DzzH  T9h + + + +) + + + + +  T9 Fx F F F: F F F F FrNr~r~)r9rlrmrnrrvrrrrrWsC  ?GGGGGGrrceZdZdZddZdS)FixedTextElementz5An element which directly contains preformatted text.r~cHtj|||g|Ri|d|jd<dS)Npreservez xml:space)rrvr)r rrr>rs rrvzFixedTextElement.__init__vs9T9dLXLLLLLL'1 $$$rNr)r9rlrmrnrvrrrrrrs.??222222rrceZdZdZdS) ResolvablerN)r9rlrmresolvedrrrrrsHHHrrceZdZdZdS) BackLinkablec<|d|dS)Nrr,)r refids r add_backrefzBackLinkable.add_backrefs! Z&&&&&rN)r9rlrmrrrrrrs#'''''rrceZdZdS)RootNr9rlrmrrrrrDrrceZdZdS)TitularNrrrrrrrrrceZdZdZdS)PreBibliographicz22377 Bc"^3??3''B(.ss (8)A+24<+@+@)A)ABF '''1,'''vtv'>??TX%%   U 2  rct|dD]9}||jvr||||||%||j|<||j|<:dS)a `self.nameids` maps names to IDs, while `self.nametypes` maps names to booleans representing hyperlink type (True==explicit, False==implicit). This method updates the mappings. The following state transition table shows how `self.nameids` items ("id") and `self.nametypes` items ("type") change with new input (a call to this method), and what actions are performed ("implicit"-type system messages are INFO/1, and "explicit"-type system messages are ERROR/3): ==== ===== ======== ======== ======= ==== ===== ===== Old State Input Action New State Notes ----------- -------- ----------------- ----------- ----- id type new type sys.msg. dupname id type ==== ===== ======== ======== ======= ==== ===== ===== - - explicit - - new True - - implicit - - new False - False explicit - - new True old False explicit implicit old new True - True explicit explicit new - True old True explicit explicit new,old - True [#]_ - False implicit implicit new - False old False implicit implicit new,old - False - True implicit implicit new - True old True implicit implicit new old True ==== ===== ======== ======== ======= ==== ===== ===== .. [#] Do not clear the name-to-id map or invalidate the old target if both old and new targets are external and refer to identical URIs. The new target is invalidated regardless. rN)rkrset_duplicate_name_idr)r r`rrexplicitrs rset_name_id_mapzdocument.set_name_id_map}ssB$w-(( 0 0Dt|##**4T7HMMMM&( T"'/t$$  0 0rc|j|}|j|}|p||j|<|r|rd}|S|j|} d|vr"|d} | drd| vr| d| krd}|dkrt| |d|j|<|j|d|z|g|} ||| z }t||ne||j|<||j|} t| |n;|)|s'd|j|<|j|} t| |t|||r|s.|.|jd|z|g|} ||| z }dSdSdSdS)NrOrefurirrbz%Duplicate explicit target name: "%s".)r base_nodez%Duplicate implicit target name: "%s".)rrrdupnamer6system_messageinfo) r r`rrrrold_id old_explicitr$old_noderrs rrzdocument.set_duplicate_name_idsd#~d+ +7xt   ,%#x/H4''!%h$W-& (H 4 4 ( 2f < <$%Eqyy$///-1 T*m22BTI TT333&sNGd####%' T"%#x/HHd+++!,!%) T"8F+$''' D$      1C-$$7$>%//C"3#"   1C1Crc||jvSr)rr~s rhas_namezdocument.has_namest|##rcd|||}||||ddS)NFrrrr targetrrs rnote_implicit_targetzdocument.note_implicit_targets8 [[ ) ) VR5AAAAArcd|||}||||ddS)NTrrrs rnote_explicit_targetzdocument.note_explicit_targets8 [[ ) ) VR4@@@@@rcn|j|dg|dSNrefname)rr"rr r`s r note_refnamezdocument.note_refnames2   i"55<>>>>rcx|j||dr||dSdS)Nr)rrrr rs rnote_indirect_targetzdocument.note_indirect_targetsI $$V,,, '? &   f % % % % % & &rc0||dSr)rrs rnote_anonymous_targetzdocument.note_anonymous_targets Frcd|||j|dSr)rrrr footnotes rnote_autofootnotezdocument.note_autofootnotes1 H !!(+++++rcd|||j|dSr)rrrr refs rnote_autofootnote_refzdocument.note_autofootnote_refs1 C %%c*****rcd|||j|dSr)rrrr#s rnote_symbol_footnotezdocument.note_symbol_footnotes1 H $$X.....rcd|||j|dSr)rrrr's rnote_symbol_footnote_refz!document.note_symbol_footnote_refs1 C !((-----rcd|||j|dSr)rrrr#s r note_footnotezdocument.note_footnotes0 H h'''''rc|||j|dg|||dSr)rrr"rrr's rnote_footnote_refzdocument.note_footnote_refY C %%c)nb99@@EEE #rc:|j|dSr)rr)r citations r note_citationzdocument.note_citations h'''''rc|||j|dg|||dSr)rrr"rrr's rnote_citation_refzdocument.note_citation_refr2rct|}||jvrC|jd|z|}|||z }|j|}t ||||j|<||jt |<dS)Nz-Duplicate substitution definition name: "%s".)r)whitespace_normalize_namerr6errorrrfully_normalize_name)r subdefdef_namerrroldnodes rnote_substitution_defzdocument.note_substitution_def s(22 4) ) )-%%EL &&((C"3,T2G GT " " "'-t$>B 4T : :;;;rc*t||d<dSr)r9)r subrefrs rnote_substitution_refzdocument.note_substitution_refs5g>>yrc<|j||dSr)r add_pending)r pendingprioritys r note_pendingzdocument.note_pendings! $$Wh77777rc:|j|dSr)rrr messages rnote_parse_messagezdocument.note_parse_message s ""7+++++rc:|j|dSr)rrrIs rnote_transform_messagezdocument.note_transform_message#s &&w/////rc>||_| ||_dS|dz|_dSr)r/r1)r r.offsets r note_sourcezdocument.note_source&s/$ > &D    & D   rcr|j|j|jfi|j}|j|_|j|_|Sr)r8rr6rr.r0rys rr'z document.copy-sCdnT]DM00#00[ 9 rc|jslt|_|ttf}|||jn|||j|jSr)rrsrmetarr.)r res rget_decorationzdocument.get_decoration4sh 4(llDO77$HHE} DO,,,, E4?333rrrr)!r9rlrmrnrvrrrrrr rrrrrr!r%r)r+r-r/r1r5r7r?rBrGrKrMrPr'rTrrrr r s ZZZx++++Z'0'0'0'0R(((T$$$BBBBAAAACCC???&&& ,,,+++///...((( ((( C C C C???8888,,,000+++rr ceZdZdS)titleNrrrrrVrVCrrrVceZdZdS)subtitleNrrrrrXrXDrrrXceZdZdS)rubricNrrrrrZrZErrrZceZdZdZdS)rSz;Container for "invisible" bibliographic data, or meta-data.NrrrrrSrSLsEEEErrSceZdZdS)docinfoNrrrrr]r]Trrr]ceZdZdS)authorNrrrrr_r_Urrr_ceZdZdS)authorsNrrrrraraVrrraceZdZdS) organizationNrrrrrcrcWrrrcceZdZdS)addressNrrrrrereXrrreceZdZdS)contactNrrrrrgrgYrrrgceZdZdS)versionNrrrrririZrrriceZdZdS)revisionNrrrrrkrk[rrrkceZdZdS)statusNrrrrrmrm\rrrmceZdZdS)dateNrrrrroro]rrroceZdZdS) copyrightNrrrrrqrq^rrrqceZdZdZdZdS)rct|jr t|jdts"|dt|jdSNr)rdr>rIheaderr.r s r get_headerzdecoration.get_headergsQ4=!! %DM!4Df)M)M % KK688 $ $ $}Qrct|jr t|jdts!|t|jdS)Nr/)rdr>rIfooterrr s r get_footerzdecoration.get_footerlsO4=!! "DM"4Ev)N)N " KK ! ! !}R  rN)r9rlrmrvryrrrrres2   !!!!!rrceZdZdS)ruNrrrrrururrrruceZdZdS)rxNrrrrrxrxsrrrxceZdZdS)sectionNrrrrr}r}zrrr}ceZdZdZdS)topica Topics are terminal, "leaf" mini-sections, like block quotes with titles, or textual figures. A topic is just like a section, except that it has no subsections, and it doesn't have to conform to section placement rules. Topics are allowed wherever body elements (list, table, etc.) are allowed, but only at the top level of a section or document. Topics cannot nest inside topics, sidebars, or body elements; you can't have a topic inside a table, list, block quote, etc. Nrrrrrr}s    rrceZdZdZdS)sidebara Sidebars are like miniature, parallel documents that occur inside other documents, providing related or reference material. A sidebar is typically offset by a border and "floats" to the side of the page; the document's main text may flow around it. Sidebars can also be likened to super-footnotes; their content is outside of the flow of the document's main text. Sidebars are allowed wherever body elements (list, table, etc.) are allowed, but only at the top level of a section or document. Sidebars cannot nest inside sidebars, topics, or body elements; you can't have a sidebar inside a table, list, block quote, etc. Nrrrrrrs    rrceZdZdS) transitionNrrrrrrrrrceZdZdS) paragraphNrrrrrrrrrceZdZdS)compoundNrrrrrrrrrceZdZdS) containerNrrrrrrrrrceZdZdS) bullet_listNrrrrrrrrrceZdZdS)enumerated_listNrrrrrrrrrceZdZdS) list_itemNrrrrrrrrrceZdZdS)definition_listNrrrrrrrrrceZdZdS)definition_list_itemNrrrrrrrrrceZdZdS)termNrrrrrrrrrceZdZdS) classifierNrrrrrrrrrceZdZdS) definitionNrrrrrrrrrceZdZdS) field_listNrrrrrrrrrceZdZdS)fieldNrrrrrrrrrceZdZdS) field_nameNrrrrrrrrrceZdZdS) field_bodyNrrrrrrrrrceZdZdZdS)optionr~Nr9rlrmrrrrrrsrrceZdZdZdS)option_argumentcd|ddt|zS)N delimiterr)rrr,r s rr,zoption_argument.astexts)xx S))K,>,>t,D,DDDrNr9rlrmr,rrrrrs(EEEEErrceZdZdZdS) option_groupz, NrrrrrrrrceZdZdS) option_listNrrrrrrrrrceZdZdZdS)option_list_itemz NrrrrrrrrrceZdZdS) option_stringNrrrrrrrrrceZdZdS) descriptionNrrrrrrrrrceZdZdS) literal_blockNrrrrrrrrrceZdZdS) doctest_blockNrrrrrrrrrceZdZdS) math_blockNrrrrrrrrrceZdZdS) line_blockNrrrrrrrrrceZdZdZdS)r0N)r9rlrmr#rrrr0r0s FFFrr0ceZdZdS) block_quoteNrrrrrrrrrceZdZdS) attributionNrrrrrrrrrceZdZdS) attentionNrrrrrrrrrceZdZdS)cautionNrrrrrrrrrceZdZdS)dangerNrrrrrrrrrceZdZdS)r:Nrrrrr:r:rrr:ceZdZdS) importantNrrrrrrrrrceZdZdS)noteNrrrrrrrrrceZdZdS)tipNrrrrrrrrrceZdZdS)hintNrrrrrrrrrceZdZdS)warningNrrrrrrrrrceZdZdS) admonitionNrrrrrrrrrceZdZdS)commentNrrrrrrrrrceZdZdS)substitution_definitionNrrrrrrrrrceZdZdS)rNrrrrrrrrrceZdZdS)r$Nrrrrr$r$rrr$ceZdZdS)r4Nrrrrr4r4rrr4ceZdZdS)labelNrrrrrrrrrceZdZdS)figureNrrrrrrrrrceZdZdS)captionNrrrrrrrrrceZdZdS)legendNrrrrrrrrrceZdZdS)tableNrrrrrrrrrceZdZdS)tgroupNrrrrrrrrrceZdZdS)colspecNrrrrrrrrrceZdZdS)theadNrrrrrrrrrceZdZdS)tbodyNrrrrrrrrrceZdZdS)rowNrrrrrrrrrceZdZdS)entryNrrrrrrrrrc eZdZdZddZdZdS)rz System message element. Do not instantiate this class directly; use ``document.reporter.info/warning/error/severe()`` instead. Nc|dd}|rtd|}|f|z} tj||g|Ri|dS#t d|xYw)Nrr~zsystem_message: children=)r1rrrvprint)r rJr>rrps rrvzsystem_message.__init__sNN;33  '"g&&AthH   T9 Fx F F F: F F F F F  E88= > > > s AAc |dd}|dd|d|dd|dd t| S) Nr0r~r.:z: (rc/r$z) )rrr,)r r0s rr,zsystem_message.astext sXxx##&*8nnndddDLLL&*7mmmW^^D5I5I5IK Krr)r9rlrmrnrvr,rrrrrsF    KKKKKrrc,eZdZdZ d dZd dZdZdS) rEaF The "pending" element is used to encapsulate a pending operation: the operation (transform), the point at which to apply it, and any data it requires. Only the pending operation's location within the document is stored in the public document tree (by the "pending" object itself); the operation and its data are stored in the "pending" object's internal instance attributes. For example, say you want a table of contents in your reStructuredText document. The easiest way to specify where to put it is from within the document, with a directive:: .. contents:: But the "contents" directive can't do its work until the entire document has been parsed and possibly transformed to some extent. So the directive code leaves a placeholder behind that will trigger the second phase of its processing, something like this:: + internal attributes Use `document.note_pending()` so that the `docutils.transforms.Transformer` stage of processing can run all pending transforms. Nr~cTtj||g|Ri|||_ |pi|_dSr)rrv transformdetails)r rrrr>rs rrvzpending.__init__-sDyB8BBBzBBB" }" IIrrrcrdd|jjd|jjdg}t|j}|D].\}}t |tr_|dd|d| d| Dz|rt |trt |d tre|dd|d|D]E}| d | DF|dd|d |0t |dfd |DzS) Nz.. internal attributes:z .transform: .z .details:r~z>7rcg|] }dd| Sr~z>9rrr0s rrz#pending.pformat..As9"L"L"L&*.0RR"6"L"L"Lrrcg|] }dd| Srrrs rrz#pending.pformat..Hs9&L&L&L*.24TT&:&L&L&Lrrc3.K|]}dz|dVdS)rrNrrs rrz"pending.pformat..MsH11"d,2E>>444@111111r)rrlr9rrrrIrrrr%rrUrr)r r#r$ internalsrrrrs `` rr%zpending.pformat8s5..151J1J1J151H1HJ%' ++--..! A AJC%&& A  RRR!5666  "L"L.3mmoo.H.H.J.J"L"L"LMMMM A -- A q400 A  RRR!5666MMA$$&L&L23))++2H2H2J2J&L&L&LMMMMM  CCC!?@@@@fe44''11111&/111111 2rc|j|j|j|jfi|j}|j|_|j|_|j|_|Sr)r8rrrrrr.r0rys rr'z pending.copyPsPdnT^T\4>00#00 [ 9 rrrk)r9rlrmrnrvr%r'rrrrErEsa4+/ J J J J22220rrEceZdZdZdS)rawz@ Raw data that is to be passed untouched to the Writer. NrrrrrrYsrrceZdZdS)emphasisNrrrrr r drrr ceZdZdS)strongNrrrrr r errr ceZdZdS)literalNrrrrr r frrr ceZdZdS) referenceNrrrrrrgrrrceZdZdS)footnote_referenceNrrrrrrhrrrceZdZdS)citation_referenceNrrrrrrirrrceZdZdS)substitution_referenceNrrrrrrjrrrceZdZdS)title_referenceNrrrrrrkrrrceZdZdS) abbreviationNrrrrrrlrrrceZdZdS)acronymNrrrrrrmrrrceZdZdS) superscriptNrrrrrrnrrrceZdZdS) subscriptNrrrrrrorrrceZdZdS)mathNrrrrr!r!prrr!ceZdZdZdS)imagec.|ddS)Naltr~rDr s rr,z image.astextusxxr"""rNrrrrr#r#ss######rr#ceZdZdS)inlineNrrrrr'r'yrrr'ceZdZdS) problematicNrrrrr)r)zrrr)ceZdZdS) generatedNrrrrr+r+{rrr+aA Text abbreviation acronym address admonition attention attribution author authors block_quote bullet_list caption caution citation citation_reference classifier colspec comment compound contact container copyright danger date decoration definition definition_list definition_list_item description docinfo doctest_block document emphasis entry enumerated_list error field field_body field_list field_name figure footer footnote footnote_reference generated header hint image important inline label legend line line_block list_item literal literal_block math math_block meta note option option_argument option_group option_list option_list_item option_string organization paragraph pending problematic raw reference revision row rubric section sidebar status strong subscript substitution_definition substitution_reference subtitle superscript system_message table target tbody term tgroup thead tip title title_reference topic transition version warningc6eZdZdZdZ dZdZdZdZdZ dS) NodeVisitora "Visitor" pattern [GoF95]_ abstract superclass implementation for document tree traversals. Each node class has corresponding methods, doing nothing by default; override individual methods for specific and useful behaviour. The `dispatch_visit()` method is called by `Node.walk()` upon entering a node. `Node.walkabout()` also calls the `dispatch_departure()` method before exiting a node. The dispatch methods call "``visit_`` + node class name" or "``depart_`` + node class name", resp. This is a base class for visitors whose ``visit_...`` & ``depart_...`` methods must be implemented for *all* compulsory node types encountered (such as for `docutils.writers.Writer` subclasses). Unimplemented methods will raise exceptions (except for optional nodes). For sparse traversals, where only certain node types are of interest, use subclass `SparseNodeVisitor` instead. When (mostly or entirely) uniform processing is desired, subclass `GenericNodeVisitor`. .. [GoF95] Gamma, Helm, Johnson, Vlissides. *Design Patterns: Elements of Reusable Object-Oriented Software*. Addison-Wesley, Reading, MA, USA, 1995. )rSc||_dSr)r r r s rrvzNodeVisitor.__init__s   rc|jj}t|d|z|j}|jjd|jd|||S)z Call self."``visit_`` + node class name" with `node` as parameter. If the ``visit_...`` method does not exist, call self.unknown_visit. visit_z2docutils.nodes.NodeVisitor.dispatch_visit calling  for )r8r9r unknown_visitr r6r7r r` node_namemethods rr:zNodeVisitor.dispatch_visitsi N+ x)3T5GHH $$$  + , , ,vd||rc|jj}t|d|z|j}|jjd|jd|||S)z Call self."``depart_`` + node class name" with `node` as parameter. If the ``depart_...`` method does not exist, call self.unknown_departure. depart_z6docutils.nodes.NodeVisitor.dispatch_departure calling r2)r8r9runknown_departurer r6r7r4s rrFzNodeVisitor.dispatch_departuresi N+ y94d6LMM $$$  + , , ,vd||rc|jjjs|jj|jvr#t |jd|jjdS)zk Called when entering unknown `Node` types. Raise an exception unless overridden. z visiting unknown node type: Nr rstrict_visitorr8r9optionalr"rs rr3zNodeVisitor.unknown_visitX M " 1 =~&dm;;%>>>4>#:#:<== =<;rc|jjjs|jj|jvr#t |jd|jjdS)zi Called before exiting unknown `Node` types. Raise exception unless overridden. z departing unknown node type: Nr;rs rr9zNodeVisitor.unknown_departurer>rN) r9rlrmrnr=rvr:rFr3r9rrrr-r-su6H!!!       = = = = = = = =rr-ceZdZdZdS)SparseNodeVisitora Base class for sparse traversals, where only certain node types are of interest. When ``visit_...`` & ``depart_...`` methods should be implemented for *all* node types (such as for `docutils.writers.Writer` subclasses), subclass `NodeVisitor` instead. NrrrrrArAsrrAceZdZdZdZdZdS)GenericNodeVisitora Generic "Visitor" abstract superclass, for simple traversals. Unless overridden, each ``visit_...`` method calls `default_visit()`, and each ``depart_...`` method (when using `Node.walkabout()`) calls `default_departure()`. `default_visit()` (and `default_departure()`) must be overridden in subclasses. Define fully generic visitors by overriding `default_visit()` (and `default_departure()`) only. Define semi-generic visitors by overriding individual ``visit_...()`` (and ``depart_...()``) methods also. `NodeVisitor.unknown_visit()` (`NodeVisitor.unknown_departure()`) should be overridden for default behavior. ctz)Override for generic, uniform traversals.r!rs r default_visitz GenericNodeVisitor.default_visitr(rctrEr!rs rdefault_departurez$GenericNodeVisitor.default_departurer(rN)r9rlrmrnrFrHrrrrCrCs< """"""""rrCc0||dSr)rFrs r_call_default_visitrJ#strc0||dSr)rHrs r_call_default_departurerL's4     rcdSrrrs r_noprN+sDrc|D]z}ttd|ztttd|ztttd|zt ttd|zt {dS)z%Save typing with dynamic assignments:r1r8N)setattrrCrJrLrArN)r_names r_add_node_class_namesrR/s<<"Hu$46IJJJ"I$57NOOO!8e#3T:::!9u#4d;;;; <r)FF)rn __docformat__ collectionsrrerrRrnrrrrrzrrrrrrrrrrrrrrrrrrrrrrrrr rVrXrZrSr]r_rarcrergrirkrmrorqrrurxr}rrrrrrrrrrrrrrrrrrrrrrrrrrrrrr0rrrrrr:rrrrrrrrrr$r4rrrrrrrrrrrrrErr r r rrrrrrrrrr!r#r'r)r+rnode_class_namesr-rArCrJrLrNrRrT Exceptionr]r;r@r<r=rerArcompilerrrtrmrlrr;r9rrrrrrs4 "#  ^^^^^^^^B #       G7G7G7G7G74G7G7G7T] 0] 0] 0] 0] 0d] 0] 0] 0@GGGGG'GGG622222{222 ''''''''                GGGGGGGG             !                        d   *****d***99999 999                     *   1111111133333333bbbbbtZbbbR :9999G%{999<<<<