D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
lib
/
python3.6
/
site-packages
/
bs4
/
builder
/
__pycache__
/
Filename :
_htmlparser.cpython-36.pyc
back
Copy
3 6]�3 � @ s� d Z dgZddlmZ yddlmZ W n2 ek rX Z zG dd� de�ZW Y ddZ[X nX ddlZddl Z ej dd� \ZZZ edko�ed ko�e dkZedko�edkZedko�ed kZddlmZmZmZmZmZ ddlmZmZ dd lmZmZmZ dZG dd� de�ZG dd� de�Z edk�r�ed k�r�e �r�ddl!Z!e!j"d�Z#e#e _#e!j"de!j$�Z%e%e_%ddlm&Z&m'Z' dd� Z(dd� Z)e(e_(e)e_)dZdS )zCUse the HTMLParser library to parse HTML files that aren't too bad.�HTMLParserTreeBuilder� )� HTMLParser)�HTMLParseErrorc @ s e Zd ZdS )r N)�__name__� __module__�__qualname__� r r �!/usr/lib/python3.6/_htmlparser.pyr s r N� � � )�CData�Comment�Declaration�Doctype�ProcessingInstruction)�EntitySubstitution� UnicodeDammit)�HTML�HTMLTreeBuilder�STRICTzhtml.parserc @ sp e Zd Zdd� Zdd� Zdd� Zddd �Zdd d�Zdd � Zdd� Z dd� Z dd� Zdd� Zdd� Z dd� ZdS )�BeautifulSoupHTMLParserc O s t j| f|�|� g | _d S )N)r �__init__�already_closed_empty_element)�self�args�kwargsr r r r 9 s z BeautifulSoupHTMLParser.__init__c C s t j|� dS )ai In Python 3, HTMLParser subclasses must implement error(), although this requirement doesn't appear to be documented. In Python 2, HTMLParser implements error() as raising an exception. In any event, this method is called only on very strange markup and our best strategy is to pretend it didn't happen and keep going. N)�warnings�warn)r �msgr r r �errorE s zBeautifulSoupHTMLParser.errorc C s | j ||dd�}| j|� d S )NF)�handle_empty_element)�handle_starttag� handle_endtag)r �name�attrs�tagr r r �handle_startendtagP s z*BeautifulSoupHTMLParser.handle_startendtagTc C sl i }x(|D ] \}}|d krd}|||<