Files
ServerSync/lib/markdown_it/__pycache__/tree.cpython-314.pyc

101 lines
20 KiB
Plaintext
Raw Normal View History

2026-02-12 02:28:23 +02:00
+
<00> <0C>ig+<00><01><><00>Rt^RIHt^RIHtHt^RIt^RIHtH t H
t
H t ^RI H t !RR] 4t]
!RR R
7t!R R 4tR#) zyA tree representation of a linear markdown-it token stream.
This module is not part of upstream JavaScript markdown-it.
)<01> annotations)<02> Generator<6F>SequenceN)<04>Any<6E>
NamedTuple<EFBFBD>TypeVar<61>overload)<01>Tokenc<01>,<00>]tRt^t$R]R&R]R&RtR#)<06> _NesterTokensr <00>opening<6E>closing<6E>N)<06>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__firstlineno__<5F>__annotations__<5F>__static_attributes__r<00><00>7/tmp/pip-target-qd_sq_1j/lib/python/markdown_it/tree.pyr r s <00><00> <12>N<EFBFBD> <12>Nrr <00> _NodeType<70>SyntaxTreeNode)<01>boundc<01><><00>]tRt^tRtRKRR/RRllltRRlt]RR l4t]R
R l4tR R ltRRlt ]
RRl4t ] PRRl4t ]
RRl4t ] PRRl4t ]
RRl4t]
RRl4t]
RRl4t]
RRl4t]
R R!l4t]
R"R#l4tR$R%ltR&R'ltR(^R)R*R+^/R,R-lltR.R/R/R0lltR1R2lt]
R3R4l4t]
R5R6l4tR7R8lt]
R9R:l4t]
R;R<l4t]
R=R>l4t]
R?R@l4t]
RARBl4t ]
RCRDl4t!]
RERFl4t"]
RGRHl4t#RIt$RJ#)LraEA Markdown syntax tree node.
A class that can be used to construct a tree representation of a linear
`markdown-it-py` token stream.
Each node in the tree represents either:
- root of the Markdown document
- a single unnested `Token`
- a `Token` "_open" and "_close" token pair, and the tokens nested in
between
<EFBFBD> create_rootTc<01>$<00>V^8<>dQhRRRRRR/#)<07><00>tokens<6E>Sequence[Token]r<00>bool<6F>return<72>Noner)<01>formats"r<00> __annotate__<5F>SyntaxTreeNode.__annotate__$s$<00><00>(9<>(9<>%<25>(9<><@<40>(9<> <0A>(9rc <0A><><00>RVnRVnRVn.VnV'dVP V4R#V'g \ R4h\ V4^8Xd^V^,pVP'd \ R4hW0nVP'dVP VP4R#R#\V^,VR,4VnVP V^R4R#)zsInitialize a `SyntaxTreeNode` from a token stream.
If `create_root` is True, create a root node for the document.
NzGCan only create root from empty token sequence. Set `create_root=True`.z;Unequal nesting level at the start and end of token stream.<2E><><EFBFBD><EFBFBD><EFBFBD>)
<EFBFBD>token<65> nester_tokens<6E>_parent<6E> _children<65>_set_children_from_tokens<6E>
ValueError<EFBFBD>len<65>nesting<6E>childrenr )<04>selfrr<00> inline_tokens&&$ r<00>__init__<5F>SyntaxTreeNode.__init__$s<><00><00>$(<28><04>
<EFBFBD>48<34><04><1A>!<21><04> <0C>%'<27><04><0E> <16> <10> *<2A> *<2A>6<EFBFBD> 2<> <12><15><1C>+<2B><0E> <0E><11><16>[<5B>A<EFBFBD> <1D>!<21>!<21>9<EFBFBD>L<EFBFBD><1B>#<23>#<23>#<23> <20>Q<><12><12>&<26>J<EFBFBD><1B>$<24>$<24>$<24><14>.<2E>.<2E>|<7C>/D<>/D<>E<>%<25>"/<2F>v<EFBFBD>a<EFBFBD>y<EFBFBD>&<26><12>*<2A>!E<>D<EFBFBD> <1E> <10> *<2A> *<2A>6<EFBFBD>!<21>B<EFBFBD><<3C> 8rc<01><00>V^8<>dQhRR/#<00>rr!<00>strr)r#s"rr$r%Ns<00><00>5<>5<>#<23>5rc <09>L<00>\V4P RVP R2#)<02>(<28>))<02>typer<00>r1s&r<00>__repr__<5F>SyntaxTreeNode.__repr__Ns$<00><00><16>t<EFBFBD>*<2A>%<25>%<25>&<26>a<EFBFBD><04> <09> <09>{<7B>!<21>4<>4rc<01>$<00>V^8<>dQhRRRRRR/#)rr1r<00>item<65>intr!r)r#s"rr$r%Rs<00><00>A<>A<>)<29>A<>3<EFBFBD>A<>9<EFBFBD>Arc <09><00>R#<00>Nr<00>r1r@s&&r<00> __getitem__<5F>SyntaxTreeNode.__getitem__Qs<00><00>>Arc<01>$<00>V^8<>dQhRRRRRR/#)rr1rr@<00>slicer!<00>list[_NodeType]r)r#s"rr$r%Us<00><00>I<>I<>)<29>I<>5<EFBFBD>I<>_<EFBFBD>Irc <09><00>R#rCrrDs&&rrErFTs<00><00>FIrc<01>$<00>V^8<>dQhRRRRRR/#)rr1rr@z int | slicer!z_NodeType | list[_NodeType]r)r#s"rr$r%Ws"<00><00>#<23>#<23>)<29>#<23>;<3B>#<23>;V<>#rc <09>(<00>VPV,#rC)r0rDs&&rrErFWs<00><00><13>}<7D>}<7D>T<EFBFBD>"<22>"rc<01> <00>V^8<>dQhRRRR/#)rr1rr!<00> list[Token]r)r#s"rr$r%Zs<00><00><16><16> <09><16>k<EFBFBD>rc <0A>.a<02>RV3Rllo.pS!W4V#)z Recover the linear token stream.c<01>$<00>V^8<>dQhRRRRRR/#)r<00>noder<00>
token_listrNr!r"r)r#s"rr$<00>.SyntaxTreeNode.to_tokens.<locals>.__annotate__]s"<00><00> ><3E> ><3E>9<EFBFBD> ><3E>+<2B> ><3E>RV<52> >rc<01><><<01>VPR8XdVPF pS!W!4K R#VP'dVPVP4R#VP'gQhVPVPP
4VPF pS!W!4K VPVPP 4R#)<02>rootN)r;r0r(<00>appendr)r r )rQrR<00>child<6C>recursive_collect_tokenss&& <20>rrX<00>:SyntaxTreeNode.to_tokens.<locals>.recursive_collect_tokens]s<><00><><00><13>y<EFBFBD>y<EFBFBD>F<EFBFBD>"<22>!<21>]<5D>]<5D>E<EFBFBD>,<2C>U<EFBFBD>?<3F>+<2B><15><1A><1A><1A><1A>!<21>!<21>$<24>*<2A>*<2A>-<2D><1B>)<29>)<29>)<29>)<29>)<29><1A>!<21>!<21>$<24>"4<>"4<>"<<3C>"<<3C>=<3D>!<21>]<5D>]<5D>E<EFBFBD>,<2C>U<EFBFBD>?<3F>+<2B><1A>!<21>!<21>$<24>"4<>"4<>"<<3C>"<<3C>=rr)r1rrXs& @r<00> to_tokens<6E>SyntaxTreeNode.to_tokensZs!<00><><00> ><3E> ><3E>!<21><06> <20><14>.<2E><15> rc<01> <00>V^8<>dQhRRRR/#)rr1rr!rIr)r#s"rr$r%os<00><00><1E><1E>y<EFBFBD><1E>_<EFBFBD>rc <09><00>VP#rC<00>r+r<s&rr0<00>SyntaxTreeNode.childrenns <00><00><13>~<7E>~<7E>rc<01>$<00>V^8<>dQhRRRRRR/#)rr1r<00>valuerIr!r"r)r#s"rr$r%ss!<00><00><1F><1F>y<EFBFBD><1F><1F><1F>T<EFBFBD>rc <09><00>WnR#rCr^<00>r1ras&&rr0r_rs<00><00><1E>rc<01> <00>V^8<>dQhRRRR/#<00>rr1rr!<00>_NodeType | Noner)r#s"rr$r%ws<00><00><1C><1C>Y<EFBFBD><1C>#3<>rc <09><00>VP#rC<00>r*r<s&r<00>parent<6E>SyntaxTreeNode.parentvs <00><00><13>|<7C>|<7C>rc<01>$<00>V^8<>dQhRRRRRR/#)rr1rrarfr!r"r)r#s"rr$r%{s"<00><00><1D><1D>Y<EFBFBD><1D>'7<><1D>D<EFBFBD>rc <09><00>WnR#rCrhrcs&&rrirjzs<00><00><1C> rc<01><00>V^8<>dQhRR/#<00>rr!r r)r#s"rr$r%s<00><00>6<>6<><14>6rc <0A>L<00>VP;'g VP'*#)z Is the node a special root node?)r(r)r<s&r<00>is_root<6F>SyntaxTreeNode.is_root~s<00><00><19>J<EFBFBD>J<EFBFBD>4<>4<>$<24>"4<>"4<>5<>5rc<01><00>V^8<>dQhRR/#rnr)r#s"rr$r%<00>s<00><00>(<28>(<28>4<EFBFBD>(rc <0A>,<00>\VP4#)z<>Is this node nested?.
Returns `True` if the node represents a `Token` pair and tokens in the
sequence between them, where `Token.nesting` of the first `Token` in
the pair is 1 and nesting of the other `Token` is -1.
)r r)r<s&r<00> is_nested<65>SyntaxTreeNode.is_nested<65>s<00><00><14>D<EFBFBD>&<26>&<26>'<27>'rc<01> <00>V^8<>dQhRRRR/#)rr1rr!zSequence[_NodeType]r)r#s"rr$r%<00>s<00><00>$<24>$<24>y<EFBFBD>$<24>%8<>$rc <0A>X<00>VP'gV.#VPP#)zMGet siblings of the node.
Gets the whole group of siblings, including self.
)rir0r<s&r<00>siblings<67>SyntaxTreeNode.siblings<67>s$<00><00> <14>{<7B>{<7B>{<7B><18>6<EFBFBD>M<EFBFBD><13>{<7B>{<7B>#<23>#<23>#rc<01><00>V^8<>dQhRR/#r6r)r#s"rr$r%<00>s<00><00> E<01> E<01>c<EFBFBD> Erc <0A><00>VP'dR#VP'dVPP#VP'gQhVPPPP R4#)z<>Get a string type of the represented syntax.
- "root" for root nodes
- `Token.type` if the node represents an unnested token
- `Token.type` of the opening token, with "_open" suffix stripped, if
the node represents a nester token pair
rU<00>_open)rpr(r;r)r <00> removesuffixr<s&rr;<00>SyntaxTreeNode.type<70>s\<00><00> <10><<3C><<3C><<3C><19> <0F>:<3A>:<3A>:<3A><17>:<3A>:<3A>?<3F>?<3F> "<22><13>!<21>!<21>!<21>!<21>!<21><13>!<21>!<21>)<29>)<29>.<2E>.<2E>;<3B>;<3B>G<EFBFBD>D<>Drc<01> <00>V^8<>dQhRRRR/#rer)r#s"rr$r%<00>s<00><00><14><14>9<EFBFBD><14>)9<>rc <0A><><00>VPPV4pV^,\VP48dVPV^,,#R#)z\Get the next node in the sequence of siblings.
Returns `None` if this is the last sibling.
N)rx<00>indexr.<00>r1<00>
self_indexs& r<00> next_sibling<6E>SyntaxTreeNode.next_sibling<6E>sC<00><00> <1A>]<5D>]<5D>(<28>(<28><14>.<2E>
<EFBFBD> <15><01>><3E>C<EFBFBD><04> <0A> <0A>.<2E> .<2E><17>=<3D>=<3D><1A>a<EFBFBD><1E>0<> 0<>rc<01> <00>V^8<>dQhRRRR/#rer)r#s"rr$r%<00>s<00><00><14><14>y<EFBFBD><14>-=<3D>rc <0A><><00>VPPV4pV^,
^8<>dVPV^,
,#R#)zaGet the previous node in the sequence of siblings.
Returns `None` if this is the first sibling.
N)rxr<>r<>s& r<00>previous_sibling<6E>SyntaxTreeNode.previous_sibling<6E>s:<00><00> <1A>]<5D>]<5D>(<28>(<28><14>.<2E>
<EFBFBD> <15><01>><3E>Q<EFBFBD> <1E><17>=<3D>=<3D><1A>a<EFBFBD><1E>0<> 0<>rc<01> <00>V^8<>dQhRRRR/#<00>rrrr!r"r)r#s"rr$r%<00>s<00><00>$<24>$<24><1F>$<24>
<0E>$rc <0A>n<00>\V4!VRR7pWnVPPV4R#)zMake a child node for `self`.F)rN)r;rir0rV)r1rrWs&& r<00>
_add_child<EFBFBD>SyntaxTreeNode._add_child<6C>s+<00><00>
<15>T<EFBFBD>
<EFBFBD>6<EFBFBD>u<EFBFBD>5<><05><1B> <0C> <0C> <0A> <0A><1C><1C>U<EFBFBD>#rc<01> <00>V^8<>dQhRRRR/#r<>r)r#s"rr$r%<00>s<00><00>+<2B>+<2B><0F>+<2B>D<EFBFBD>+rc <0A><><00>\\V44pV'd<>VP4pVP'gVP V.4K>VP^8wd \ R4hV.p^pV'd>V'd6VP4pVP V4WSP, pKEV'd\ RV^, 24hVP V4K<>R#)z_Convert the token stream to a tree structure and set the resulting
nodes as children of `self`.zInvalid token nestingzunclosed tokens starting N)<07>list<73>reversed<65>popr/r<>r-rV)r1r<00>reversed_tokensr(<00> nested_tokensr/s&& rr,<00>(SyntaxTreeNode._set_children_from_tokens<6E>s<><00><00><1F>x<EFBFBD><06>/<2F>0<><0F><1D>#<23>'<27>'<27>)<29>E<EFBFBD><18>=<3D>=<3D>=<3D><14><0F><0F><15><07>(<28><18><14>}<7D>}<7D><01>!<21> <20>!8<>9<>9<>"<22>G<EFBFBD>M<EFBFBD><17>G<EFBFBD>!<21>g<EFBFBD>'<27>+<2B>+<2B>-<2D><05><1D>$<24>$<24>U<EFBFBD>+<2B><17>=<3D>=<3D>(<28><07><16> <20>#<<3C>]<5D>1<EFBFBD>=M<><N<>!O<>P<>P<> <10>O<EFBFBD>O<EFBFBD>M<EFBFBD> *<2A>%r<00>indent<6E> show_textF<74>_currentc<01>(<00>V^8<>dQhRRRRRRRR/#)rr<>rAr<>r r<>r!r7r)r#s"rr$r%<00>s,<00><00><14><14><1C><14>-1<><14>EH<45><14> <0C>rc  <0A><><00>RV,pVRVP 2,pVP'gQVP'd?VRRPRVPP 444,, pVR, pV'dsVP'gaVPR9dPVP
'd>VR\ P!VP
VRV,,4,, pVPF*pVRVPWW1,R7,, pK, V#)z'Create an XML style string of the tree.<2E> <20><c3<01>6"<00>TFwrV RV: 2x<00>K R#5i)<02>=Nr)<03>.0<EFBFBD>k<>vs& r<00> <genexpr><3E>(SyntaxTreeNode.pretty.<locals>.<genexpr><3E>s<00><00><00>"O<><N<>D<EFBFBD>A<EFBFBD>a<EFBFBD>S<EFBFBD><01>!<21><15><<3C><N<>s<00><01>><3E>
)r<>r<>r<>)<02>text<78> text_special)
r;rp<00>attrs<72>join<69>items<6D>content<6E>textwrapr<70>r0<00>pretty)r1r<>r<>r<><00>prefixr<78>rWs&$$$ rr<><00>SyntaxTreeNode.pretty<74>s<><00><00><15>x<EFBFBD><1E><06><15>!<21>D<EFBFBD>I<EFBFBD>I<EFBFBD>;<3B><0F>'<27><04><13>|<7C>|<7C>|<7C><04>
<EFBFBD>
<EFBFBD>
<EFBFBD> <10>C<EFBFBD>#<23>(<28>(<28>"O<>D<EFBFBD>J<EFBFBD>J<EFBFBD><L<><L<><N<>"O<>O<>O<> O<>D<EFBFBD> <0C><03> <0B><04> <15><18>L<EFBFBD>L<EFBFBD>L<EFBFBD><14> <09> <09>5<>5<><14> <0C> <0C> <0C> <10>D<EFBFBD>8<EFBFBD>?<3F>?<3F>4<EFBFBD><<3C><<3C><16>#<23><06>,<2C>9N<39>O<>O<> O<>D<EFBFBD><19>]<5D>]<5D>E<EFBFBD> <10>D<EFBFBD>5<EFBFBD><<3C><<3C><1D>X<EFBFBD>=N<>(<28><0E><0E> <0E>D<EFBFBD>#<23><14> r<00> include_selfc<01>$<00>V^8<>dQhRRRRRR/#)rr1rr<>r r!z Generator[_NodeType, None, None]r)r#s"rr$r%<00>s$<00><00> 5<> 5<><17> 5<>*.<2E> 5<> )<29> 5rc# <0A><>"<00>V'dVx<00>VPFpVPRR7Rjx<01>L
K R#L
5i)z<>Recursively yield all descendant nodes in the tree starting at self.
The order mimics the order of the underlying linear token
stream (i.e. depth first).
T)r<>N)r0<00>walk)r1r<>rWs&$ rr<><00>SyntaxTreeNode.walk<6C>s4<00><00><00> <18><16>J<EFBFBD><19>]<5D>]<5D>E<EFBFBD><1C>z<EFBFBD>z<EFBFBD>t<EFBFBD>z<EFBFBD>4<> 4<> 4<>#<23> 4<>s<00>1A<01>><06> Ac<01><00>V^8<>dQhRR/#)rr!r r)r#s"rr$r%
s<00><00>O<01>O<01>%<25>Orc <0A><><00>VP'd VP#VP'dVPP#\R4h)zTReturn the `Token` that is used as the data source for the
properties defined below.z.Root node does not have the accessed attribute)r(r)r <00>AttributeErrorr<s&r<00>_attribute_token<65>SyntaxTreeNode._attribute_token
sA<00><00> <10>:<3A>:<3A>:<3A><17>:<3A>:<3A> <1D> <0F> <1D> <1D> <1D><17>%<25>%<25>-<2D>-<2D> -<2D><1C>M<>N<>Nrc<01><00>V^8<>dQhRR/#r6r)r#s"rr$r%s<00><00>+<2B>+<2B>S<EFBFBD>+rc <0A>6<00>VP4P#)zhtml tag name, e.g. "p" )r<><00>tagr<s&rr<><00>SyntaxTreeNode.tags<00><00><14>$<24>$<24>&<26>*<2A>*<2A>*rc<01><00>V^8<>dQhRR/#)rr!zdict[str, str | int | float]r)r#s"rr$r%s<00><00>-<2D>-<2D>3<>-rc <0A>6<00>VP4P#)zHtml attributes.)r<>r<>r<s&rr<><00>SyntaxTreeNode.attrs<00><00><00><14>$<24>$<24>&<26>,<2C>,<2C>,rc<01> <00>V^8<>dQhRRRR/#)r<00>namer7r!zNone | str | int | floatr)r#s"rr$r%s<00><00>5<>5<>C<EFBFBD>5<>$<<3C>5rc <0A>@<00>VP4PV4#)z@Get the value of attribute `name`, or null if it does not exist.)r<><00>attrGet)r1r<>s&&rr<><00>SyntaxTreeNode.attrGets<00><00><13>$<24>$<24>&<26>.<2E>.<2E>t<EFBFBD>4<>4rc<01><00>V^8<>dQhRR/#)rr!ztuple[int, int] | Noner)r#s"rr$r%"s<00><00><14><14>+<2B>rc <0A>`<00>VP4PpV'd \V4#R#)z8Source map info. Format: `tuple[ line_begin, line_end ]`N)r<><00>map<61>tuple)r1<00>map_s& rr<><00>SyntaxTreeNode.map!s(<00><00><14>$<24>$<24>&<26>*<2A>*<2A><04> <0F><18><14>;<3B> <1E>rc<01><00>V^8<>dQhRR/#)rr!rAr)r#s"rr$r%+s<00><00>-<2D>-<2D>s<EFBFBD>-rc <0A>6<00>VP4P#)z(nesting level, the same as `state.level`)r<><00>levelr<s&rr<><00>SyntaxTreeNode.level*r<>rc<01><00>V^8<>dQhRR/#r6r)r#s"rr$r%0s<00><00>/<2F>/<2F><13>/rc <0A>6<00>VP4P#)zUIn a case of self-closing tag (code, html, fence, etc.), it
has contents of this tag.)r<>r<>r<s&rr<><00>SyntaxTreeNode.content/s<00><00><14>$<24>$<24>&<26>.<2E>.<2E>.rc<01><00>V^8<>dQhRR/#r6r)r#s"rr$r%6s<00><00>.<2E>.<2E><03>.rc <0A>6<00>VP4P#)z5'*' or '_' for emphasis, fence string for fence, etc.)r<><00>markupr<s&rr<><00>SyntaxTreeNode.markup5s<00><00><14>$<24>$<24>&<26>-<2D>-<2D>-rc<01><00>V^8<>dQhRR/#r6r)r#s"rr$r%;s<00><00>,<2C>,<2C>c<EFBFBD>,rc <0A>6<00>VP4P#)zfence infostring)r<><00>infor<s&rr<><00>SyntaxTreeNode.info:<00><00><00><14>$<24>$<24>&<26>+<2B>+<2B>+rc<01><00>V^8<>dQhRR/#)rr!zdict[Any, Any]r)r#s"rr$r%@s<00><00>,<2C>,<2C>n<EFBFBD>,rc <0A>6<00>VP4P#)z/A place for plugins to store an arbitrary data.)r<><00>metar<s&rr<><00>SyntaxTreeNode.meta?r<>rc<01><00>V^8<>dQhRR/#rnr)r#s"rr$r%Es<00><00>-<2D>-<2D>t<EFBFBD>-rc <0A>6<00>VP4P#)z5True for block-level tokens, false for inline tokens.)r<><00>blockr<s&rr<><00>SyntaxTreeNode.blockDr<>rc<01><00>V^8<>dQhRR/#rnr)r#s"rr$r%Js<00><00>.<2E>.<2E><04>.rc <0A>6<00>VP4P#)zZIf it's true, ignore this element when rendering.
Used for tight lists to hide paragraphs.)r<><00>hiddenr<s&rr<><00>SyntaxTreeNode.hiddenIs<00><00><14>$<24>$<24>&<26>-<2D>-<2D>-r)r+r*r)r(N)r)%rrrr<00>__doc__r3r=rrErZ<00>propertyr0<00>setterrirprtrxr;r<>r<>r<>r,r<>r<>r<>r<>r<>r<>r<>r<>r<>r<>r<>r<>r<>r<>rrrrrrs <00><00>
<08>(9<>CG<43>(9<>(9<>T5<><0E>A<><0E>A<> <0A>I<><0E>I<>#<23><16>(<0E><1E><0E><1E><0E>_<EFBFBD>_<EFBFBD><1F><15><1F><0E><1C><0E><1C> <0C>]<5D>]<5D><1D><13><1D><0E>6<><0E>6<><0E>(<28><0E>(<28><0E>$<24><0E>$<24><0E> E<01><0E> E<01><0E><14><0E><14><0E><14><0E><14>$<24>+<2B>0<14> <20><14>49<34><14>KL<4B><14>, 5<>15<31> 5<>,O<01><0E>+<2B><0E>+<2B><0E>-<2D><0E>-<2D>5<><0E><14><0E><14><0E>-<2D><0E>-<2D><0E>/<2F><0E>/<2F>
<0E>.<2E><0E>.<2E><0E>,<2C><0E>,<2C><0E>,<2C><0E>,<2C><0E>-<2D><0E>-<2D><0E>.<2E><0E>.r)r<><00>
__future__r<00>collections.abcrrr<><00>typingrrrrr(r r rrrrr<00><module>r<>sE<00><01><04>
#<23>/<2F><0F>5<>5<><18><13>J<EFBFBD><13>
<14>K<EFBFBD>'7<> 8<> <09>v.<2E>v.r