3 |��\� � @ s� d Z ddlZddlZejd dkZeejjd�s8e d��G dd� de �ZG dd � d e�ZG d d� de�Z G dd � d e�ZG dd� de�Zdd� Zdd� ZdS )z1Common constants, exceptions and helpe functions � N� ZParserCreateZpyexpatc @ s e Zd ZdZdd� ZdS )�DefusedXmlExceptionzBase exception c C s t | �S )N)�str)�self� r �/usr/lib/python3.6/common.py�__repr__ s zDefusedXmlException.__repr__N)�__name__� __module__�__qualname__�__doc__r r r r r r s r c s( e Zd ZdZ� fdd�Zdd� Z� ZS )�DTDForbiddenz*Document type definition is forbidden c s$ t t| �j� || _|| _|| _d S )N)�superr �__init__�name�sysid�pubid)r r r r )� __class__r r r s zDTDForbidden.__init__c C s d}|j | j| j| j�S )Nz7DTDForbidden(name='{}', system_id={!r}, public_id={!r}))�formatr r r )r �tplr r r �__str__$ s zDTDForbidden.__str__)r r r r r r � __classcell__r r )r r r s r c s( e Zd ZdZ� fdd�Zdd� Z� ZS )�EntitiesForbiddenz#Entity definition is forbidden c s6 t t| �j� || _|| _|| _|| _|| _|| _d S )N) r r r r �value�baser r � notation_name)r r r r r r r )r r r r - s zEntitiesForbidden.__init__c C s d}|j | j| j| j�S )Nz<EntitiesForbidden(name='{}', system_id={!r}, public_id={!r}))r r r r )r r r r r r 6 s zEntitiesForbidden.__str__)r r r r r r r r r )r r r ) s r c s( e Zd ZdZ� fdd�Zdd� Z� ZS )�ExternalReferenceForbiddenz1Resolving an external reference is forbidden c s* t t| �j� || _|| _|| _|| _d S )N)r r r �contextr r r )r r r r r )r r r r ? s z#ExternalReferenceForbidden.__init__c C s d}|j | j| j�S )Nz8ExternalReferenceForbidden(system_id='{}', public_id={}))r r r )r r r r r r F s z"ExternalReferenceForbidden.__str__)r r r r r r r r r )r r r ; s r c @ s e Zd ZdZdS )�NotSupportedErrorz#The operation is not supported N)r r r r r r r r r K s r c C sj | j }t|i i dg� tj| }tt|��}x8t| �j� D ](\}}|jd�s:||krVq:t |||� q:W |S )N�*�_) Z __origin__� __import__�sys�modules�set�dir�vars�items� startswith�setattr)Zdefused_modZstdlib_nameZ stdlib_modZstdlib_namesr �objr r r �_apply_defusingP s r+ c s>