File: //lib/python3/dist-packages/pip/_vendor/html5lib/treebuilders/__pycache__/base.cpython-310.pyc
o
@%Ne�8 � @ s� d dl mZmZmZ d dlmZ ddlmZmZm Z dZ
ee�dfeee d dfhB �dfeee d d fe d d
fhB �dfee d dfe d dfg�dfee d dfe d d
fg�dfd�ZG dd� de
�ZG dd� de�ZG dd� de
�ZdS )� )�absolute_import�division�unicode_literals)� text_type� )�scopingElements�tableInsertModeElements�
namespacesNF�html�button�ol�ul�table�optgroup�optionT)Nr �listr �selectc @ sb e Zd ZdZdd� Zdd� Zdd� Zdd � Zddd�Zd
d� Z dd� Z
dd� Zdd� Zdd� Z
d
S )�NodezRepresents an item in the treec C s( || _ d| _d| _i | _g | _g | _dS )zRCreates a Node
:arg name: The tag name associated with the node
N)�name�parent�value�
attributes�
childNodes�_flags)�selfr � r �H/usr/lib/python3/dist-packages/pip/_vendor/html5lib/treebuilders/base.py�__init__ s
z
Node.__init__c C s6 d� dd� | j�� D ��}|rd| j|f S d| j S )N� c S s g | ]
\}}d ||f �qS )z%s="%s"r )�.0r r r r r �
<listcomp>. s �z Node.__str__.<locals>.<listcomp>z<%s %s>�<%s>)�joinr �itemsr )r �
attributesStrr r r �__str__- s
�
zNode.__str__c C s
d| j S )Nr! )r �r r r r �__repr__6 s
z
Node.__repr__c C � t �)z[Insert node as a child of the current node
:arg node: the node to insert
��NotImplementedError�r �noder r r �appendChild9 � zNode.appendChildNc C r( )aB Insert 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
r) )r �data�insertBeforer r r �
insertTextA �
zNode.insertTextc C r( )a Insert 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
r) )r r, �refNoder r r r0 M r2 zNode.insertBeforec C r( )zhRemove node from the children of the current node
:arg node: the child node to remove
r) r+ r r r �removeChildY r. zNode.removeChildc C s | j D ]}|�|� qg | _ 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)r r- )r � newParent�childr r r �reparentChildrena s
zNode.reparentChildrenc C r( )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
r) r&