File: //opt/alt/python37/lib/python3.7/site-packages/bs4/__pycache__/__init__.cpython-37.pyc
B
I.�`�O � @ s d Z dZdZdZdZdgZddlZddlZddlZddl Z dd l
mZmZ dd
l
mZ ddlmZmZmZmZmZmZmZmZmZmZmZ dd
k G dd� de�ZeZeZG dd� de�ZG dd� de�Z G dd� de!�Z"e#dk�rddl$Z$ee$j%�Z&e'e&�(� � dS )aH Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup uses a pluggable XML or HTML parser to parse a
(possibly invalid) document into a tree representation. Beautiful Soup
provides methods and Pythonic idioms that make it easy to navigate,
search, and modify the parse tree.
Beautiful Soup works with Python 2.7 and up. It works better if lxml
and/or html5lib is installed.
For more than you ever wanted to know about Beautiful Soup, see the
documentation:
http://www.crummy.com/software/BeautifulSoup/bs4/doc/
z*Leonard Richardson (leonardr@segfault.org)z4.5.1z*Copyright (c) 2004-2016 Leonard RichardsonZMIT�
BeautifulSoup� N� )�builder_registry�ParserRejectedMarkup)�
UnicodeDammit)�CData�Comment�DEFAULT_OUTPUT_ENCODING�Declaration�Doctype�NavigableString�PageElement�ProcessingInstruction� ResultSet�SoupStrainer�Tagz`You are trying to run the Python 2 version of Beautiful Soup under Python 3. This will not work.zuYou need to convert the code, either by installing it (`python setup.py install`) or by running 2to3 (`2to3 -w bs4`).c s� e Zd ZdZdZddgZdZdZd2d d
�Zdd� Z d
d� Z
edd� �Zdd� Z
dd� Zd3dd�Zefdd�Zdd� Zdd� Zdd� Zdd � Zefd!d"�Zd4d#d$�Zd5d&d'�Zd(d)� Zd6d*d+�Zd,d-� Zd.ed/f� fd0d1� Z� ZS )7r a
This class defines the basic interface called by the tree builders.
These methods will be called by the parser:
reset()
feed(markup)
The tree builder may call these methods from its feed() implementation:
handle_starttag(name, attrs) # See note about return value
handle_endtag(name)
handle_data(data) # Appends to the current data node
endData(containerClass=NavigableString) # Ends the current data node
No matter how complicated the underlying parser is, you should be
able to build a tree using 'start tag' events, 'end tag' events,
'data' events, and "done with data" events.
If you encounter an empty-element tag (aka a self-closing tag,
like HTML's <br> tag), call handle_starttag and then
handle_endtag.
z
[document]ZhtmlZfastz
a No parser was explicitly specified, so I'm using the best available %(markup_type)s parser for this system ("%(parser)s"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.
The code that caused this warning is on line %(line_number)s of the file %(filename)s. To get rid of this warning, change code that looks like this:
BeautifulSoup([your markup])
to this:
BeautifulSoup([your markup], "%(parser)s")
� Nc
s d� krt �d� d� kr*� d= t �d� d� krB� d= t �d� d� krZ� d= t �d� d � krr� d = t �d
� � fdd�}|p�|d
d�}|p�|dd�}|r�t|t�r�t �d� d}t� �dkr�t� �� ��� } td| ��|dk�r�|}
t|t�r�|g}|dk�st|�dk�r| j }t
j|� }|dk�r@tdd�
|� ��|� }|
|jk�s�|
|jk�s�|j�rld}nd}t�� d }
|
d }|
d }t �| jt|||j|d� � || _|j| _| j| _| | j_|| _t|d��r�|�� }n�t|�dk�r�t|t��rd|k�st|t��r�d|k�r�t|t��r@tjj�s@|�d�}n|}d }ytj� |�}W n$ t!k
�r| } zW dd}~X Y nX |�r�t|t��r�|�d�}t �d!| � | �"|� xZ| jj#|||d"�D ]D\| _$| _%| _&| _'| �(� y| �)� P W n t*k
�r Y nX �q�W d| _$d| j_dS )#z�The Soup object is initialized as the 'root tag', and the
provided markup (which can be a string or a file-like object)
is fed into the underlying parser.ZconvertEntitiesz�BS4 does not respect the convertEntities argument to the BeautifulSoup constructor. Entities are always converted to Unicode characters.Z
markupMassagez�BS4 does not respect the markupMassage argument to the BeautifulSoup constructor. The tree builder is responsible for any necessary markup massage.Z
smartQuotesToz�BS4 does not respect the smartQuotesTo argument to the BeautifulSoup constructor. Smart quotes are always converted to Unicode characters.ZselfClosingTagsz�BS4 does not respect the selfClosingTags argument to the BeautifulSoup constructor. The tree builder is responsible for understanding self-closing tags.ZisHTMLz�BS4 does not respect the isHTML argument to the BeautifulSoup constructor. Suggest you use features='lxml' for HTML and features='lxml-xml' for XML.c s0 | � kr,t �d| |f � � | }� | = |S d S )NzLThe "%s" argument to the BeautifulSoup constructor has been renamed to "%s.")�warnings�warn)Zold_name�new_name�value)�kwargs� �=/opt/alt/python37/lib/python3.7/site-packages/bs4/__init__.py�deprecated_argument� s z3BeautifulSoup.__init__.<locals>.deprecated_argumentZparseOnlyThese�
parse_onlyZfromEncoding�
from_encodingzlYou provided Unicode markup but also provided a value for from_encoding. Your from_encoding will be ignored.Nr z2__init__() got an unexpected keyword argument '%s'zjCouldn't find a tree builder with the features you requested: %s. Do you need to install a parser library?�,ZXMLZHTMLr )�filename�line_number�parser�markup_type�read� � <�<�utf8Fzu"%s" looks like a filename, not markup. You shouldprobably open this file and pass the filehandle intoBeautiful Soup.)�exclude_encodings)+r r �
isinstance�str�len�list�keys�pop� TypeError�DEFAULT_BUILDER_FEATURESr �lookup�FeatureNotFound�join�NAMEZALTERNATE_NAMES�is_xml� traceback�
extract_stack�NO_PARSER_SPECIFIED_WARNING�dict�builderZ known_xml�soupr �hasattrr"