Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/twisted/web/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/twisted/web/__pycache__/domhelpers.cpython-310.pyc
o

�bf"�@sdZddlmZddlmZddlmZmZmZeeGdd�de	�Z
dd�Zd9d
d�Zdd
�Z
dd�Zdd�Zdd�Zd:dd�Zdd�Zdd�Zdd�Zd;dd�ZGd d!�d!ej�Zd<d#d$�Zd<d%d&�Zd<d'd(�Zd)d*�Zd+d,�Zd<d-d.�Zd/d0�Zd1d2�Zd3d4�Z d5d6�Z!d7d8�Z"d"S)=z>
A library for performing interesting tasks with DOM objects.
�)�StringIO)�microdom)�escape�getElementsByTagName�unescapec@seZdZdS)�NodeLookupErrorN)�__name__�
__module__�__qualname__�rr�8/usr/lib/python3/dist-packages/twisted/web/domhelpers.pyrsrcCsF|jD]}t|d�r|jr|�dt|j�|j|�t|||�qdS)z�
    Look through the given node's children for strings, and
    attempt to do string substitution with the given parameter.
    �	nodeValuerN)�
childNodes�hasattrr
�replaceData�len�
substitute)�request�node�subs�childrrrrs

�r��id�class�model�patterncCs�t|d�r|��r|D]}t|�|��|kr|Sq|��rDt|jd�r*|jj}nt|j�}t|�D]}t	|j||�}|rC|Sq3dSdS)zx
    (internal) Get a node with the specified C{nodeId} as any of the C{class},
    C{id} or C{pattern} attributes.
    �
hasAttributes�lengthN)
rr�str�getAttribute�
hasChildNodesrrr�range�_get)r�nodeId�	nodeAttrs�nodeAttrr�childNum�resultrrrr""s �

��r"cCst||�}|r	|St|��)z�
    Get a node with the specified C{nodeId} as any of the C{class},
    C{id} or C{pattern} attributes. If there is no such node, raise
    L{NodeLookupError}.
    )r"r�rr#r'rrr�get7s
r)cCs
t||�S)z�
    Get a node with the specified C{nodeId} as any of the C{class},
    C{id} or C{pattern} attributes.  If there is no such node, return
    L{None}.
    )r")rr#rrr�getIfExistsCs
r*cCst||�}|rt|�|S)z�Get a node with the specified C{nodeId} as any of the C{class},
    C{id} or C{pattern} attributes. If there is no such node, raise
    L{NodeLookupError}. Remove all child nodes before returning.
    )r)�	clearNoder(rrr�getAndClearLs
r,cCsg|jdd�<dS)z2
    Remove all children from the given node.
    N�r)rrrrr+Wsr+�cCsrg}t|tg��st|j|||�S|D]#}t|d�sqt|�|��|kr,|�|�|r,q|�t||||��q|S)z\
    Find subnodes in the given node where the given attribute
    has the given value.
    r)	�
isinstance�type�locateNodesrrrr�append�extend)�nodeList�key�value�	noNesting�
returnList�	childNoderrrr1^s

r1cCsBt|d�sdS|�||�|��r|jD]
}t|||�qdSdS)N�setAttribute)rr:r r�superSetAttribute)rr5r6rrrrr;qs

�r;cCsft|d�sdS|�|�}|r|�||d|�n|�||�|��r/|jD]
}t|||�q&dSdS�Nr:�/)rrr:r r�superPrependAttribute�rr5r6�oldrrrrr>z�


�r>cCsft|d�sdS|�|�}|r|�||d|�n|�||�|��r/|jD]
}t|||�q&dSdSr<)rrr:r r�superAppendAttributer?rrrrB�rArB�cCs|g}|j}|g}t|�dkr9|�d�}t|d�r,|jdur,|r%t|j�}n|j}||�|j|dd�<t|�dks|�|�S)ahVisit each child node and collect its text data, if any, into a string.
    For example::
        >>> doc=microdom.parseString('<a>1<b>2<c>3</c>4</b></a>')
        >>> gatherTextNodes(doc.documentElement)
        '1234'
    With dounescape=1, also convert entities back into normal characters.
    @return: the gathered nodes as a single string
    @rtype: strrr
N)r2r�poprr
rr�join)�iNode�
dounescape�joinWith�gathered�gathered_append�slice�c�valrrr�gatherTextNodes�s	
�
	rNc@s&eZdZdZ						ddd�ZdS)�RawTexta7This is an evil and horrible speed hack. Basically, if you have a big
    chunk of XML that you want to insert into the DOM, but you don't want to
    incur the cost of parsing it, you can construct one of these and insert it
    into the DOM. This will most certainly only work with microdom as the API
    for converting nodes to xml is different in every DOM implementation.

    This could be improved by making this class a Lazy parser, so if you
    inserted this into the DOM and then later actually tried to mutate this
    node, it would be parsed then.
    rCrNcCs|�|�|j�|���dS�N)�write�data)�self�writer�indent�	addindent�newl�strip�
nsprefixes�	namespacerrr�writexml�s
zRawText.writexml)rCrCrCrNN)rr	r
�__doc__r[rrrrrO�s�rONcCsF|durg}|��s|S|jD]}||�r|�|�t|||�q|SrP�r rr2�	findNodes��parent�matcher�accumrrrrr^�s

r^cCsP|durg}|��s|S|jD]}||�r|�|�||�r%t||||�q|SrP)r rr2�findNodesShallowOnMatch)r`ra�recurseMatcherrbrrrrrc�s

�rccCsH|durg}|��s|S|jD]}||�r|�|�qt|||�q|SrPr]r_rrr�findNodesShallow�s
recst|�fdd��S)z�
    Return an iterable of the elements which are direct children of C{parent}
    and which have the C{attribute} attribute.
    cst|dd�duo|���S�N�tagName)�getattr�hasAttribute)�n��	attributerr�<lambda>�sz2findElementsWithAttributeShallow.<locals>.<lambda>)re)r`rlrrkr� findElementsWithAttributeShallow��
�rncC�t||fdd��S)z�
    Return an iterable of the elements which are children of C{parent} for
    which the predicate C{matcher} returns true.
    cSst|dd�duo||�Srf�rh)rjrarrrrm�szfindElements.<locals>.<lambda>�r^)r`rarrr�findElements�rorscCs*|rt|||fdd��St||fdd��S)NcSs|�|�o|�|�|kSrP)rir)rjrlr6rrrrms
z+findElementsWithAttribute.<locals>.<lambda>cSs
|�|�SrP)ri)rjrlrrrrm
�
)rs)r`rlr6rrr�findElementsWithAttributes��rucCrp)NcSs
|j|kSrP��nodeName)rj�namerrrrmrtz findNodesNamed.<locals>.<lambda>rr)r`rxrrr�findNodesNamedsrycCs6|jD]}t|d�r|�d|j�qt||�qdS)NrRrC)rrrQrR�
writeNodeData)r�oldio�subnoderrrrzs


�rzcCst�}t||�|��SrP)rrz�getvalue)rr{rrr�getNodeTexts
r~cCs g}|r|�|�|j}|s|SrP)r2�
parentNode)r�lrrr�
getParents#s
�r�cs�fdd�|jD�S)znnamedChildren(parent, nodeName) -> children (not descendants) of parent
    that have tagName == nodeName
    cs g|]}t|dd��kr|�qS)rgrCrq)�.0rjrvrr�
<listcomp>/s z!namedChildren.<locals>.<listcomp>r-)r`rwrrvr�
namedChildren+sr�)r)r.)rrCrP)#r\�ior�twisted.webr�twisted.web.microdomrrr�	Exceptionrrr"r)r*r,r+r1r;r>rBrN�TextrOr^rcrernrsruryrzr~r�r�rrrr�<module>s<
	
	









Spamworldpro Mini