jf zdZdZddlmZddlmZGddeZGddeZGd d eZd S) z Miscellaneous transforms. reStructuredText)nodes) TransformceZdZdZdZdZdS)CallBacka Inserts a callback into a document. The callback is called when the transform is applied, which is determined by its priority. For use with `nodes.pending` elements. Requires a ``details['callback']`` entry, a bound method or function which takes one parameter: the pending node. Other data can be stored in the ``details`` attribute or in the object hosting the callback method. ict|j}|jd||j|dS)Ncallback) startnodedetailsparentremove)selfpendings x/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/docutils/transforms/misc.pyapplyzCallBack.applys<.# #G,,,g&&&&&N__name__ __module__ __qualname____doc__default_priorityrrrrrs5'''''rrceZdZdZdZdZdS)ClassAttributez| Move the "class" attribute specified in the "pending" node into the immediately following non-comment element. cb|j}|j}|}|rt||dzt |D]v}||}t |t jst |t jr?|dxx|j dz cc<|j |dS|}|j}||j j d|j dzt j|j|j|j}||dS)Nclassesclassz,No suitable element following "%s" directive directiveline)r r rangeindexlen isinstancer Invisiblesystem_messager r documentreportererror literal_block rawsourcer# replace_self)rrr childr%elementr,s rrzClassAttribute.apply,sD. 'v||E22Q6F DD ' ' -w88!'5+?@@ """gog&>>"""%%g... ' &,, :ok* +   173D E E - U#####rNrrrrrr#s5 $$$$$rrc"eZdZdZdZdZdZdS) Transitionsa Move transitions at the end of sections up the tree. Complain on transitions after a title, at the beginning or end of the document, and after another transition. For example, transform this::
...
... into this::
...
... i>c~|jtjD]}||dS)N)r*findallr transitionvisit_transition)rnodes rrzTransitions.apply`sEM))%*:;; ( (D  ! !$ ' ' ' ' ( (rc|j|}d}|dksVt|jdtjr|dks+t|jdtjrs|dkrmt|jtjs!t|jtjsJ|jj d|j |j }nTt|j|dz tj r,|jj d|j |j }|r |j |||dz }|t|jksJ|t|jdz krdS|}|t|jdz kr|j}|j^|jj d|j }|j |j|dz|dS|j|}|t|jdz k|j||j |dz|dS) Nrrz4Document or section may not begin with a transition.)sourcer#zZAt least one body element must separate transitions; adjacent transitions are not allowed.z'Document may not end with a transition.r")r r%r'rtitlesubtitler*sectionr+r,r;r#r6insertr&r )rr8r%r,siblings rr7zTransitions.visit_transitiondsx !!$'' QJJ$+a.%+66 !t{1~u~>>aZZt{EN;; ?!$+u}== ? ?>M*00F{144EE EAI.0@ A A 4M*008{144E   K  ue , , , QJEs4;'''''' C $$q( ( ( Fs7>**Q...nG~% .44=5$$ ""4;#4#4T#:#:Q#>FFFN((11Es7>**Q... 4   eai.....rN)rrrrrrr7rrrr3r3FsD,(((,/,/,/,/,/rr3N) r __docformat__docutilsrdocutils.transformsrrrr3rrrrDs # ))))))'''''y'''( $ $ $ $ $Y $ $ $FJ/J/J/J/J/)J/J/J/J/J/r