| Server IP : 202.61.199.114 / Your IP : 216.73.217.139 Web Server : nginx/1.22.1 System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web20 ( 1018) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /tmp/calpy/tinyhtml5/__pycache__/ |
Upload File : |
�
Υ=jc� � � � d dl mZ d dlmZmZmZmZmZmZm Z m
Z
mZmZm
Z
mZmZmZ d dlmZ d dlmZmZ dQd�Z G d� d� � Zd � Z G d
� d� � Z G d� d
e� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � Z! G d� de� � Z" G d� de� � Z# G d � d!e� � Z$ G d"� d#e� � Z% G d$� d%e� � Z& G d&� d'e� � Z' G d(� d)e� � Z( G d*� d+e� � Z) G d,� d-e� � Z* G d.� d/e� � Z+ G d0� d1e� � Z, G d2� d3e� � Z- G d4� d5e� � Z. G d6� d7e� � Z/ G d8� d9e� � Z0i d:e�d;e�d<e�d=e�d>e�d?e�d@e �dAe!�dBe"�dCe#�dDe$�dEe%�dFe&�dGe'�dHe(�dIe)�dJe*�e+e,e-e.e/e0dK��Z1dL� Z2dRdP�Z3dNS )S� )�inputstream)�ReparseError�Token�adjust_foreign_attributes�adjust_mathml_attributes�adjust_svg_attributes�ascii_upper_to_lower�cdata_elements�heading_elements�html_integration_point_elements�&mathml_text_integration_point_elements�
namespaces�rcdata_elements�space_characters�special_elements)�
HTMLTokenizer)�Marker�TreeBuilderTc �8 � t |� � j | fi |��S )u� Parse an HTML document into a tree.
:param document:
The document to parse as a HTML string, filename, file-like object.
:type document:
:class:`str`, :class:`bytes`, :class:`pathlib.Path` or
:term:`file object`
:param bool namespace_html_elements:
Whether or not to namespace HTML elements.
Extra parameters can be provided to define possible encodings if the
document is given as :class:`bytes`.
:param override_encoding: Forced encoding provided by user agent.
:type override_encoding: str or bytes
:param transport_encoding: Encoding provided by transport layout.
:type transport_encoding: str or bytes
:param same_origin_parent_encoding: Parent document encoding.
:type same_origin_parent_encoding: str or bytes
:param likely_encoding: Possible encoding provided by user agent.
:type likely_encoding: str or bytes
:param default_encoding: Encoding used as fallback.
:type default_encoding: str or bytes
:returns: :class:`xml.etree.ElementTree.Element`.
Example:
>>> from tinyhtml5 import parse
>>> parse('<html><body><p>This is a doc</p></body></html>')
<Element '{http://www.w3.org/1999/xhtml}html' at …>
)�
HTMLParser�parse)�document�namespace_html_elements�kwargss �C/tmp/claude-1015/pip-target-jmvfl800/lib/python/tinyhtml5/parser.pyr r s) � �D 5�:�-�.�.�4�X�H�H��H�H�H� c � � e Zd ZdZdd�Zdd�Zd� Zed� � � Zd � Z d
� Z
d� Zdd�Zdd�Z
dd�Zd� Zd� Zd� Zd� Zd� ZdS )r z]HTML parser.
Generate a tree structure from a stream of (possibly malformed) HTML.
Tc � � � t |� � � _ g � _ � fd�t � � � D � � � _ d S )Nc �: �� i | ]\ }}| |��j � � ��S � )�tree)�.0�name�cls�selfs �r �
<dictcomp>z'HTMLParser.__init__.<locals>.<dictcomp>E s- �� �S�S�S�i�d�C�t�S�S��t�y�1�1�S�S�Sr )r r! �errors�_phases�items�phases)r% r s ` r �__init__zHTMLParser.__init__B sA �� �� 7�8�8�� ����S�S�S�S�7�=�=�?�?�S�S�S����r NFc � � || _ || _ t |fd| i|��| _ | � � � | � � � d S # t $ r, | � � � | � � � Y d S w xY w)N�parser)� container� scriptingr � tokenizer�reset� main_loopr )r% �streamr. r/ r s r �_parsezHTMLParser._parseG s� � �"���"���&�v�E�E�d�E�f�E�E����
�
���� ��N�N�������� � � ��J�J�L�L�L��N�N������� ���s �A �2B�Bc � � | j � � � d| _ g | _ d| _ | j r�| j t v r| j j | j _ nH| j t v r| j j | j _ n#| j dk r| j j | j _ n | j
d | _ | j � � � | � � � n| j
d | _ d | _ d | _ d| _ d S )NFz no quirks� plaintext�before html�initialT)r! r1 �first_start_tagr'