JFIF$        dd7 

Viewing File: /usr/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/__pycache__/base.cpython-39.pyc

a

[��f4�@s�ddlmZmZmZddlmZddlmZmZm	Z	gd�Z
ejZej
ZejZejZejZejZdZd�e	�Z	Gdd	�d	e�ZGd
d�de�ZdS)
�)�absolute_import�division�unicode_literals)�Node�)�
namespaces�voidElements�spaceCharacters)	�DOCUMENT�DOCTYPE�TEXT�ELEMENT�COMMENT�ENTITY�UNKNOWN�
TreeWalker�NonRecursiveTreeWalkerz<#UNKNOWN#>�c@sleZdZdZdd�Zdd�Zdd�Zdd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zddd�Zdd�Z
dd�ZdS)rz}Walks a tree yielding tokens

    Tokens are dicts that all have a ``type`` field specifying the type of the
    token.

    cCs
||_dS)zCCreates a TreeWalker

        :arg tree: the tree to walk

        N)�tree)�selfr�r�I/usr/lib/python3.9/site-packages/pip/_vendor/html5lib/treewalkers/base.py�__init__szTreeWalker.__init__cCst�dS�N��NotImplementedError)rrrr�__iter__#szTreeWalker.__iter__cCs
d|d�S)z�Generates an error token with the given message

        :arg msg: the error message

        :returns: SerializeError token

        ZSerializeError��type�datar)r�msgrrr�error&szTreeWalker.errorFccs$d|||d�V|r |�d�VdS)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

        ZEmptyTag�r�name�	namespacerzVoid element has childrenN�r!)rr$r#�attrs�hasChildrenrrr�emptyTag0s�zTreeWalker.emptyTagcCsd|||d�S)z�Generates 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

        ZStartTagr"r)rr$r#r&rrr�startTagEs
�zTreeWalker.startTagcCsd||d�S)z�Generates an EndTag token

        :arg namespace: the namespace of the token--can be ``None``

        :arg name: the name of the element

        :returns: EndTag token

        ZEndTag)rr#r$r)rr$r#rrr�endTagVs
�zTreeWalker.endTagccsx|}|�t�}|dt|�t|��}|r6d|d�V|}|�t�}|t|�d�}|rdd|d�V|rtd|d�VdS)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

        NZSpaceCharactersrZ
Characters)�lstripr	�len�rstrip)rrZmiddle�left�rightrrr�textds

zTreeWalker.textcCs
d|d�S)zdGenerates a Comment token

        :arg data: the comment

        :returns: Comment token

        �Commentrr)rrrrr�comment�szTreeWalker.commentNcCsd|||d�S)z�Generates a Doctype token

        :arg name:

        :arg publicId:

        :arg systemId:

        :returns: the Doctype token

        ZDoctype)rr#�publicId�systemIdr)rr#r3r4rrr�doctype�s
�zTreeWalker.doctypecCs
d|d�S)zjGenerates an Entity token

        :arg name: the entity name

        :returns: an Entity token

        ZEntity)rr#r)rr#rrr�entity�szTreeWalker.entitycCs|�d|�S)zHandles unknown node typeszUnknown node type: r%)rZnodeTyperrr�unknown�szTreeWalker.unknown)F)NN)�__name__�
__module__�__qualname__�__doc__rrr!r(r)r*r0r2r5r6r7rrrrrs

&


rc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)rcCst�dSrr�rZnoderrr�getNodeDetails�sz%NonRecursiveTreeWalker.getNodeDetailscCst�dSrrr<rrr�
getFirstChild�sz$NonRecursiveTreeWalker.getFirstChildcCst�dSrrr<rrr�getNextSibling�sz%NonRecursiveTreeWalker.getNextSiblingcCst�dSrrr<rrr�
getParentNode�sz$NonRecursiveTreeWalker.getParentNodeccs�|j}|du�r�|�|�}|d|dd�}}d}|tkrJ|j|�Vn�|tkrj|j|�D]
}|Vq\n�|tkr�|\}}}}|r�|tdkr�|tvr�|�	||||�D]
}|Vq�d}n|�
|||�VnV|tkr�|�|d�Vn<|t
k�r|�|d�Vn |tk�rd}n|�|d�V|�r2|�|�}	nd}	|	du�rF|	}q|dur|�|�}|d|dd�}}|tk�r�|\}}}}|�r�|tdk�s�|tv�r�|�||�V|j|u�r�d}q|�|�}
|
du�r�|
}qn
|�|�}�qFqdS)Nr�FZhtmlT)rr=rr5rr0r
rrr(r)rr2rr6r
r7r>r*r?r@)rZcurrentNodeZdetailsrr'�tokenr$r#Z
attributesZ
firstChildZnextSiblingrrrr�s\



�






zNonRecursiveTreeWalker.__iter__N)r8r9r:r=r>r?r@rrrrrr�s
rN)Z
__future__rrrZxml.domrZ	constantsrrr	�__all__Z
DOCUMENT_NODEr
ZDOCUMENT_TYPE_NODErZ	TEXT_NODErZELEMENT_NODEr
ZCOMMENT_NODErZENTITY_NODErr�join�objectrrrrrr�<module>s
!
Back to Directory  nL+D550H?Mx ,D"v]qv;6*Zqn)ZP0!1 A "#a$2Qr D8 a Ri[f\mIykIw0cuFcRı?lO7к_f˓[C$殷WF<_W ԣsKcëIzyQy/_LKℂ;C",pFA:/]=H  ~,ls/9ć:[=/#f;)x{ٛEQ )~ =𘙲r*2~ a _V=' kumFD}KYYC)({ *g&f`툪ry`=^cJ.I](*`wq1dđ#̩͑0;H]u搂@:~וKL Nsh}OIR*8:2 !lDJVo(3=M(zȰ+i*NAr6KnSl)!JJӁ* %݉?|D}d5:eP0R;{$X'xF@.ÊB {,WJuQɲRI;9QE琯62fT.DUJ;*cP A\ILNj!J۱+O\͔]ޒS߼Jȧc%ANolՎprULZԛerE2=XDXgVQeӓk yP7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