Re4ddlmZmZmZddlmZddlmZmZm Z gdZ ej Z ej ZejZejZejZejZdZde Z Gdd eZGd d eZd S) )absolute_importdivisionunicode_literals)Node) namespaces voidElementsspaceCharacters) DOCUMENTDOCTYPETEXTELEMENTCOMMENTENTITYUNKNOWN TreeWalkerNonRecursiveTreeWalkerz <#UNKNOWN#>cXeZdZdZdZdZdZddZdZdZ d Z d Z dd Z d Z dZd S)rz}Walks a tree yielding tokens Tokens are dicts that all have a ``type`` field specifying the type of the token. c||_dS)zCCreates a TreeWalker :arg tree: the tree to walk N)tree)selfrs /builddir/build/BUILDROOT/alt-python311-pip-21.3.1-3.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/html5lib/treewalkers/base.py__init__zTreeWalker.__init__s  ctNNotImplementedError)rs r__iter__zTreeWalker.__iter__#!!rc d|dS)zGenerates an error token with the given message :arg msg: the error message :returns: SerializeError token SerializeErrortypedata)rmsgs rerrorzTreeWalker.error&s)#666rFc#RKd|||dV|r|dVdSdS)arGenerates an EmptyTag token :arg namespace: the namespace of the token--can be ``None`` :arg name: the name of the element :arg attrs: the attributes of the element as a dict :arg hasChildren: whether or not to yield a SerializationError because this tag shouldn't have children :returns: EmptyTag token EmptyTagr%name namespacer&zVoid element has childrenNr))rr.r-attrs hasChildrens remptyTagzTreeWalker.emptyTag0s_"4%     :**899 9 9 9 9 9 : :rcd|||dS)zGenerates a StartTag token :arg namespace: the namespace of the token--can be ``None`` :arg name: the name of the element :arg attrs: the attributes of the element as a dict :returns: StartTag token StartTagr,r')rr.r-r0s rstartTagzTreeWalker.startTagEs#& rcd||dS)zGenerates an EndTag token :arg namespace: the namespace of the token--can be ``None`` :arg name: the name of the element :returns: EndTag token EndTag)r%r-r.r')rr.r-s rendTagzTreeWalker.endTagVs!&(( (rc#0K|}|t}|dt|t|z }|rd|dV|}|t}|t|d}|rd|dV|r d|dVdSdS)atGenerates SpaceCharacters and Characters tokens Depending on what's in the data, this generates one or more ``SpaceCharacters`` and ``Characters`` tokens. For example: >>> from html5lib.treewalkers.base import TreeWalker >>> # Give it an empty tree just so it instantiates >>> walker = TreeWalker([]) >>> list(walker.text('')) [] >>> list(walker.text(' ')) [{u'data': ' ', u'type': u'SpaceCharacters'}] >>> list(walker.text(' abc ')) # doctest: +NORMALIZE_WHITESPACE [{u'data': ' ', u'type': u'SpaceCharacters'}, {u'data': u'abc', u'type': u'Characters'}, {u'data': u' ', u'type': u'SpaceCharacters'}] :arg data: the text data :returns: one or more ``SpaceCharacters`` and ``Characters`` tokens NSpaceCharactersr$ Characters)lstripr lenrstrip)rr&middleleftrights rtextzTreeWalker.textds2_--,SYYV,,-  <,d;; ; ; ;_--S[[\\"  9'88 8 8 8  =,e<< < < < < < = =rc d|dS)zdGenerates a Comment token :arg data: the comment :returns: Comment token Commentr$r')rr&s rcommentzTreeWalker.comments"4000rNcd|||dS)zGenerates a Doctype token :arg name: :arg publicId: :arg systemId: :returns: the Doctype token Doctype)r%r-publicIdsystemIdr')rr-rHrIs rdoctypezTreeWalker.doctypes"$$&& &rc d|dS)zjGenerates an Entity token :arg name: the entity name :returns: an Entity token Entity)r%r-r')rr-s rentityzTreeWalker.entitys!$///rc2|d|zS)zHandles unknown node typeszUnknown node type: r/)rnodeTypes runknownzTreeWalker.unknownszz/(:;;;r)F)NN)__name__ __module__ __qualname____doc__rr r)r2r5r8rBrErJrMrPr'rrrrs """777::::*" ( ( ($=$=$=L111&&&&"000<<<<>G$+AJ 'DwCJ@ 4[%?)z&7I*I*IdZfNfNf"&++i">">>>>yK//&* "&"5"5k"B"BK".&1 &*&8&8&E&E "-U%%%%%rN)rQrRrSrYr[r]r_r r'rrrrsd"""""""""""";F;F;F;F;FrrN) __future__rrrxml.domr constantsrr r __all__ DOCUMENT_NODEr DOCUMENT_TYPE_NODEr TEXT_NODEr ELEMENT_NODEr COMMENT_NODEr ENTITY_NODErrjoinobjectrrr'rrrus&BBBBBBBBBBAAAAAAAAAA 3 3 3    ! ~      ''/**]<]<]<]<]<]<]<]<@HFHFHFHFHFZHFHFHFHFHFr