3 |��\� � @ sT d Z ddlmZmZ ddlmZ ddlmZm Z m Z dZG dd� de�Zd d � Z dS )zDefused xml.sax.expatreader � )�print_function�absolute_import)�ExpatParser� )�DTDForbidden�EntitiesForbidden�ExternalReferenceForbiddenzxml.sax.expatreaderc @ sB e Zd ZdZddd �Zd d� Zdd � Zdd� Zdd� Zdd� Z dS )�DefusedExpatParserz,Defused SAX driver for the pyexpat C module.r � � � FTc C s$ t j| ||� || _|| _|| _d S )N)�_ExpatParser�__init__� forbid_dtd�forbid_entities�forbid_external)�selfZnamespaceHandling�bufsizer r r � r �!/usr/lib/python3.6/expatreader.pyr s zDefusedExpatParser.__init__c C s t |||��d S )N)r )r �name�sysid�pubidZhas_internal_subsetr r r �defused_start_doctype_decl! s z-DefusedExpatParser.defused_start_doctype_declc C s t ||||||��d S )N)r )r r Zis_parameter_entity�value�baser r � notation_namer r r �defused_entity_decl$ s z&DefusedExpatParser.defused_entity_declc C s t |d ||||��d S )N)r )r r r r r r r r r �defused_unparsed_entity_decl) s z/DefusedExpatParser.defused_unparsed_entity_declc C s t ||||��d S )N)r )r �contextr r r r r r �#defused_external_entity_ref_handler- s z6DefusedExpatParser.defused_external_entity_ref_handlerc C sF t j| � | j}| jr| j|_| jr4| j|_| j |_ | jrB| j|_ d S )N)r �resetZ_parserr r ZStartDoctypeDeclHandlerr r ZEntityDeclHandlerr ZUnparsedEntityDeclHandlerr r ZExternalEntityRefHandler)r �parserr r r r! 0 s zDefusedExpatParser.resetNi �� )r r# FTT) �__name__� __module__�__qualname__�__doc__r r r r r r! r r r r r s r c O s t | |�S )N)r )�args�kwargsr r r � create_parser<