3 T�\Y � @ s� d Z ddlmZmZ ddlZddlZddlmZ ddl m Z mZmZ ej d dkZdZejZejd ed d� G dd � d ej�ZG dd� dej�Ze� ZejZddd�Zddd�Zddd�ZeZdd� ZdS )zkDEPRECATED Example code for lxml.etree protection The code has NO protection against decompression bombs. � )�print_function�absolute_importN)�etree� )�DTDForbidden�EntitiesForbidden�NotSupportedError� z lxml.etreezOdefusedxml.lxml is no longer supported and will be removed in a future release.� )�category� stacklevelc s� e Zd ZdZf ZejZdd� Z� fdd�Z d� fdd � Z d� fd d� Zd� fdd � Zd� fdd� Z � fdd�Zd� fdd� Z� ZS )�RestrictedElementzJA restricted Element class that filters out instances of some classes c c s* | j }x|D ]}t||�rq|V qW d S )N)� blacklist� isinstance)�self�iteratorr Zchild� r �/usr/lib/python3.6/lxml.py�_filter) s zRestrictedElement._filterc s t t| �j� }| j|�S )N)�superr �__iter__r )r r )� __class__r r r 0 s zRestrictedElement.__iter__NFc s t t| �j||d�}| j|�S )N)�tag�reversed)r r �iterchildrenr )r r r r )r r r r 4 s zRestrictedElement.iterchildrenc s t t| �j|d|i�}| j|�S )Nr )r r �iterr )r r �tagsr )r r r r 8 s zRestrictedElement.iterc s t t| �j|d|i�}| j|�S )Nr )r r �iterdescendantsr )r r r r )r r r r <