HEX
Server: LiteSpeed
System: Linux standart9.isimtescil.net 3.10.0-962.3.2.lve1.5.26.7.el7.x86_64 #1 SMP Wed Oct 2 07:53:12 EDT 2019 x86_64
User: karalev (5310)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/bs4/__pycache__/__init__.cpython-37.pyc
B

I.�`�O�@sdZdZdZdZdZdgZddlZddlZddlZddl	Z	dd	l
mZmZdd
l
mZddlmZmZmZmZmZmZmZmZmZmZmZdd
kGdd�de�ZeZeZGdd�de�ZGdd�de�Z Gdd�de!�Z"e#dk�rddl$Z$ee$j%�Z&e'e&�(��dS)aHBeautiful 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`).cs�eZdZdZdZddgZdZdZd2d	d
�Zdd�Z	d
d�Z
edd��Zdd�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)7ra
    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 
	
aNo 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@tdd�
|���|�}|
|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� |�}Wn$t!k
�r|}zWdd}~XYnX|�r�t|t��r�|�d�}t�d!|�|�"|�xZ|jj#|||d"�D]D\|_$|_%|_&|_'|�(�y|�)�PWnt*k
�rYnX�q�Wd|_$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.cs0|�kr,t�d||f��|}�|=|SdS)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_onlyZfromEncoding�
from_encodingzlYou provided Unicode markup but also provided a value for from_encoding. Your from_encoding will be ignored.Nrz2__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)+rr�
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"�bytes�os�path�supports_unicode_filenames�encode�exists�	Exception�_check_markup_is_urlZprepare_markup�markup�original_encodingZdeclared_html_encodingZcontains_replacement_characters�reset�_feedr)�selfrD�featuresr9rrr'rr�argZoriginal_featuresZ
builder_classr!ZcallerrrZpossible_filename�is_file�er)rr�__init__Ws�











 zBeautifulSoup.__init__cCs&t|�|�d�|jdd�}|j|_|S)Nzutf-8)r9r)�typer@r9rE)rH�copyrrr�__copy__�szBeautifulSoup.__copy__cCs&t|j�}d|kr"|jjs"d|d<|S)Nr9)r8�__dict__r9Z	picklable)rH�drrr�__getstate__�s
zBeautifulSoup.__getstate__csxt�t�rd}d}nt�t�r(d}d}ndSt�fdd�|D��rt|�krtt�t�rb��dd	�}n�}t�d
|�dS)z� 
        Check if markup looks like it's actually a url and raise a warning 
        if so. Markup can be unicode or str (py2) / bytes (py3).
        � )shttp:shttps:� )zhttp:zhttps:Nc3s|]}��|�VqdS)N)�
startswith)�.0�prefix)rDrr�	<genexpr>sz5BeautifulSoup._check_markup_is_url.<locals>.<genexpr>zutf-8�replacez�"%s" looks like a URL. Beautiful Soup is not an HTTP client. You should probably use an HTTP client like requests to get the document behind the URL, and feed that document to Beautiful Soup.)r(r<r)�any�decoderr)rDZspaceZcant_start_withZdecoded_markupr)rDrrCs


z"BeautifulSoup._check_markup_is_urlcCs@|j��|j�|j�|��x|jj|jkr:|��q"WdS)N)	r9rFZfeedrD�endData�
currentTag�name�
ROOT_TAG_NAME�popTag)rHrrrrGs

zBeautifulSoup._feedcCsJt�|||j|j�d|_|j��g|_d|_g|_g|_	|�
|�dS)Nr)rrMr9r`ZhiddenrF�current_datar^�tagStack�preserve_whitespace_tag_stack�pushTag)rHrrrrF's
zBeautifulSoup.resetcKstd|j||||�S)z+Create a new tag associated with this soup.N)rr9)rHr_�	namespace�nsprefix�attrsrrr�new_tag1szBeautifulSoup.new_tagcCs||�S)z7Create a new NavigableString associated with this soup.r)rH�s�subclassrrr�
new_string5szBeautifulSoup.new_stringcCstd��dS)Nz4BeautifulSoup objects don't support insert_before().)�NotImplementedError)rH�	successorrrr�
insert_before9szBeautifulSoup.insert_beforecCstd��dS)Nz3BeautifulSoup objects don't support insert_after().)rm)rHrnrrr�insert_after<szBeautifulSoup.insert_aftercCs@|j��}|jr(||jdkr(|j��|jr:|jd|_|jS)N���)rcr-rdr^)rH�tagrrrra?s

zBeautifulSoup.popTagcCsJ|jr|jj�|�|j�|�|jd|_|j|jjkrF|j�|�dS)Nrq)r^�contents�appendrcr_r9Zpreserve_whitespace_tagsrd)rHrrrrrreHszBeautifulSoup.pushTagcCs�|jr�d�|j�}|jsPd}x|D]}||jkr"d}Pq"W|rPd|krLd}nd}g|_|jr�t|j�dkr�|jjr~|j�|�s�dS||�}|�	|�dS)NrTF�
rUr)
rbr2rd�ASCII_SPACESrr*rc�text�search�object_was_parsed)rHZcontainerClassrbZ
strippable�i�orrrr]Qs&

zBeautifulSoup.endDatac	CsV|p|j}|p|j}d}}}t|t�rF|j}|j}|j}|sF|j}|�|||||�||_|j	�
|�|j�rRt|j	�d}x4|dkr�|j	||kr�P|d8}q�Wtd||f��|dkr�|}d}n|j	|d}}|t|j	�dkr�|j}d}n|j	|d}}||_|�r||_||_|�r.||_||_|�r@||_||_|�rR||_dS)z Add an object to the parse tree.Nrrz[Error building tree: supposedly %r was inserted into %r after the fact, but I don't see it!)
r^�_most_recent_elementr(r�next_element�next_sibling�previous_sibling�previous_elementZsetuprsrtr*�
ValueError)	rHr{�parentZmost_recent_elementr�r}rr~�indexrrrryosR



zBeautifulSoup.object_was_parsedTcCsn||jkrdSd}t|j�}xLt|ddd�D]8}|j|}||jkr^||jkr^|r\|��}P|��}q.W|S)z�Pops the tag stack up to and including the most recent
        instance of the given tag. If inclusivePop is false, pops the tag
        stack up to but *not* including the most recent instqance of
        the given tag.Nrrrq)r`r*rc�ranger_rXra)rHr_rgZinclusivePopZmost_recently_popped�
stack_sizerz�trrr�	_popToTag�s


zBeautifulSoup._popToTagc	Cs�|��|jr6t|j�dkr6|jjs2|j�||�s6dSt||j|||||j|j	�}|dkr^|S|j	rl||j	_
||_	|�|�|S)aPush a start tag on to the stack.

        If this method returns None, the tag was rejected by the
        SoupStrainer. You should proceed as if the tag had not occurred
        in the document. For instance, if this was a self-closing tag,
        don't call handle_endtag.
        rN)r]rr*rcrwZ
search_tagrr9r^r|r}re)rHr_rfrgrhrrrrr�handle_starttag�s

zBeautifulSoup.handle_starttagcCs|��|�||�dS)N)r]r�)rHr_rgrrr�
handle_endtag�szBeautifulSoup.handle_endtagcCs|j�|�dS)N)rbrt)rH�datarrr�handle_data�szBeautifulSoup.handle_dataFZminimalcsN|jr$d}|dkrd|}d|}nd}|s2d}nd}|tt|��|||�S)zlReturns a string or Unicode representation of this document.
        To get Unicode, pass None for encoding.rNz encoding="%s"z<?xml version="1.0"%s?>
r)r4�superrr\)rHZpretty_printZeventual_encodingZ	formatterZ
encoding_partrXZindent_level)�	__class__rrr\�s
zBeautifulSoup.decode)rNNNNN)NN)NN)NT)N)�__name__�
__module__�__qualname__�__doc__r`r/rvr7rMrPrS�staticmethodrCrGrFrirrlrorprarer]ryr�r�r�r�r	r\�
__classcell__rr)r�rr7s8



		
9

cs eZdZdZ�fdd�Z�ZS)�BeautifulStoneSoupz&Deprecated interface to an XML parser.cs(d|d<t�d�tt|�j||�dS)NZxmlrIzxThe BeautifulStoneSoup class is deprecated. Instead of using it, pass features="xml" into the BeautifulSoup constructor.)rrr�r�rM)rH�argsr)r�rrrM�szBeautifulStoneSoup.__init__)r�r�r�r�rMr�rr)r�rr��sr�c@seZdZdS)�StopParsingN)r�r�r�rrrrr�sr�c@seZdZdS)r1N)r�r�r�rrrrr1	sr1�__main__))r��
__author__�__version__Z
__copyright__Z__license__�__all__r=�rer5rr9rrZdammitrZelementrrr	r
rrr
rrrrrZ_sZ_soupr�rBr�r�r1r��sys�stdinr:�printZprettifyrrrr�<module>s44D