AlkantarClanX12

Your IP : 3.23.101.60


Current Path : /opt/alt/python37/lib64/python3.7/site-packages/lxml/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/site-packages/lxml/__pycache__/ElementInclude.cpython-37.pyc

B

o��]p!�@s�dZddlmZyddlmZddlmZWn,ek
rXddlmZddl	mZYnXdZ
e
dZe
dZe
dZ
d	ZGd
d�dej�ZGdd
�d
e�Zddd�Zddd�Zdd�Zddefdd�Zddedfdd�ZdS)a
Limited XInclude support for the ElementTree package.

While lxml.etree has full support for XInclude (see
`etree.ElementTree.xinclude()`), this module provides a simpler, pure
Python, ElementTree compatible implementation that supports a simple
form of custom URL resolvers.
�)�etree)�urljoin)�urlopenz!{http://www.w3.org/2001/XInclude}�include�fallback�*�c@seZdZdS)�FatalIncludeErrorN)�__name__�
__module__�__qualname__�r
r
�F/opt/alt/python37/lib64/python3.7/site-packages/lxml/ElementInclude.pyr	Ksr	c@seZdZdS)�LimitedRecursiveIncludeErrorN)r
rrr
r
r
rrOsrNcCsHt|d�}|dkr"t�|���}n|��}|s2d}|�|�}|��|S)N�rb�xmlzutf-8)�openr�parse�getroot�read�decode�close)�hrefr�encoding�file�datar
r
r�default_loader`s

rcCs\|dkrt�||���}n>d|kr,t|�}n
t|d�}|��}|��|sNd}|�|�}|S)Nrz://rzutf-8)rrrrrrrr)rrr�parserr�fr
r
r�_lxml_default_loaderqs


rcsd�fdd�	}|S)Ncs�|||�S)Nr
)rrrr)�loaderr
r�load�sz_wrap_et_loader.<locals>.load)NNr
)r r!r
)r r�_wrap_et_loader�sr"cCs�|dkrd}n|dkr"td|��|dkr^t|d�rB|}|��}n|��}t|d�rp|jj}nt|d�rp|��}t||||�dS)N���rz;expected non-negative depth or None for 'max_depth', got %rr�docinfo)�
ValueError�hasattrr�getroottreer$�URL�_include)�elemr �base_url�	max_depth�treer
r
rr�s




cCs|dk	rt|�}nt}|dkr$t�}|��j}t|�t��}�x�|D�]�}|jt	k�r�t
||�d��}	|�dd�}
|��}|
dk�r"|	|kr�t
d|	��|dkr�td|	��||	|
|d�}|dkr�t
d|	|
f��t|||	|d	|	h|B�}|j�r|jp�d
|j|_|dk�r|S|�||�n�|
dk�r�||	|
|�d�d
�}
|
dk�rZt
d|	|
f��|��}|dk	�r�|j�pvd
|
|_n,|dk�r�|
S|j�p�d
|
|j�p�d
|_|�|�nt
d|
��qD|jtk�r|��}|dk	�r|jt	k�rt
d|j��qDt
d|j��qDW|S)Nrrrz recursive include of %r detectedrz5maximum xinclude depth reached when including file %s)rzcannot load %r as %r���textr)rz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r)z0Invalid element found in XInclude namespace (%r))r"r�setr'r�list�iter�XINCLUDE_ITER_TAG�tag�XINCLUDE_INCLUDEr�getZ	getparentr	rr)�tail�replaceZgetpreviousr0�remove�XINCLUDE_FALLBACK)r*r r+r,Z
_parent_hrefsZload_includerZinclude_elements�err�parent�noder0Zpredecessorr
r
rr)�sh









r))N)NN)�__doc__�lxmlr�urlparserZurllib2r�ImportError�urllib.parseZurllib.requestZXINCLUDEr6r;r4ZDEFAULT_MAX_INCLUSION_DEPTHZLxmlSyntaxErrorr	rrrr"rr)r
r
r
r�<module>3s*