403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.222.94.214
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib/python3.7/site-packages/html5lib/treebuilders/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/html5lib/treebuilders/__pycache__/base.cpython-37.pyc
B

63)Z�8�@s�ddlmZmZmZddlmZddlmZmZm	Z	dZ
ee�dfeeee	ddfg�B�dfeeee	dd	fe	dd
fg�B�dfee	ddfe	ddfg�dfee	ddfe	dd
fg�dfd�Z
Gdd�de�ZGdd�de�ZGdd�de�ZdS)�)�absolute_import�division�unicode_literals)�	text_type�)�scopingElements�tableInsertModeElements�
namespacesNF�html�buttonZolZul�table�optgroup�optionT)Nr�listr�selectc@sbeZdZdZdd�Zdd�Zdd�Zdd	�Zddd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
d
S)�NodezRepresents an item in the treecCs(||_d|_d|_i|_g|_g|_dS)zRCreates a Node

        :arg name: The tag name associated with the node

        N)�name�parent�value�
attributes�
childNodesZ_flags)�selfr�r�K/opt/alt/python37/lib/python3.7/site-packages/html5lib/treebuilders/base.py�__init__sz
Node.__init__cCs:d�dd�|j��D��}|r,d|j|fSd|jSdS)N� cSsg|]\}}d||f�qS)z%s="%s"r)�.0rrrrr�
<listcomp>.sz Node.__str__.<locals>.<listcomp>z<%s %s>z<%s>)�joinr�itemsr)rZ
attributesStrrrr�__str__-s

zNode.__str__cCs
d|jS)Nz<%s>)r)rrrr�__repr__6sz
Node.__repr__cCst�dS)z[Insert node as a child of the current node

        :arg node: the node to insert

        N)�NotImplementedError)r�noderrr�appendChild9szNode.appendChildNcCst�dS)aBInsert data as text in the current node, positioned before the
        start of node insertBefore or to the end of the node's text.

        :arg data: the data to insert

        :arg insertBefore: True if you want to insert the text before the node
            and False if you want to insert it after the node

        N)r")r�data�insertBeforerrr�
insertTextAs
zNode.insertTextcCst�dS)aInsert node as a child of the current node, before refNode in the
        list of child nodes. Raises ValueError if refNode is not a child of
        the current node

        :arg node: the node to insert

        :arg refNode: the child node to insert the node before

        N)r")rr#ZrefNoderrrr&Ms
zNode.insertBeforecCst�dS)zhRemove node from the children of the current node

        :arg node: the child node to remove

        N)r")rr#rrr�removeChildYszNode.removeChildcCs$x|jD]}|�|�qWg|_dS)z�Move all the children of the current node to newParent.
        This is needed so that trees that don't store text as nodes move the
        text in the correct way

        :arg newParent: the node to move all this node's children to

        N)rr$)rZ	newParent�childrrr�reparentChildrenas	zNode.reparentChildrencCst�dS)z�Return a shallow copy of the current node i.e. a node with the same
        name and attributes but with no parent or child nodes
        N)r")rrrr�	cloneNodenszNode.cloneNodecCst�dS)zFReturn true if the node has children or text, false otherwise
        N)r")rrrr�
hasContenttszNode.hasContent)N)�__name__�
__module__�__qualname__�__doc__rr r!r$r'r&r(r*r+r,rrrrrs	

rc@seZdZdd�Zdd�ZdS)�ActiveFormattingElementscCsfd}|tkrVxH|ddd�D]6}|tkr*P|�||�r>|d7}|dkr|�|�PqWt�||�dS)Nr�����)�Marker�
nodesEqual�remover�append)rr#Z
equalCount�elementrrrr8{s
zActiveFormattingElements.appendcCs$|j|jksdS|j|jks dSdS)NFT)�	nameTupler)rZnode1Znode2rrrr6�s
z#ActiveFormattingElements.nodesEqualN)r-r.r/r8r6rrrrr1zs
r1c@s�eZdZdZdZdZdZdZdZdd�Z	dd�Z
d+dd�Zd	d
�Zdd�Z
d
d�Zdd�Zdd�Zd,dd�Zdd�Zdd�Zdd�Zeee�Zdd�Zdd�Zd-dd �Zd!d"�Zd.d#d$�Zd%d&�Zd'd(�Zd)d*�ZdS)/�TreeBuilderaBase treebuilder implementation

    * documentClass - the class to use for the bottommost node of a document
    * elementClass - the class to use for HTML Elements
    * commentClass - the class to use for comments
    * doctypeClass - the class to use for doctypes

    NcCs|rd|_nd|_|��dS)zmCreate a TreeBuilder

        :arg namespaceHTMLElements: whether or not to namespace HTML elements

        zhttp://www.w3.org/1999/xhtmlN)�defaultNamespace�reset)rZnamespaceHTMLElementsrrrr�szTreeBuilder.__init__cCs.g|_t�|_d|_d|_d|_|��|_dS)NF)�openElementsr1�activeFormattingElementsZheadPointerZformPointer�insertFromTable�
documentClass�document)rrrrr=�szTreeBuilder.resetcCs�t|d�}|s2t|t�r$td|f}t|t�s2t�t|\}}xFt|j�D]8}|r^||kr^dS|sp|j	|krpdS||j	|kArJdSqJWds�t�dS)Nr:r
TF)
�hasattr�
isinstancerr	�tuple�AssertionError�listElementsMap�reversedr>r:)r�targetZvariantZ	exactNodeZlistElements�invertr#rrr�elementInScope�s

zTreeBuilder.elementInScopecCs�|js
dSt|j�d}|j|}|tks4||jkr8dSx6|tkrn||jkrn|dkrZd}P|d8}|j|}q:WxR|d7}|j|}|��}|�d|j|j|jd��}||j|<||jdkrrPqrWdS)Nr3rr2ZStartTag)�typer�	namespacer%)	r?�lenr5r>r+�
insertElementrrMr)r�i�entry�cloner9rrr�#reconstructActiveFormattingElements�s.


z/TreeBuilder.reconstructActiveFormattingElementscCs,|j��}x|jr&|tkr&|j��}qWdS)N)r?�popr5)rrQrrr�clearActiveFormattingElementss
z)TreeBuilder.clearActiveFormattingElementscCs8x2|jddd�D]}|tkr"Pq|j|kr|SqWdS)z�Check if an element exists between the end of the active
        formatting elements and the last marker. If it does, return it, else
        return falseNr2F)r?r5r)rr�itemrrr�!elementInActiveFormattingElements
s
z-TreeBuilder.elementInActiveFormattingElementscCs&|�|�}|j�|�|j�|�dS)N)�
createElementr>r8rBr$)r�tokenr9rrr�
insertRoots
zTreeBuilder.insertRootcCs6|d}|d}|d}|�|||�}|j�|�dS)Nr�publicId�systemId)�doctypeClassrBr$)rrYrr[r\Zdoctyperrr�
insertDoctype s
zTreeBuilder.insertDoctypecCs*|dkr|jd}|�|�|d��dS)Nr2r%)r>r$�commentClass)rrYrrrr�
insertComment(s
zTreeBuilder.insertCommentcCs0|d}|�d|j�}|�||�}|d|_|S)z.Create an element but don't insert it anywhererrMr%)�getr<�elementClassr)rrYrrMr9rrrrX-s

zTreeBuilder.createElementcCs|jS)N)�_insertFromTable)rrrr�_getInsertFromTable5szTreeBuilder._getInsertFromTablecCs ||_|r|j|_n|j|_dS)zsSwitch the function used to insert an element from the
        normal one to the misnested table one and back againN)rc�insertElementTablerO�insertElementNormal)rrrrr�_setInsertFromTable8s
zTreeBuilder._setInsertFromTablecCsb|d}t|t�std|��|�d|j�}|�||�}|d|_|jd�|�|j�	|�|S)NrzElement %s not unicoderMr%r2)
rDrrFrar<rbrr>r$r8)rrYrrMr9rrrrfCs
zTreeBuilder.insertElementNormalcCs`|�|�}|jdjtkr$|�|�S|��\}}|dkrD|�|�n|�||�|j�|�|S)z-Create an element and insert it into the treer2N)	rXr>rrrf�getTableMisnestedNodePositionr$r&r8)rrYr9rr&rrrreMs

zTreeBuilder.insertElementTablecCsV|dkr|jd}|jr.|jr:|jdjtkr:|�|�n|��\}}|�||�dS)zInsert text data.Nr2)r>r@rrr'rh)rr%rr&rrrr']s

zTreeBuilder.insertTextcCsvd}d}d}x(|jddd�D]}|jdkr|}PqW|rd|jrL|j}|}qn|j|j�|�d}n
|jd}||fS)zsGet the foster parent element, and sibling to insert before
        (or None) when inserting a misnested table nodeNr2rr3r)r>rr�index)rZ	lastTableZfosterParentr&�elmrrrrhls

z)TreeBuilder.getTableMisnestedNodePositioncCs8|jdj}|td�kr4||kr4|j��|�|�dS)Nr2)�dd�dtZlirr
�pZrpZrt)r>r�	frozensetrT�generateImpliedEndTags)r�excluderrrrro�s

z"TreeBuilder.generateImpliedEndTagscCs|jS)zReturn the final tree)rB)rrrr�getDocument�szTreeBuilder.getDocumentcCs|��}|jd�|�|S)zReturn the final fragmentr)�
fragmentClassr>r*)r�fragmentrrr�getFragment�szTreeBuilder.getFragmentcCst�dS)z�Serialize the subtree of node in the format required by unit tests

        :arg node: the node from which to start serializing

        N)r")rr#rrr�testSerializer�szTreeBuilder.testSerializer)N)N)N)N)r-r.r/r0rArbr_r]rrrr=rKrSrUrWrZr^r`rXrdrg�propertyr@rfrer'rhrorqrtrurrrrr;�s6
.
	




r;)�
__future__rrr�sixr�	constantsrrr	r5rn�setrG�objectrrr1r;rrrr�<module>s
c

Youez - 2016 - github.com/yon3zu
LinuXploit