ÿØÿà JFIF    ÿÛ „ ( %!1!%*+...983,7(-.- PK|]_&00(__pycache__/handler.cpython-36.opt-1.pycnu[3 \b6@sdZdZGdddZGdddZGdddZGdd d Zd Zd Zd Zd Z dZ dZ eeee e e gZ dZ dZdZdZdZdZe eeeeegZdS)a0 This module contains the core classes of version 2.0 of SAX for Python. This file provides only default classes with absolutely minimum functionality, from which drivers and applications can be subclassed. Many of these classes are empty and are included only as documentation of the interfaces. $Id$ z2.0betac@s(eZdZdZddZddZddZdS) ErrorHandleraBasic interface for SAX error handlers. If you create an object that implements this interface, then register the object with your XMLReader, the parser will call the methods in your object to report all warnings and errors. There are three levels of errors available: warnings, (possibly) recoverable errors, and unrecoverable errors. All methods take a SAXParseException as the only parameter.cCs|dS)zHandle a recoverable error.N)self exceptionrr'/usr/lib64/python3.6/xml/sax/handler.pyerror szErrorHandler.errorcCs|dS)zHandle a non-recoverable error.Nr)rrrrr fatalError$szErrorHandler.fatalErrorcCs t|dS)zHandle a warning.N)print)rrrrrwarning(szErrorHandler.warningN)__name__ __module__ __qualname____doc__rrr rrrrrsrc@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZdS)ContentHandlerzInterface for receiving logical document content events. This is the main callback interface in SAX, and the one most important to applications. The order of events in this interface mirrors the order of the information in the document.cCs d|_dS)N)_locator)rrrr__init__6szContentHandler.__init__cCs ||_dS)a#Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface. The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine. Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.N)r)rZlocatorrrrsetDocumentLocator9sz!ContentHandler.setDocumentLocatorcCsdS)zReceive notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).Nr)rrrr startDocumentPszContentHandler.startDocumentcCsdS)aQReceive notification of the end of a document. The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.Nr)rrrr endDocumentWszContentHandler.endDocumentcCsdS)aBegin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default). There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary. Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.Nr)rprefixZurirrrstartPrefixMapping`sz!ContentHandler.startPrefixMappingcCsdS)zEnd the scope of a prefix-URI mapping. See startPrefixMapping for details. This event will always occur after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.Nr)rrrrrendPrefixMappingwszContentHandler.endPrefixMappingcCsdS)aSignals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an instance of the Attributes class containing the attributes of the element.Nr)rnameattrsrrr startElement~szContentHandler.startElementcCsdS)zSignals the end of an element in non-namespace mode. The name parameter contains the name of the element type, just as with the startElement event.Nr)rrrrr endElementszContentHandler.endElementcCsdS)aSignals the start of an element in namespace mode. The name parameter contains the name of the element type as a (uri, localname) tuple, the qname parameter the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the Attributes class containing the attributes of the element. The uri part of the name tuple is None for elements which have no namespace.Nr)rrqnamerrrrstartElementNSszContentHandler.startElementNScCsdS)zSignals the end of an element in namespace mode. The name parameter contains the name of the element type, just as with the startElementNS event.Nr)rrrrrr endElementNSszContentHandler.endElementNScCsdS)aReceive notification of character data. The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.Nr)rZcontentrrr charactersszContentHandler.characterscCsdS)awReceive notification of ignorable whitespace in element content. Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.Nr)rZ whitespacerrrignorableWhitespacesz"ContentHandler.ignorableWhitespacecCsdS)aReceive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.Nr)rtargetdatarrrprocessingInstructionsz$ContentHandler.processingInstructioncCsdS)aReceive notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.Nr)rrrrr skippedEntityszContentHandler.skippedEntityN)r r r r rrrrrrrrrrrrr"r#rrrrr/s    rc@s eZdZdZddZddZdS) DTDHandlerzHandle DTD events. This interface specifies only those DTD events required for basic parsing (unparsed entities and attributes).cCsdS)z$Handle a notation declaration event.Nr)rrpublicIdsystemIdrrr notationDeclszDTDHandler.notationDeclcCsdS)z,Handle an unparsed entity declaration event.Nr)rrr%r&ZndatarrrunparsedEntityDeclszDTDHandler.unparsedEntityDeclN)r r r r r'r(rrrrr$sr$c@seZdZdZddZdS)EntityResolvera7Basic interface for resolving entities. If you create an object implementing this interface, then register the object with your Parser, the parser will call the method in your object to resolve all external entities. Note that DefaultHandler implements this interface with the default behaviour.cCs|S)zResolve the system identifier of an entity and return either the system identifier to read from as a string, or an InputSource to read from.r)rr%r&rrr resolveEntityszEntityResolver.resolveEntityN)r r r r r*rrrrr)sr)z&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictN)r versionrrr$r)Zfeature_namespacesZfeature_namespace_prefixesZfeature_string_interningZfeature_validationZfeature_external_gesZfeature_external_pesZ all_featuresZproperty_lexical_handlerZproperty_declaration_handlerZproperty_dom_nodeZproperty_xml_stringZproperty_encodingZproperty_interning_dictZall_propertiesrrrr s< "  PK|]}>>)__pycache__/__init__.cpython-36.opt-2.pycnu[3 \.@s ddlmZddlmZmZddlmZmZmZm Z m Z efddZ efddZ dgZ d Zerjd d lZd d lZd d lZejj rd ejkrejd jd Z [d Zejd ddkrejjerejjejd Z gfddZejd ddkrddZnddZ[d S)) InputSource)ContentHandler ErrorHandler) SAXExceptionSAXNotRecognizedExceptionSAXParseExceptionSAXNotSupportedExceptionSAXReaderNotAvailablecCs(t}|j||j||j|dS)N) make_parsersetContentHandlersetErrorHandlerparse)sourcehandler errorHandlerparserr(/usr/lib64/python3.6/xml/sax/__init__.pyr s  r cCspddl}|dkrt}t}|j||j|t}t|trR|j|j |n|j |j ||j |dS)N) iorr r r r isinstancestrZsetCharacterStreamStringIOZ setByteStreamBytesIOr )stringrrrrZinpsrcrrr parseString#s   rzxml.sax.expatreaderrNZ PY_SAX_PARSER,zpython.xml.sax.parserjavacCsrxb|tD]V}yt|Stk rL}zddl}||jkr<WYdd}~Xq tk r^Yq Xq WtdddS)NrzNo parsers found)default_parser_list_create_parser ImportErrorsysmodulesr )Z parser_list parser_nameer"rrrr Fs  r cCs$ddlm}|j|dt}|jS)Nr)imp)Zorg.python.corer&Z importNameglobals create_parser)r$r& drv_modulerrrr as r cCst|iidg}|jS)Nr() __import__r()r$r)rrrr gs)Z xmlreaderrrrr _exceptionsrrrrr r rr_falseZxml.sax.expatreaderZxmlosr"flagsignore_environmentenvironsplitZ_keyplatformregistryZ containsKeyZ getPropertyr r rrrrs(   PK|]+((*__pycache__/xmlreader.cpython-36.opt-2.pycnu[3 \1@sddlmZddlmZmZGdddZGdddeZGdddZGd d d ZGd d d Z Gd dde Z ddZ e dkre dS))handler)SAXNotSupportedExceptionSAXNotRecognizedExceptionc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdS) XMLReadercCs,tj|_tj|_tj|_tj|_dS)N) rZContentHandler _cont_handlerZ DTDHandler _dtd_handlerZEntityResolver _ent_handlerZ ErrorHandler _err_handler)selfr )/usr/lib64/python3.6/xml/sax/xmlreader.py__init__s   zXMLReader.__init__cCs tddS)Nz This method must be implemented!)NotImplementedError)r sourcer r r parseszXMLReader.parsecCs|jS)N)r)r r r r getContentHandler"szXMLReader.getContentHandlercCs ||_dS)N)r)r rr r r setContentHandler&szXMLReader.setContentHandlercCs|jS)N)r)r r r r getDTDHandler*szXMLReader.getDTDHandlercCs ||_dS)N)r)r rr r r setDTDHandler.szXMLReader.setDTDHandlercCs|jS)N)r)r r r r getEntityResolver2szXMLReader.getEntityResolvercCs ||_dS)N)r)r Zresolverr r r setEntityResolver6szXMLReader.setEntityResolvercCs|jS)N)r )r r r r getErrorHandler:szXMLReader.getErrorHandlercCs ||_dS)N)r )r rr r r setErrorHandler>szXMLReader.setErrorHandlercCs tddS)NzLocale support not implemented)r)r Zlocaler r r setLocaleBszXMLReader.setLocalecCstd|dS)NzFeature '%s' not recognized)r)r namer r r getFeatureKszXMLReader.getFeaturecCstd|dS)NzFeature '%s' not recognized)r)r rstater r r setFeatureOszXMLReader.setFeaturecCstd|dS)NzProperty '%s' not recognized)r)r rr r r getPropertySszXMLReader.getPropertycCstd|dS)NzProperty '%s' not recognized)r)r rvaluer r r setPropertyWszXMLReader.setPropertyN)__name__ __module__ __qualname__r rrrrrrrrrrrrrr r r r r r s  rc@s>eZdZdddZddZddZd d Zd d Zd dZdS)IncrementalParsercCs||_tj|dS)N)_bufsizerr )r bufsizer r r r oszIncrementalParser.__init__cCspddlm}|j|}|j||j}|dkr8|j}|j|j}x|rb|j||j|j}qFW|j dS)Nr)saxutils) r)Zprepare_input_source prepareParsergetCharacterStream getByteStreamreadr'feedclose)r rr)filebufferr r r rss     zIncrementalParser.parsecCs tddS)Nz This method must be implemented!)r)r datar r r r/szIncrementalParser.feedcCs tddS)Nz!prepareParser must be overridden!)r)r rr r r r+szIncrementalParser.prepareParsercCs tddS)Nz This method must be implemented!)r)r r r r r0s zIncrementalParser.closecCs tddS)Nz This method must be implemented!)r)r r r r resetszIncrementalParser.resetN)r5) r!r"r#r rr/r+r0r4r r r r r$[s    r$c@s,eZdZddZddZddZddZd S) LocatorcCsdS)Nrr )r r r r getColumnNumberszLocator.getColumnNumbercCsdS)Nrr7r )r r r r getLineNumberszLocator.getLineNumbercCsdS)Nr )r r r r getPublicIdszLocator.getPublicIdcCsdS)Nr )r r r r getSystemIdszLocator.getSystemIdN)r!r"r#r8r9r:r;r r r r r6sr6c@sfeZdZdddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ dS) InputSourceNcCs"||_d|_d|_d|_d|_dS)N)_InputSource__system_id_InputSource__public_id_InputSource__encoding_InputSource__bytefile_InputSource__charfile)r system_idr r r r s zInputSource.__init__cCs ||_dS)N)r>)r Z public_idr r r setPublicIdszInputSource.setPublicIdcCs|jS)N)r>)r r r r r:szInputSource.getPublicIdcCs ||_dS)N)r=)r rBr r r setSystemIdszInputSource.setSystemIdcCs|jS)N)r=)r r r r r;szInputSource.getSystemIdcCs ||_dS)N)r?)r encodingr r r setEncodingszInputSource.setEncodingcCs|jS)N)r?)r r r r getEncodingszInputSource.getEncodingcCs ||_dS)N)r@)r Zbytefiler r r setByteStreams zInputSource.setByteStreamcCs|jS)N)r@)r r r r r-szInputSource.getByteStreamcCs ||_dS)N)rA)r Zcharfiler r r setCharacterStreamszInputSource.setCharacterStreamcCs|jS)N)rA)r r r r r,szInputSource.getCharacterStream)N)r!r"r#r rCr:rDr;rFrGrHr-rIr,r r r r r<s    r<c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZd$ddZddZd d!Zd"d#ZdS)%AttributesImplcCs ||_dS)N)_attrs)r attrsr r r r szAttributesImpl.__init__cCs t|jS)N)lenrK)r r r r getLengthszAttributesImpl.getLengthcCsdS)NZCDATAr )r rr r r getType!szAttributesImpl.getTypecCs |j|S)N)rK)r rr r r getValue$szAttributesImpl.getValuecCs |j|S)N)rK)r rr r r getValueByQName'szAttributesImpl.getValueByQNamecCs||jkrt||S)N)rKKeyError)r rr r r getNameByQName*s zAttributesImpl.getNameByQNamecCs||jkrt||S)N)rKrR)r rr r r getQNameByName/s zAttributesImpl.getQNameByNamecCst|jjS)N)listrKkeys)r r r r getNames4szAttributesImpl.getNamescCst|jjS)N)rUrKrV)r r r r getQNames7szAttributesImpl.getQNamescCs t|jS)N)rMrK)r r r r __len__:szAttributesImpl.__len__cCs |j|S)N)rK)r rr r r __getitem__=szAttributesImpl.__getitem__cCst|jjS)N)rUrKrV)r r r r rV@szAttributesImpl.keyscCs ||jkS)N)rK)r rr r r __contains__CszAttributesImpl.__contains__NcCs|jj||S)N)rKget)r r alternativer r r r\FszAttributesImpl.getcCs |j|jS)N) __class__rK)r r r r copyIszAttributesImpl.copycCst|jjS)N)rUrKitems)r r r r r`LszAttributesImpl.itemscCst|jjS)N)rUrKvalues)r r r r raOszAttributesImpl.values)N)r!r"r#r rNrOrPrQrSrTrWrXrYrZrVr[r\r_r`rar r r r rJs" rJc@s<eZdZddZddZddZddZd d Zd d Zd S)AttributesNSImplcCs||_||_dS)N)rK_qnames)r rLZqnamesr r r r VszAttributesNSImpl.__init__cCs6x(|jjD]\}}||kr |j|Sq Wt|dS)N)rcr`rKrR)r rnsnameqnamer r r rQ^sz AttributesNSImpl.getValueByQNamecCs0x"|jjD]\}}||kr |Sq Wt|dS)N)rcr`rR)r rrdrer r r rSeszAttributesNSImpl.getNameByQNamecCs |j|S)N)rc)r rr r r rTlszAttributesNSImpl.getQNameByNamecCst|jjS)N)rUrcra)r r r r rXoszAttributesNSImpl.getQNamescCs|j|j|jS)N)r^rKrc)r r r r r_rszAttributesNSImpl.copyN) r!r"r#r rQrSrTrXr_r r r r rbTs rbcCstttdS)N)rr$r6r r r r _testvsrf__main__N) r*r _exceptionsrrrr$r6r<rJrbrfr!r r r r s PJY>"PK|]oڐ++)__pycache__/saxutils.cpython-36.opt-2.pycnu[3 \/@sddlZddlZddlZddlZddlZddlmZddlmZddZ ifddZ ifd d Z ifd d Z d dZ GdddejZGdddejZdddZdS)N)handler) xmlreadercCs&x |jD]\}}|j||}q W|S)N)itemsreplace)sdkeyvaluer (/usr/lib64/python3.6/xml/sax/saxutils.py__dict_replace sr cCs6|jdd}|jdd}|jdd}|r2t||}|S)N&z&>z>._wrappercs t|S)N)getattr)selfname)outr r __getattr__[sz,_gettextwriter.._wrapper.__getattr__N)__name__ __module__ __qualname__ __class__r!r )r r r _wrapperYsr&cSsdS)Nr r r r r ^sz _gettextwriter..cSsdS)NTr r r r r r'csxmlcharrefreplacerT)encodingerrorsnewline write_through)sysstdout isinstanceio TextIOBasecodecs StreamWriterStreamReaderWriter RawIOBasecloseBufferedIOBasewritablewriteseekabletellAttributeError TextIOWrapper)r r)r-r&bufferr )r r _gettextwriterHs.     r?c@seZdZd ddZddZd!dd Zd d Zd d ZddZddZ ddZ ddZ ddZ ddZ ddZddZddZdS)" XMLGeneratorN iso-8859-1FcCsVtjj|t||}|j|_|j|_ig|_|jd|_ g|_ ||_ ||_ d|_ dS)NrF)rContentHandler__init__r?r9_writeflush_flush _ns_contexts_current_context_undeclared_ns_maps _encoding_short_empty_elements_pending_start_element)rr r)Zshort_empty_elementsr r r rDss   zXMLGenerator.__init__cCsJ|drBd|dkr d|dS|j|d}|rB|d|dS|dS)Nrz$http://www.w3.org/XML/1998/namespacezxml:r:)rI)rrprefixr r r _qnames  zXMLGenerator._qnamecCs|jr|jdd|_dS)NrF)rMrE)r endElementr r r _finish_pending_start_elements z*XMLGenerator._finish_pending_start_elementcCs|jd|jdS)Nz$ )rErK)rr r r startDocumentszXMLGenerator.startDocumentcCs |jdS)N)rG)rr r r endDocumentszXMLGenerator.endDocumentcCs0|jj|jj||j|<|jj||fdS)N)rHappendrIrrJ)rrOurir r r startPrefixMappings zXMLGenerator.startPrefixMappingcCs|jd|_|jd=dS)NrrBrB)rHrI)rrOr r r endPrefixMappings zXMLGenerator.endPrefixMappingcCs^|j|jd|x*|jD]\}}|jd|t|fq W|jrPd|_n |jddS)Nrz %s=%sTr)rRrErrrLrM)rrattrsr r r r startElementszXMLGenerator.startElementcCs*|jr|jdd|_n|jd|dS)Nz/>Fz)rMrE)rrr r r rQs zXMLGenerator.endElementcCs|j|jd|j|x8|jD].\}}|rD|jd||fq$|jd|q$Wg|_x0|jD]$\}}|jd|j|t|fqfW|jrd|_n |jddS)Nrz xmlns:%s="%s"z xmlns="%s"z %s=%sTr)rRrErPrJrrrLrM)rrqnamerYrOrVr r r r startElementNSs zXMLGenerator.startElementNScCs0|jr|jdd|_n|jd|j|dS)Nz/>Fz)rMrErP)rrr[r r r endElementNSs zXMLGenerator.endElementNScCs4|r0|jt|ts"t||j}|jt|dS)N)rRr/strrKrEr)rcontentr r r characterss   zXMLGenerator.characterscCs0|r,|jt|ts"t||j}|j|dS)N)rRr/r^rKrE)rr_r r r ignorableWhitespaces   z XMLGenerator.ignorableWhitespacecCs|j|jd||fdS)Nz )rRrE)rtargetrr r r processingInstructionsz"XMLGenerator.processingInstruction)NrAF)F)r"r#r$rDrPrRrSrTrWrXrZrQr\r]r`rarcr r r r r@qs   r@c@seZdZd:ddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9ZdS); XMLFilterBaseNcCstjj|||_dS)N)r XMLReaderrD_parent)rparentr r r rDs zXMLFilterBase.__init__cCs|jj|dS)N) _err_handlererror)r exceptionr r r riszXMLFilterBase.errorcCs|jj|dS)N)rh fatalError)rrjr r r rkszXMLFilterBase.fatalErrorcCs|jj|dS)N)rhwarning)rrjr r r rlszXMLFilterBase.warningcCs|jj|dS)N) _cont_handlersetDocumentLocator)rZlocatorr r r rnsz XMLFilterBase.setDocumentLocatorcCs|jjdS)N)rmrS)rr r r rSszXMLFilterBase.startDocumentcCs|jjdS)N)rmrT)rr r r rTszXMLFilterBase.endDocumentcCs|jj||dS)N)rmrW)rrOrVr r r rWsz XMLFilterBase.startPrefixMappingcCs|jj|dS)N)rmrX)rrOr r r rX szXMLFilterBase.endPrefixMappingcCs|jj||dS)N)rmrZ)rrrYr r r rZ szXMLFilterBase.startElementcCs|jj|dS)N)rmrQ)rrr r r rQszXMLFilterBase.endElementcCs|jj|||dS)N)rmr\)rrr[rYr r r r\szXMLFilterBase.startElementNScCs|jj||dS)N)rmr])rrr[r r r r]szXMLFilterBase.endElementNScCs|jj|dS)N)rmr`)rr_r r r r`szXMLFilterBase.characterscCs|jj|dS)N)rmra)rcharsr r r rasz!XMLFilterBase.ignorableWhitespacecCs|jj||dS)N)rmrc)rrbrr r r rcsz#XMLFilterBase.processingInstructioncCs|jj|dS)N)rm skippedEntity)rrr r r rp!szXMLFilterBase.skippedEntitycCs|jj|||dS)N) _dtd_handler notationDecl)rrpublicIdsystemIdr r r rr&szXMLFilterBase.notationDeclcCs|jj||||dS)N)rqunparsedEntityDecl)rrrsrtZndatar r r ru)sz XMLFilterBase.unparsedEntityDeclcCs|jj||S)N)Z _ent_handler resolveEntity)rrsrtr r r rv.szXMLFilterBase.resolveEntitycCs@|jj||jj||jj||jj||jj|dS)N)rfZsetContentHandlerZsetErrorHandlerZsetEntityResolverZ setDTDHandlerparse)rsourcer r r rw3s     zXMLFilterBase.parsecCs|jj|dS)N)rf setLocale)rZlocaler r r ry:szXMLFilterBase.setLocalecCs |jj|S)N)rf getFeature)rrr r r rz=szXMLFilterBase.getFeaturecCs|jj||dS)N)rf setFeature)rrstater r r r{@szXMLFilterBase.setFeaturecCs |jj|S)N)rf getProperty)rrr r r r}CszXMLFilterBase.getPropertycCs|jj||dS)N)rf setProperty)rrr r r r r~FszXMLFilterBase.setPropertycCs|jS)N)rf)rr r r getParentKszXMLFilterBase.getParentcCs ||_dS)N)rf)rrgr r r setParentNszXMLFilterBase.setParent)N)r"r#r$rDrirkrlrnrSrTrWrXrZrQr\r]r`rarcrprrrurvrwryrzr{r}r~rrr r r r rds8 rdcCs t|trtj|}n^t|drt|}tj}t|jdtrH|j|n |j|t|drtt|jtrt|j |j|j dko|j dkr|j }t jjt jj|}t jj||}t jj|r|j |t|d}n$|j tjj||tjj|j }|j||S)Nreadrrrb)r/r^rZ InputSourcehasattrrZsetCharacterStreamZ setByteStreamrZ setSystemIdZgetCharacterStreamZ getByteStreamZ getSystemIdospathdirnamenormpathjoinisfileopenurllibrwZurljoinZrequestZurlopen)rxbasefZsysidZbaseheadZ sysidfilenamer r r prepare_input_sourceSs*          r)r)rZ urllib.parserZurllib.requestr0r2rrrr rrrr?rCr@rerdrr r r r s     )soPK|]leBB$__pycache__/xmlreader.cpython-36.pycnu[3 \1@sdZddlmZddlmZmZGdddZGdddeZGdd d ZGd d d Z Gd d d Z Gddde Z ddZ e dkre dS)z]An XML Reader is the SAX 2 name for an XML parser. XML Parsers should be based on this code. )handler)SAXNotSupportedExceptionSAXNotRecognizedExceptionc@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZddZd S)! XMLReadera%Interface for reading an XML document using callbacks. XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse. All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.cCs,tj|_tj|_tj|_tj|_dS)N) rZContentHandler _cont_handlerZ DTDHandler _dtd_handlerZEntityResolver _ent_handlerZ ErrorHandler _err_handler)selfr )/usr/lib64/python3.6/xml/sax/xmlreader.py__init__s   zXMLReader.__init__cCs tddS)zAParse an XML document from a system identifier or an InputSource.z This method must be implemented!N)NotImplementedError)r sourcer r r parseszXMLReader.parsecCs|jS)z#Returns the current ContentHandler.)r)r r r r getContentHandler"szXMLReader.getContentHandlercCs ||_dS)z:Registers a new object to receive document content events.N)r)r rr r r setContentHandler&szXMLReader.setContentHandlercCs|jS)z Returns the current DTD handler.)r)r r r r getDTDHandler*szXMLReader.getDTDHandlercCs ||_dS)z7Register an object to receive basic DTD-related events.N)r)r rr r r setDTDHandler.szXMLReader.setDTDHandlercCs|jS)z#Returns the current EntityResolver.)r)r r r r getEntityResolver2szXMLReader.getEntityResolvercCs ||_dS)z0Register an object to resolve external entities.N)r)r Zresolverr r r setEntityResolver6szXMLReader.setEntityResolvercCs|jS)z!Returns the current ErrorHandler.)r )r r r r getErrorHandler:szXMLReader.getErrorHandlercCs ||_dS)z3Register an object to receive error-message events.N)r )r rr r r setErrorHandler>szXMLReader.setErrorHandlercCs tddS)aHAllow an application to set the locale for errors and warnings. SAX parsers are not required to provide localization for errors and warnings; if they cannot support the requested locale, however, they must raise a SAX exception. Applications may request a locale change in the middle of a parse.zLocale support not implementedN)r)r Zlocaler r r setLocaleBszXMLReader.setLocalecCstd|dS)z1Looks up and returns the state of a SAX2 feature.zFeature '%s' not recognizedN)r)r namer r r getFeatureKszXMLReader.getFeaturecCstd|dS)z!Sets the state of a SAX2 feature.zFeature '%s' not recognizedN)r)r rstater r r setFeatureOszXMLReader.setFeaturecCstd|dS)z2Looks up and returns the value of a SAX2 property.zProperty '%s' not recognizedN)r)r rr r r getPropertySszXMLReader.getPropertycCstd|dS)z"Sets the value of a SAX2 property.zProperty '%s' not recognizedN)r)r rvaluer r r setPropertyWszXMLReader.setPropertyN)__name__ __module__ __qualname____doc__r rrrrrrrrrrrrrr r r r r r s   rc@sBeZdZdZdddZddZdd Zd d Zd d ZddZ dS)IncrementalParserasThis interface adds three extra methods to the XMLReader interface that allow XML parsers to support incremental parsing. Support for this interface is optional, since not all underlying XML parsers support this functionality. When the parser is instantiated it is ready to begin accepting data from the feed method immediately. After parsing has been finished with a call to close the reset method must be called to make the parser ready to accept new data, either from feed or using the parse method. Note that these methods must _not_ be called during parsing, that is, after parse has been called and before it returns. By default, the class also implements the parse method of the XMLReader interface using the feed, close and reset methods of the IncrementalParser interface as a convenience to SAX 2.0 driver writers.cCs||_tj|dS)N)_bufsizerr )r bufsizer r r r oszIncrementalParser.__init__cCspddlm}|j|}|j||j}|dkr8|j}|j|j}x|rb|j||j|j}qFW|j dS)Nr)saxutils) r*Zprepare_input_source prepareParsergetCharacterStream getByteStreamreadr(feedclose)r rr*filebufferr r r rss     zIncrementalParser.parsecCs tddS)aThis method gives the raw XML data in the data parameter to the parser and makes it parse the data, emitting the corresponding events. It is allowed for XML constructs to be split across several calls to feed. feed may raise SAXException.z This method must be implemented!N)r)r datar r r r0szIncrementalParser.feedcCs tddS)ztThis method is called by the parse implementation to allow the SAX 2.0 driver to prepare itself for parsing.z!prepareParser must be overridden!N)r)r rr r r r,szIncrementalParser.prepareParsercCs tddS)aThis method is called when the entire XML document has been passed to the parser through the feed method, to notify the parser that there are no more data. This allows the parser to do the final checks on the document and empty the internal data buffer. The parser will not be ready to parse another document until the reset method has been called. close may raise SAXException.z This method must be implemented!N)r)r r r r r1s zIncrementalParser.closecCs tddS)zThis method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.z This method must be implemented!N)r)r r r r resetszIncrementalParser.resetN)r6) r!r"r#r$r rr0r,r1r5r r r r r%[s   r%c@s0eZdZdZddZddZddZdd Zd S) LocatorzInterface for associating a SAX event with a document location. A locator object will return valid results only during calls to DocumentHandler methods; at any other time, the results are unpredictable.cCsdS)z6Return the column number where the current event ends.rr )r r r r getColumnNumberszLocator.getColumnNumbercCsdS)z4Return the line number where the current event ends.rr8r )r r r r getLineNumberszLocator.getLineNumbercCsdS)z3Return the public identifier for the current event.Nr )r r r r getPublicIdszLocator.getPublicIdcCsdS)z3Return the system identifier for the current event.Nr )r r r r getSystemIdszLocator.getSystemIdN)r!r"r#r$r9r:r;r<r r r r r7s r7c@sjeZdZdZdddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZdS) InputSourceanEncapsulation of the information needed by the XMLReader to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will create objects of this class for use in the XMLReader.parse method and for returning from EntityResolver.resolveEntity. An InputSource belongs to the application, the XMLReader is not allowed to modify InputSource objects passed to it from the application, although it may make copies and modify those.NcCs"||_d|_d|_d|_d|_dS)N)_InputSource__system_id_InputSource__public_id_InputSource__encoding_InputSource__bytefile_InputSource__charfile)r system_idr r r r s zInputSource.__init__cCs ||_dS)z/Sets the public identifier of this InputSource.N)r?)r Z public_idr r r setPublicIdszInputSource.setPublicIdcCs|jS)z2Returns the public identifier of this InputSource.)r?)r r r r r;szInputSource.getPublicIdcCs ||_dS)z/Sets the system identifier of this InputSource.N)r>)r rCr r r setSystemIdszInputSource.setSystemIdcCs|jS)z2Returns the system identifier of this InputSource.)r>)r r r r r<szInputSource.getSystemIdcCs ||_dS)a4Sets the character encoding of this InputSource. The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML recommendation). The encoding attribute of the InputSource is ignored if the InputSource also contains a character stream.N)r@)r encodingr r r setEncodingszInputSource.setEncodingcCs|jS)z/Get the character encoding of this InputSource.)r@)r r r r getEncodingszInputSource.getEncodingcCs ||_dS)aSet the byte stream (a Python file-like object which does not perform byte-to-character conversion) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself. If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.N)rA)r Zbytefiler r r setByteStreams zInputSource.setByteStreamcCs|jS)zGet the byte stream for this input source. The getEncoding method will return the character encoding for this byte stream, or None if unknown.)rA)r r r r r.szInputSource.getByteStreamcCs ||_dS)a^Set the character stream for this input source. (The stream must be a Python 2.0 Unicode-wrapped file-like that performs conversion to Unicode strings.) If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.N)rB)r Zcharfiler r r setCharacterStreamszInputSource.setCharacterStreamcCs|jS)z/Get the character stream for this input source.)rB)r r r r r-szInputSource.getCharacterStream)N)r!r"r#r$r rDr;rEr<rGrHrIr.rJr-r r r r r=s    r=c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZd$ddZddZd d!Zd"d#ZdS)%AttributesImplcCs ||_dS)zQNon-NS-aware implementation. attrs should be of the form {name : value}.N)_attrs)r attrsr r r r szAttributesImpl.__init__cCs t|jS)N)lenrL)r r r r getLengthszAttributesImpl.getLengthcCsdS)NZCDATAr )r rr r r getType!szAttributesImpl.getTypecCs |j|S)N)rL)r rr r r getValue$szAttributesImpl.getValuecCs |j|S)N)rL)r rr r r getValueByQName'szAttributesImpl.getValueByQNamecCs||jkrt||S)N)rLKeyError)r rr r r getNameByQName*s zAttributesImpl.getNameByQNamecCs||jkrt||S)N)rLrS)r rr r r getQNameByName/s zAttributesImpl.getQNameByNamecCst|jjS)N)listrLkeys)r r r r getNames4szAttributesImpl.getNamescCst|jjS)N)rVrLrW)r r r r getQNames7szAttributesImpl.getQNamescCs t|jS)N)rNrL)r r r r __len__:szAttributesImpl.__len__cCs |j|S)N)rL)r rr r r __getitem__=szAttributesImpl.__getitem__cCst|jjS)N)rVrLrW)r r r r rW@szAttributesImpl.keyscCs ||jkS)N)rL)r rr r r __contains__CszAttributesImpl.__contains__NcCs|jj||S)N)rLget)r r alternativer r r r]FszAttributesImpl.getcCs |j|jS)N) __class__rL)r r r r copyIszAttributesImpl.copycCst|jjS)N)rVrLitems)r r r r raLszAttributesImpl.itemscCst|jjS)N)rVrLvalues)r r r r rbOszAttributesImpl.values)N)r!r"r#r rOrPrQrRrTrUrXrYrZr[rWr\r]r`rarbr r r r rKs" rKc@s<eZdZddZddZddZddZd d Zd d Zd S)AttributesNSImplcCs||_||_dS)zNS-aware implementation. attrs should be of the form {(ns_uri, lname): value, ...}. qnames of the form {(ns_uri, lname): qname, ...}.N)rL_qnames)r rMZqnamesr r r r VszAttributesNSImpl.__init__cCs6x(|jjD]\}}||kr |j|Sq Wt|dS)N)rdrarLrS)r rnsnameqnamer r r rR^sz AttributesNSImpl.getValueByQNamecCs0x"|jjD]\}}||kr |Sq Wt|dS)N)rdrarS)r rrerfr r r rTeszAttributesNSImpl.getNameByQNamecCs |j|S)N)rd)r rr r r rUlszAttributesNSImpl.getQNameByNamecCst|jjS)N)rVrdrb)r r r r rYoszAttributesNSImpl.getQNamescCs|j|j|jS)N)r_rLrd)r r r r r`rszAttributesNSImpl.copyN) r!r"r#r rRrTrUrYr`r r r r rcTs rccCstttdS)N)rr%r7r r r r _testvsrg__main__N)r$r+r _exceptionsrrrr%r7r=rKrcrgr!r r r r s PJY>"PK|]&y 2 2)__pycache__/saxutils.cpython-36.opt-1.pycnu[3 \/@sdZddlZddlZddlZddlZddlZddlmZddlm Z ddZ ifdd Z ifd d Z ifd d Z ddZGdddejZGddde jZdddZdS)znA library of useful helper classes to the SAX classes, for the convenience of application and driver writers. N)handler) xmlreadercCs&x |jD]\}}|j||}q W|S)z2Replace substrings of a string using a dictionary.)itemsreplace)sdkeyvaluer (/usr/lib64/python3.6/xml/sax/saxutils.py__dict_replace sr cCs6|jdd}|jdd}|jdd}|r2t||}|S)zEscape &, <, and > in a string of data. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. &z&>z> in a string of data, then quote it for use as an attribute value. The " character will be escaped as well, if necessary. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. z z z )   "'z"%s"z"z'%s')copyupdaterr)rrr r r quoteattr0s   rcsdkrddl}|jSttjr&Sttjtjfr<SttjrlGfddd}|}dd|_ nDtj }dd|_ j |_ yj |_ j|_Wntk rYnXtj||ddd d S) NrcseZdZjZfddZdS)z _gettextwriter.._wrappercs t|S)N)getattr)selfname)outr r __getattr__[sz,_gettextwriter.._wrapper.__getattr__N)__name__ __module__ __qualname__ __class__r!r )r r r _wrapperYsr&cSsdS)Nr r r r r ^sz _gettextwriter..cSsdS)NTr r r r r r'csxmlcharrefreplacerT)encodingerrorsnewline write_through)sysstdout isinstanceio TextIOBasecodecs StreamWriterStreamReaderWriter RawIOBasecloseBufferedIOBasewritablewriteseekabletellAttributeError TextIOWrapper)r r)r-r&bufferr )r r _gettextwriterHs.     r?c@seZdZd ddZddZd!dd Zd d Zd d ZddZddZ ddZ ddZ ddZ ddZ ddZddZddZdS)" XMLGeneratorN iso-8859-1FcCsVtjj|t||}|j|_|j|_ig|_|jd|_ g|_ ||_ ||_ d|_ dS)NrF)rContentHandler__init__r?r9_writeflush_flush _ns_contexts_current_context_undeclared_ns_maps _encoding_short_empty_elements_pending_start_element)rr r)Zshort_empty_elementsr r r rDss   zXMLGenerator.__init__cCsJ|drBd|dkr d|dS|j|d}|rB|d|dS|dS)z7Builds a qualified name from a (ns_url, localname) pairrz$http://www.w3.org/XML/1998/namespacezxml:r:)rI)rrprefixr r r _qnames  zXMLGenerator._qnamecCs|jr|jdd|_dS)NrF)rMrE)r endElementr r r _finish_pending_start_elements z*XMLGenerator._finish_pending_start_elementcCs|jd|jdS)Nz$ )rErK)rr r r startDocumentszXMLGenerator.startDocumentcCs |jdS)N)rG)rr r r endDocumentszXMLGenerator.endDocumentcCs0|jj|jj||j|<|jj||fdS)N)rHappendrIrrJ)rrOurir r r startPrefixMappings zXMLGenerator.startPrefixMappingcCs|jd|_|jd=dS)NrrBrB)rHrI)rrOr r r endPrefixMappings zXMLGenerator.endPrefixMappingcCs^|j|jd|x*|jD]\}}|jd|t|fq W|jrPd|_n |jddS)Nrz %s=%sTr)rRrErrrLrM)rrattrsr r r r startElementszXMLGenerator.startElementcCs*|jr|jdd|_n|jd|dS)Nz/>Fz)rMrE)rrr r r rQs zXMLGenerator.endElementcCs|j|jd|j|x8|jD].\}}|rD|jd||fq$|jd|q$Wg|_x0|jD]$\}}|jd|j|t|fqfW|jrd|_n |jddS)Nrz xmlns:%s="%s"z xmlns="%s"z %s=%sTr)rRrErPrJrrrLrM)rrqnamerYrOrVr r r r startElementNSs zXMLGenerator.startElementNScCs0|jr|jdd|_n|jd|j|dS)Nz/>Fz)rMrErP)rrr[r r r endElementNSs zXMLGenerator.endElementNScCs4|r0|jt|ts"t||j}|jt|dS)N)rRr/strrKrEr)rcontentr r r characterss   zXMLGenerator.characterscCs0|r,|jt|ts"t||j}|j|dS)N)rRr/r^rKrE)rr_r r r ignorableWhitespaces   z XMLGenerator.ignorableWhitespacecCs|j|jd||fdS)Nz )rRrE)rtargetrr r r processingInstructionsz"XMLGenerator.processingInstruction)NrAF)F)r"r#r$rDrPrRrSrTrWrXrZrQr\r]r`rarcr r r r r@qs   r@c@seZdZdZd;ddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:ZdS)< XMLFilterBaseaYThis class is designed to sit between an XMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.NcCstjj|||_dS)N)r XMLReaderrD_parent)rparentr r r rDs zXMLFilterBase.__init__cCs|jj|dS)N) _err_handlererror)r exceptionr r r riszXMLFilterBase.errorcCs|jj|dS)N)rh fatalError)rrjr r r rkszXMLFilterBase.fatalErrorcCs|jj|dS)N)rhwarning)rrjr r r rlszXMLFilterBase.warningcCs|jj|dS)N) _cont_handlersetDocumentLocator)rZlocatorr r r rnsz XMLFilterBase.setDocumentLocatorcCs|jjdS)N)rmrS)rr r r rSszXMLFilterBase.startDocumentcCs|jjdS)N)rmrT)rr r r rTszXMLFilterBase.endDocumentcCs|jj||dS)N)rmrW)rrOrVr r r rWsz XMLFilterBase.startPrefixMappingcCs|jj|dS)N)rmrX)rrOr r r rX szXMLFilterBase.endPrefixMappingcCs|jj||dS)N)rmrZ)rrrYr r r rZ szXMLFilterBase.startElementcCs|jj|dS)N)rmrQ)rrr r r rQszXMLFilterBase.endElementcCs|jj|||dS)N)rmr\)rrr[rYr r r r\szXMLFilterBase.startElementNScCs|jj||dS)N)rmr])rrr[r r r r]szXMLFilterBase.endElementNScCs|jj|dS)N)rmr`)rr_r r r r`szXMLFilterBase.characterscCs|jj|dS)N)rmra)rcharsr r r rasz!XMLFilterBase.ignorableWhitespacecCs|jj||dS)N)rmrc)rrbrr r r rcsz#XMLFilterBase.processingInstructioncCs|jj|dS)N)rm skippedEntity)rrr r r rp!szXMLFilterBase.skippedEntitycCs|jj|||dS)N) _dtd_handler notationDecl)rrpublicIdsystemIdr r r rr&szXMLFilterBase.notationDeclcCs|jj||||dS)N)rqunparsedEntityDecl)rrrsrtZndatar r r ru)sz XMLFilterBase.unparsedEntityDeclcCs|jj||S)N)Z _ent_handler resolveEntity)rrsrtr r r rv.szXMLFilterBase.resolveEntitycCs@|jj||jj||jj||jj||jj|dS)N)rfZsetContentHandlerZsetErrorHandlerZsetEntityResolverZ setDTDHandlerparse)rsourcer r r rw3s     zXMLFilterBase.parsecCs|jj|dS)N)rf setLocale)rZlocaler r r ry:szXMLFilterBase.setLocalecCs |jj|S)N)rf getFeature)rrr r r rz=szXMLFilterBase.getFeaturecCs|jj||dS)N)rf setFeature)rrstater r r r{@szXMLFilterBase.setFeaturecCs |jj|S)N)rf getProperty)rrr r r r}CszXMLFilterBase.getPropertycCs|jj||dS)N)rf setProperty)rrr r r r r~FszXMLFilterBase.setPropertycCs|jS)N)rf)rr r r getParentKszXMLFilterBase.getParentcCs ||_dS)N)rf)rrgr r r setParentNszXMLFilterBase.setParent)N) r"r#r$__doc__rDrirkrlrnrSrTrWrXrZrQr\r]r`rarcrprrrurvrwryrzr{r}r~rrr r r r rds: rdcCs t|trtj|}n^t|drt|}tj}t|jdtrH|j|n |j|t|drtt|jtrt|j |j|j dko|j dkr|j }t jjt jj|}t jj||}t jj|r|j |t|d}n$|j tjj||tjj|j }|j||S)zThis function takes an InputSource and an optional base URL and returns a fully resolved InputSource object ready for reading.readrrNrb)r/r^rZ InputSourcehasattrrZsetCharacterStreamZ setByteStreamrZ setSystemIdZgetCharacterStreamZ getByteStreamZ getSystemIdospathdirnamenormpathjoinisfileopenurllibrwZurljoinZrequestZurlopen)rxbasefZsysidZbaseheadZ sysidfilenamer r r prepare_input_sourceSs*          r)r)rrZ urllib.parserZurllib.requestr0r2rrrr rrrr?rCr@rerdrr r r r s     )soPK|]k0k0,__pycache__/expatreader.cpython-36.opt-1.pycnu[3 \X=@sdZdZddlTddlmZmZddlmZddlmZmZddlm Z ddlm Z m Z dd l Z e j d d d kr|ed d [ ydd lmZWnek redd YnXeedsedd ddlmZmZmZejZejZy dd lZWnek r ddZYnXdd lZejZ[[GdddZGdddejZGdddej ejZ!ddZ"e#dkrdd l$Z%e"Z&e&j'e%j(jj)e&j*e%j(j+e&j,dd S)z] SAX driver for the pyexpat C module. This driver works with pyexpat.__version__ == '2.22'. z0.20)*)feature_validationfeature_namespaces)feature_namespace_prefixes)feature_external_gesfeature_external_pes)feature_string_interning)property_xml_stringproperty_interning_dictNjavazexpat not available in Java)expatzexpat not supported ParserCreate) xmlreadersaxutilshandlercCs|S)N)orr+/usr/lib64/python3.6/xml/sax/expatreader.py_mkproxy'src@s eZdZdS) _ClosedParserN)__name__ __module__ __qualname__rrrrr.src@s8eZdZdZddZddZddZdd Zd d Zd S) ExpatLocatorzLocator for use with the ExpatParser class. This uses a weak reference to the parser object to avoid creating a circular reference between the parser and the content handler. cCst||_dS)N)r_ref)selfparserrrr__init__9szExpatLocator.__init__cCs|j}|jdkrdS|jjS)N)r_parserErrorColumnNumber)rrrrrgetColumnNumber<s zExpatLocator.getColumnNumbercCs|j}|jdkrdS|jjS)N)rrErrorLineNumber)rrrrr getLineNumberBs zExpatLocator.getLineNumbercCs|j}|dkrdS|jjS)N)r_source getPublicId)rrrrrr&HszExpatLocator.getPublicIdcCs|j}|dkrdS|jjS)N)rr% getSystemId)rrrrrr'NszExpatLocator.getSystemIdN) rrr__doc__rr!r$r&r'rrrrr3s rc@s eZdZdZdGddZdd Zd d Zd d ZddZddZ ddZ ddZ dHddZ ddZ ddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Zdd?Z d@dAZ!dBdCZ"dDS)I ExpatParserz$SAX driver for the pyexpat C module.rcCsFtjj||tj|_d|_||_d|_d|_g|_ d|_ d|_ dS)Nr) rIncrementalParserrZ InputSourcer%r _namespaces_lex_handler_prop_parsing _entity_stack _external_ges _interning)rZnamespaceHandlingbufsizerrrrZs zExpatParser.__init__c CsVtj|}||_y*|j|jjt|tjj ||Wn|j YnXdS)z3Parse an XML document from a URL or an InputSource.N) rprepare_input_sourcer%reset _cont_handlerZsetDocumentLocatorrrr-parse _close_source)rsourcerrrr8gs zExpatParser.parsecCs |jdk r|jj|jdS)N)r'rZSetBase)rr:rrr prepareParserws zExpatParser.prepareParsercCs tjj|||jr|jdS)N)rr-setContentHandlerr0_reset_cont_handler)rrrrrr<}szExpatParser.setContentHandlercCsP|tkr|jS|tkr |jdk S|tttfkr2dS|tkr@|jSt d|dS)NrzFeature '%s' not recognized) rr.rr3rrrrr2SAXNotRecognizedException)rnamerrr getFeatures zExpatParser.getFeaturecCs|jrtd|tkr||_n|tkr.||_nt|tkrT|rL|jdkrRi|_qd|_nN|tkrj|rtdn8|t kr|rtdn"|t kr|rtdn t d|dS)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixeszFeature '%s' not recognized) r0SAXNotSupportedExceptionrr.rr2rr3rrrr>)rr?staterrr setFeatures2 zExpatParser.setFeaturecCsd|tjkr|jS|tkr|jS|tkrT|jrLt|jdrB|jjSt dnt dt d|dS)NGetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsingzProperty '%s' not recognized) rproperty_lexical_handlerr/r r3r rhasattrrDr>rA)rr?rrr getPropertys   zExpatParser.getPropertycCsV|tjkr ||_|jrR|jn2|tkr0||_n"|tkrFtd|n t d|dS)NzProperty '%s' cannot be setzProperty '%s' not recognized) rrEr/r0_reset_lex_handler_propr r3r rAr>)rr?valuerrr setPropertys   zExpatParser.setPropertycCsz|js|jd|_|jjy|jj||WnDtjk rt}z&ttj |j ||}|j j |WYdd}~XnXdS)Nr") r0r6r7Z startDocumentrZParser errorZSAXParseExceptionZ ErrorStringcodeZ _err_handlerZ fatalError)rdataisFinaleexcrrrfeeds zExpatParser.feedc CsB|j}z|j}|dk r |jWd|j}|dk r<|jXdS)N)r%ZgetCharacterStreamcloseZ getByteStream)rr:filerrrr9s zExpatParser._close_sourcec Cs|js|jdkst|jtr dSz(|jddd|jjd|_d|_Wdd|_|jdk rzt}|jj|_|jj |_ ||_|j XdS)Nr")rNr) r1r isinstancerrQr7Z endDocumentr0r r#r9)rrrrrrRs      zExpatParser.closecCs|jj|j_|jj|j_dS)N)r7processingInstructionrZProcessingInstructionHandler charactersZCharacterDataHandler)rrrrr=s zExpatParser._reset_cont_handlercCs`|j}|j}|dkr4d|_d|_d|_d|_d|_n(|j|_|j|_|j |_|j |_|j |_dS)N) r/rZCommentHandlerZStartCdataSectionHandlerZEndCdataSectionHandlerZStartDoctypeDeclHandlerZEndDoctypeDeclHandlerZcommentZ startCDATAZendCDATAstart_doctype_declZendDTD)rZlexrrrrrHsz#ExpatParser._reset_lex_handler_propc Cs|jr>tj|jjd|jd|_d|j_|j|j_ |j |j_ n,tj|jj|jd|_|j |j_ |j |j_ |j|j|j_|j|j_|j|j_|j|j_d|_|jr|j|j|j_y|j|j_Wntk rYnX|jjtj d|_!g|_"dS)N )internr"r)#r.r rr%Z getEncodingr3rZnamespace_prefixesstart_element_nsZStartElementHandlerend_element_nsZEndElementHandler start_element end_elementr=unparsed_entity_declZUnparsedEntityDeclHandler notation_declZNotationDeclHandlerstart_namespace_declZStartNamespaceDeclHandlerend_namespace_declZEndNamespaceDeclHandlerZ_decl_handler_propr/rHexternal_entity_refZExternalEntityRefHandlerskipped_entity_handlerZSkippedEntityHandlerAttributeErrorZSetParamEntityParsingZ*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr0r1)rrrrr6s6            zExpatParser.resetcCs|jdkrdS|jjS)N)rr )rrrrr!;s zExpatParser.getColumnNumbercCs|jdkrdS|jjS)Nr")rr#)rrrrr$@s zExpatParser.getLineNumbercCs |jjS)N)r%r&)rrrrr&EszExpatParser.getPublicIdcCs |jjS)N)r%r')rrrrr'HszExpatParser.getSystemIdcCs|jj|t|dS)N)r7Z startElementAttributesImpl)rr?attrsrrrr]LszExpatParser.start_elementcCs|jj|dS)N)r7Z endElement)rr?rrrr^OszExpatParser.end_elementc Cs|j}t|dkrd|f}n&t|dkr<|d|df}nt|}i}i}x|jD]|\}}|j}t|} | dkr|} d|f} n>| dkrd|d|df} |d|df} n|d} t|} ||| <| || <qVW|jj|dt||dS)Nr"rz%s:%sr*)splitlentupleitemsr7ZstartElementNSAttributesNSImpl) rr?rgpairZnewattrsZqnamesZanamerIpartsZlengthZqnameZapairrrrr[Rs.      zExpatParser.start_element_nscCsV|j}t|dkrd|f}n&t|dkr<|d|df}nt|}|jj|ddS)Nr"rhr)rirjrkr7Z endElementNS)rr?rnrrrr\ts   zExpatParser.end_element_nscCs|jj||dS)N)r7rV)rtargetrMrrrprocessing_instructionsz"ExpatParser.processing_instructioncCs|jj|dS)N)r7rW)rrMrrrcharacter_dataszExpatParser.character_datacCs|jj||dS)N)r7ZstartPrefixMapping)rprefixZurirrrrasz ExpatParser.start_namespace_declcCs|jj|dS)N)r7ZendPrefixMapping)rrsrrrrbszExpatParser.end_namespace_declcCs|jj|||dS)N)r/ZstartDTD)rr?sysidpubidZhas_internal_subsetrrrrXszExpatParser.start_doctype_declcCs|jj||||dS)N) _dtd_handlerZunparsedEntityDecl)rr?basertruZ notation_namerrrr_sz ExpatParser.unparsed_entity_declcCs|jj|||dS)N)rvZ notationDecl)rr?rwrtrurrrr`szExpatParser.notation_declc Cs|js dS|jj||}tj||jjp*d}|jj|j |jf|j j ||_ ||_yt j j ||Wn dS|jd\|_ |_|jd=dS)Nr"rTrrx)r2Z _ent_handlerZ resolveEntityrr5r%r'r1appendrZExternalEntityParserCreaterr-r8)rcontextrwrtrur:rrrrcs  zExpatParser.external_entity_refcCs|r d|}|jj|dS)N%)r7Z skippedEntity)rr?Zis_perrrrdsz"ExpatParser.skipped_entity_handlerNi)rr|)r)#rrrr(rr8r;r<r@rCrGrJrQr9rRr=rHr6r!r$r&r'r]r^r[r\rqrrrarbrXr_r`rcrdrrrrr)Ws@    '" r)cOs t||S)N)r))argskwargsrrr create_parsersr__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml)-r(versionZxml.sax._exceptionsZxml.sax.handlerrrrrrrr r sysplatformZSAXReaderNotAvailableZ xml.parsersr ImportErrorrFZxml.saxrrrrfrm_weakrefrweakrefproxyrZLocatorrr-r)rrZxml.sax.saxutilsZxmlpr<ZsaxZ XMLGeneratorZsetErrorHandlerZ ErrorHandlerr8rrrrsN      $_ PK|])[[,__pycache__/_exceptions.cpython-36.opt-1.pycnu[3 \@sdZddlZejdddkr*ddlmZ[GdddeZGdd d eZGd d d eZGd d d eZGdddeZ dS)z!Different kinds of SAX ExceptionsNjava) Exceptionc@s:eZdZdZd ddZddZddZd d Zd d ZdS) SAXExceptionaEncapsulate an XML error or warning. This class can contain basic error or warning information from either the XML parser or the application: you can subclass it to provide additional functionality, or to add localization. Note that although you will receive a SAXException as the argument to the handlers in the ErrorHandler interface, you are not actually required to raise the exception; instead, you can simply read the information in it.NcCs||_||_tj||dS)zUCreates an exception. The message is required, but the exception is optional.N)_msg _exceptionr__init__)selfmsg exceptionr +/usr/lib64/python3.6/xml/sax/_exceptions.pyrszSAXException.__init__cCs|jS)z$Return a message for this exception.)r)r r r r getMessageszSAXException.getMessagecCs|jS)z9Return the embedded exception, or None if there was none.)r)r r r r getExceptionszSAXException.getExceptioncCs|jS)z0Create a string representation of the exception.)r)r r r r __str__"szSAXException.__str__cCs tddS)zvAvoids weird error messages if someone does exception[ix] by mistake, since Exception has __getitem__ defined. __getitem__N)AttributeError)r Zixr r r r&szSAXException.__getitem__)N) __name__ __module__ __qualname____doc__rrrrrr r r r r s  rc@s@eZdZdZddZddZddZdd Zd d Zd d Z dS)SAXParseExceptiona#Encapsulate an XML parse error or warning. This exception will include information for locating the error in the original XML document. Note that although the application will receive a SAXParseException as the argument to the handlers in the ErrorHandler interface, the application is not actually required to raise the exception; instead, it can simply read the information in it and take a different action. Since this exception is a subclass of SAXException, it inherits the ability to wrap another exception.cCs<tj|||||_|jj|_|jj|_|jj|_dS)zECreates the exception. The exception parameter is allowed to be None.N) rr_locator getSystemId _systemIdgetColumnNumber_colnum getLineNumber_linenum)r r r Zlocatorr r r r;s   zSAXParseException.__init__cCs|jS)zNThe column number of the end of the text where the exception occurred.)r)r r r r rHsz!SAXParseException.getColumnNumbercCs|jS)zDThe line number of the end of the text where the exception occurred.)r)r r r r rMszSAXParseException.getLineNumbercCs |jjS)zEGet the public identifier of the entity where the exception occurred.)r getPublicId)r r r r rQszSAXParseException.getPublicIdcCs|jS)zEGet the system identifier of the entity where the exception occurred.)r)r r r r rUszSAXParseException.getSystemIdcCsN|j}|dkrd}|j}|dkr(d}|j}|dkr?z %s:%s:%s: %s)rrrr)r ZsysidZlinenumZcolnumr r r rYszSAXParseException.__str__N) rrrrrrrrrrr r r r r.s  rc@seZdZdZdS)SAXNotRecognizedExceptionzException class for an unrecognized identifier. An XMLReader will raise this exception when it is confronted with an unrecognized feature or property. SAX applications and extensions may use this class for similar purposes.N)rrrrr r r r r!isr!c@seZdZdZdS)SAXNotSupportedExceptionaException class for an unsupported operation. An XMLReader will raise this exception when a service it cannot perform is requested (specifically setting a state or value). SAX applications and extensions may use this class for similar purposes.N)rrrrr r r r r"ssr"c@seZdZdZdS)SAXReaderNotAvailableaException class for a missing driver. An XMLReader module (driver) should raise this exception when it is first imported, e.g. when a support module cannot be imported. It also may be raised during parsing, e.g. if executing an external program is not permitted.N)rrrrr r r r r#}sr#) rsysplatformZ java.langrrrr!r"r#r r r r s %;  PK|]Šb..,__pycache__/expatreader.cpython-36.opt-2.pycnu[3 \X=@sdZddlTddlmZmZddlmZddlmZmZddlmZddlm Z m Z ddl Z e j dd d krxe d d[ ydd lmZWnek re d dYnXeedse d dddlmZmZmZejZejZy ddlZWnek rddZYnXddlZejZ[[GdddZGdddejZGdddejejZ ddZ!e"dkrddl#Z$e!Z%e%j&e$j'jj(e%j)e$j'j*e%j+ddS)z0.20)*)feature_validationfeature_namespaces)feature_namespace_prefixes)feature_external_gesfeature_external_pes)feature_string_interning)property_xml_stringproperty_interning_dictNjavazexpat not available in Java)expatzexpat not supported ParserCreate) xmlreadersaxutilshandlercCs|S)N)orr+/usr/lib64/python3.6/xml/sax/expatreader.py_mkproxy'src@s eZdZdS) _ClosedParserN)__name__ __module__ __qualname__rrrrr.src@s4eZdZddZddZddZddZd d Zd S) ExpatLocatorcCst||_dS)N)r_ref)selfparserrrr__init__9szExpatLocator.__init__cCs|j}|jdkrdS|jjS)N)r_parserErrorColumnNumber)rrrrrgetColumnNumber<s zExpatLocator.getColumnNumbercCs|j}|jdkrdS|jjS)N)rrErrorLineNumber)rrrrr getLineNumberBs zExpatLocator.getLineNumbercCs|j}|dkrdS|jjS)N)r_source getPublicId)rrrrrr&HszExpatLocator.getPublicIdcCs|j}|dkrdS|jjS)N)rr% getSystemId)rrrrrr'NszExpatLocator.getSystemIdN)rrrrr!r$r&r'rrrrr3s rc@seZdZdFddZddZd d Zd d Zd dZddZddZ ddZ dGddZ ddZ ddZ ddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Zd=d>Zd?d@Z dAdBZ!dCS)H ExpatParserrcCsFtjj||tj|_d|_||_d|_d|_g|_ d|_ d|_ dS)Nr) rIncrementalParserrZ InputSourcer%r _namespaces_lex_handler_prop_parsing _entity_stack _external_ges _interning)rZnamespaceHandlingbufsizerrrrZs zExpatParser.__init__c CsVtj|}||_y*|j|jjt|tjj ||Wn|j YnXdS)N) rprepare_input_sourcer%reset _cont_handlerZsetDocumentLocatorrrr,parse _close_source)rsourcerrrr7gs zExpatParser.parsecCs |jdk r|jj|jdS)N)r'rZSetBase)rr9rrr prepareParserws zExpatParser.prepareParsercCs tjj|||jr|jdS)N)rr,setContentHandlerr/_reset_cont_handler)rrrrrr;}szExpatParser.setContentHandlercCsP|tkr|jS|tkr |jdk S|tttfkr2dS|tkr@|jSt d|dS)NrzFeature '%s' not recognized) rr-rr2rrrrr1SAXNotRecognizedException)rnamerrr getFeatures zExpatParser.getFeaturecCs|jrtd|tkr||_n|tkr.||_nt|tkrT|rL|jdkrRi|_qd|_nN|tkrj|rtdn8|t kr|rtdn"|t kr|rtdn t d|dS)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixeszFeature '%s' not recognized) r/SAXNotSupportedExceptionrr-rr1rr2rrrr=)rr>staterrr setFeatures2 zExpatParser.setFeaturecCsd|tjkr|jS|tkr|jS|tkrT|jrLt|jdrB|jjSt dnt dt d|dS)NGetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsingzProperty '%s' not recognized) rproperty_lexical_handlerr.r r2r rhasattrrCr=r@)rr>rrr getPropertys   zExpatParser.getPropertycCsV|tjkr ||_|jrR|jn2|tkr0||_n"|tkrFtd|n t d|dS)NzProperty '%s' cannot be setzProperty '%s' not recognized) rrDr.r/_reset_lex_handler_propr r2r r@r=)rr>valuerrr setPropertys   zExpatParser.setPropertycCsz|js|jd|_|jjy|jj||WnDtjk rt}z&ttj |j ||}|j j |WYdd}~XnXdS)Nr") r/r5r6Z startDocumentrZParser errorZSAXParseExceptionZ ErrorStringcodeZ _err_handlerZ fatalError)rdataisFinaleexcrrrfeeds zExpatParser.feedc CsB|j}z|j}|dk r |jWd|j}|dk r<|jXdS)N)r%ZgetCharacterStreamcloseZ getByteStream)rr9filerrrr8s zExpatParser._close_sourcec Cs|js|jdkst|jtr dSz(|jddd|jjd|_d|_Wdd|_|jdk rzt}|jj|_|jj |_ ||_|j XdS)Nr")rMr) r0r isinstancerrPr6Z endDocumentr/r r#r8)rrrrrrQs      zExpatParser.closecCs|jj|j_|jj|j_dS)N)r6processingInstructionrZProcessingInstructionHandler charactersZCharacterDataHandler)rrrrr<s zExpatParser._reset_cont_handlercCs`|j}|j}|dkr4d|_d|_d|_d|_d|_n(|j|_|j|_|j |_|j |_|j |_dS)N) r.rZCommentHandlerZStartCdataSectionHandlerZEndCdataSectionHandlerZStartDoctypeDeclHandlerZEndDoctypeDeclHandlerZcommentZ startCDATAZendCDATAstart_doctype_declZendDTD)rZlexrrrrrGsz#ExpatParser._reset_lex_handler_propc Cs|jr>tj|jjd|jd|_d|j_|j|j_ |j |j_ n,tj|jj|jd|_|j |j_ |j |j_ |j|j|j_|j|j_|j|j_|j|j_d|_|jr|j|j|j_y|j|j_Wntk rYnX|jjtj d|_!g|_"dS)N )internr"r)#r-r rr%Z getEncodingr2rZnamespace_prefixesstart_element_nsZStartElementHandlerend_element_nsZEndElementHandler start_element end_elementr<unparsed_entity_declZUnparsedEntityDeclHandler notation_declZNotationDeclHandlerstart_namespace_declZStartNamespaceDeclHandlerend_namespace_declZEndNamespaceDeclHandlerZ_decl_handler_propr.rGexternal_entity_refZExternalEntityRefHandlerskipped_entity_handlerZSkippedEntityHandlerAttributeErrorZSetParamEntityParsingZ*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr/r0)rrrrr5s6            zExpatParser.resetcCs|jdkrdS|jjS)N)rr )rrrrr!;s zExpatParser.getColumnNumbercCs|jdkrdS|jjS)Nr")rr#)rrrrr$@s zExpatParser.getLineNumbercCs |jjS)N)r%r&)rrrrr&EszExpatParser.getPublicIdcCs |jjS)N)r%r')rrrrr'HszExpatParser.getSystemIdcCs|jj|t|dS)N)r6Z startElementAttributesImpl)rr>attrsrrrr\LszExpatParser.start_elementcCs|jj|dS)N)r6Z endElement)rr>rrrr]OszExpatParser.end_elementc Cs|j}t|dkrd|f}n&t|dkr<|d|df}nt|}i}i}x|jD]|\}}|j}t|} | dkr|} d|f} n>| dkrd|d|df} |d|df} n|d} t|} ||| <| || <qVW|jj|dt||dS)Nr"rz%s:%sr))splitlentupleitemsr6ZstartElementNSAttributesNSImpl) rr>rfpairZnewattrsZqnamesZanamerHpartsZlengthZqnameZapairrrrrZRs.      zExpatParser.start_element_nscCsV|j}t|dkrd|f}n&t|dkr<|d|df}nt|}|jj|ddS)Nr"rgr)rhrirjr6Z endElementNS)rr>rmrrrr[ts   zExpatParser.end_element_nscCs|jj||dS)N)r6rU)rtargetrLrrrprocessing_instructionsz"ExpatParser.processing_instructioncCs|jj|dS)N)r6rV)rrLrrrcharacter_dataszExpatParser.character_datacCs|jj||dS)N)r6ZstartPrefixMapping)rprefixZurirrrr`sz ExpatParser.start_namespace_declcCs|jj|dS)N)r6ZendPrefixMapping)rrrrrrraszExpatParser.end_namespace_declcCs|jj|||dS)N)r.ZstartDTD)rr>sysidpubidZhas_internal_subsetrrrrWszExpatParser.start_doctype_declcCs|jj||||dS)N) _dtd_handlerZunparsedEntityDecl)rr>basersrtZ notation_namerrrr^sz ExpatParser.unparsed_entity_declcCs|jj|||dS)N)ruZ notationDecl)rr>rvrsrtrrrr_szExpatParser.notation_declc Cs|js dS|jj||}tj||jjp*d}|jj|j |jf|j j ||_ ||_yt j j ||Wn dS|jd\|_ |_|jd=dS)Nr"rSrrw)r1Z _ent_handlerZ resolveEntityrr4r%r'r0appendrZExternalEntityParserCreaterr,r7)rcontextrvrsrtr9rrrrbs  zExpatParser.external_entity_refcCs|r d|}|jj|dS)N%)r6Z skippedEntity)rr>Zis_perrrrcsz"ExpatParser.skipped_entity_handlerNi)rr{)r)"rrrrr7r:r;r?rBrFrIrPr8rQr<rGr5r!r$r&r'r\r]rZr[rprqr`rarWr^r_rbrcrrrrr(Ws>    '" r(cOs t||S)N)r()argskwargsrrr create_parsersr~__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml),versionZxml.sax._exceptionsZxml.sax.handlerrrrrrrr r sysplatformZSAXReaderNotAvailableZ xml.parsersr ImportErrorrEZxml.saxrrrrerl_weakrefrweakrefproxyrZLocatorrr,r(r~rZxml.sax.saxutilsZxmlpr;ZsaxZ XMLGeneratorZsetErrorHandlerZ ErrorHandlerr7rrrrsL      $_ PK|]VZ Z #__pycache__/__init__.cpython-36.pycnu[3 \.@sdZddlmZddlmZmZddlmZmZm Z m Z m Z efddZ efddZ d gZd Zernd d lZd d lZd d lZejj rd ejkrejd jd Z[dZejd ddkrejjerejjejd ZgfddZejd ddkrddZnddZ[d S)aSimple API for XML (SAX) implementation for Python. This module provides an implementation of the SAX 2 interface; information about the Java version of the interface can be found at http://www.megginson.com/SAX/. The Python version of the interface is documented at <...>. This package contains the following modules: handler -- Base classes and constants which define the SAX 2 API for the 'client-side' of SAX for Python. saxutils -- Implementation of the convenience classes commonly used to work with SAX. xmlreader -- Base classes and constants which define the SAX 2 API for the parsers used with SAX for Python. expatreader -- Driver that allows use of the Expat parser with SAX. ) InputSource)ContentHandler ErrorHandler) SAXExceptionSAXNotRecognizedExceptionSAXParseExceptionSAXNotSupportedExceptionSAXReaderNotAvailablecCs(t}|j||j||j|dS)N) make_parsersetContentHandlersetErrorHandlerparse)sourcehandler errorHandlerparserr(/usr/lib64/python3.6/xml/sax/__init__.pyr s  r cCspddl}|dkrt}t}|j||j|t}t|trR|j|j |n|j |j ||j |dS)N) iorr r r r isinstancestrZsetCharacterStreamStringIOZ setByteStreamBytesIOr )stringrrrrZinpsrcrrr parseString#s   rzxml.sax.expatreaderrNZ PY_SAX_PARSER,zpython.xml.sax.parserjavacCsrxb|tD]V}yt|Stk rL}zddl}||jkr<WYdd}~Xq tk r^Yq Xq WtdddS)a&Creates and returns a SAX parser. Creates the first parser it is able to instantiate of the ones given in the list created by doing parser_list + default_parser_list. The lists must contain the names of Python modules containing both a SAX parser and a create_parser function.rNzNo parsers found)default_parser_list_create_parser ImportErrorsysmodulesr )Z parser_list parser_nameer"rrrr Fs  r cCs$ddlm}|j|dt}|jS)Nr)imp)Zorg.python.corer&Z importNameglobals create_parser)r$r& drv_modulerrrr as r cCst|iidg}|jS)Nr() __import__r()r$r)rrrr gs)__doc__Z xmlreaderrrrr _exceptionsrrrrr r rr_falseZxml.sax.expatreaderZxmlosr"flagsignore_environmentenvironsplitZ_keyplatformregistryZ containsKeyZ getPropertyr r rrrrs*   PK|]b=n(__pycache__/handler.cpython-36.opt-2.pycnu[3 \b6@sdZGdddZGdddZGdddZGdddZd Zd Zd Zd Zd Z dZ eeeee e gZ dZ dZ dZdZdZdZe ee eeegZdS)z2.0betac@s$eZdZddZddZddZdS) ErrorHandlercCs|dS)N)self exceptionrr'/usr/lib64/python3.6/xml/sax/handler.pyerror szErrorHandler.errorcCs|dS)Nr)rrrrr fatalError$szErrorHandler.fatalErrorcCs t|dS)N)print)rrrrrwarning(szErrorHandler.warningN)__name__ __module__ __qualname__rrr rrrrrs rc@s|eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZdS)ContentHandlercCs d|_dS)N)_locator)rrrr__init__6szContentHandler.__init__cCs ||_dS)N)r)rZlocatorrrrsetDocumentLocator9sz!ContentHandler.setDocumentLocatorcCsdS)Nr)rrrr startDocumentPszContentHandler.startDocumentcCsdS)Nr)rrrr endDocumentWszContentHandler.endDocumentcCsdS)Nr)rprefixZurirrrstartPrefixMapping`sz!ContentHandler.startPrefixMappingcCsdS)Nr)rrrrrendPrefixMappingwszContentHandler.endPrefixMappingcCsdS)Nr)rnameattrsrrr startElement~szContentHandler.startElementcCsdS)Nr)rrrrr endElementszContentHandler.endElementcCsdS)Nr)rrqnamerrrrstartElementNSszContentHandler.startElementNScCsdS)Nr)rrrrrr endElementNSszContentHandler.endElementNScCsdS)Nr)rZcontentrrr charactersszContentHandler.characterscCsdS)Nr)rZ whitespacerrrignorableWhitespacesz"ContentHandler.ignorableWhitespacecCsdS)Nr)rtargetdatarrrprocessingInstructionsz$ContentHandler.processingInstructioncCsdS)Nr)rrrrr skippedEntityszContentHandler.skippedEntityN)r r r rrrrrrrrrrrrr!r"rrrrr /s    r c@seZdZddZddZdS) DTDHandlercCsdS)Nr)rrpublicIdsystemIdrrr notationDeclszDTDHandler.notationDeclcCsdS)Nr)rrr$r%ZndatarrrunparsedEntityDeclszDTDHandler.unparsedEntityDeclN)r r r r&r'rrrrr#sr#c@seZdZddZdS)EntityResolvercCs|S)Nr)rr$r%rrr resolveEntityszEntityResolver.resolveEntityN)r r r r)rrrrr(sr(z&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictN)versionrr r#r(Zfeature_namespacesZfeature_namespace_prefixesZfeature_string_interningZfeature_validationZfeature_external_gesZfeature_external_pesZ all_featuresZproperty_lexical_handlerZproperty_declaration_handlerZproperty_dom_nodeZproperty_xml_stringZproperty_encodingZproperty_interning_dictZall_propertiesrrrr s: "  PK|]&y 2 2#__pycache__/saxutils.cpython-36.pycnu[3 \/@sdZddlZddlZddlZddlZddlZddlmZddlm Z ddZ ifdd Z ifd d Z ifd d Z ddZGdddejZGddde jZdddZdS)znA library of useful helper classes to the SAX classes, for the convenience of application and driver writers. N)handler) xmlreadercCs&x |jD]\}}|j||}q W|S)z2Replace substrings of a string using a dictionary.)itemsreplace)sdkeyvaluer (/usr/lib64/python3.6/xml/sax/saxutils.py__dict_replace sr cCs6|jdd}|jdd}|jdd}|r2t||}|S)zEscape &, <, and > in a string of data. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. &z&>z> in a string of data, then quote it for use as an attribute value. The " character will be escaped as well, if necessary. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. z z z )   "'z"%s"z"z'%s')copyupdaterr)rrr r r quoteattr0s   rcsdkrddl}|jSttjr&Sttjtjfr<SttjrlGfddd}|}dd|_ nDtj }dd|_ j |_ yj |_ j|_Wntk rYnXtj||ddd d S) NrcseZdZjZfddZdS)z _gettextwriter.._wrappercs t|S)N)getattr)selfname)outr r __getattr__[sz,_gettextwriter.._wrapper.__getattr__N)__name__ __module__ __qualname__ __class__r!r )r r r _wrapperYsr&cSsdS)Nr r r r r ^sz _gettextwriter..cSsdS)NTr r r r r r'csxmlcharrefreplacerT)encodingerrorsnewline write_through)sysstdout isinstanceio TextIOBasecodecs StreamWriterStreamReaderWriter RawIOBasecloseBufferedIOBasewritablewriteseekabletellAttributeError TextIOWrapper)r r)r-r&bufferr )r r _gettextwriterHs.     r?c@seZdZd ddZddZd!dd Zd d Zd d ZddZddZ ddZ ddZ ddZ ddZ ddZddZddZdS)" XMLGeneratorN iso-8859-1FcCsVtjj|t||}|j|_|j|_ig|_|jd|_ g|_ ||_ ||_ d|_ dS)NrF)rContentHandler__init__r?r9_writeflush_flush _ns_contexts_current_context_undeclared_ns_maps _encoding_short_empty_elements_pending_start_element)rr r)Zshort_empty_elementsr r r rDss   zXMLGenerator.__init__cCsJ|drBd|dkr d|dS|j|d}|rB|d|dS|dS)z7Builds a qualified name from a (ns_url, localname) pairrz$http://www.w3.org/XML/1998/namespacezxml:r:)rI)rrprefixr r r _qnames  zXMLGenerator._qnamecCs|jr|jdd|_dS)NrF)rMrE)r endElementr r r _finish_pending_start_elements z*XMLGenerator._finish_pending_start_elementcCs|jd|jdS)Nz$ )rErK)rr r r startDocumentszXMLGenerator.startDocumentcCs |jdS)N)rG)rr r r endDocumentszXMLGenerator.endDocumentcCs0|jj|jj||j|<|jj||fdS)N)rHappendrIrrJ)rrOurir r r startPrefixMappings zXMLGenerator.startPrefixMappingcCs|jd|_|jd=dS)NrrBrB)rHrI)rrOr r r endPrefixMappings zXMLGenerator.endPrefixMappingcCs^|j|jd|x*|jD]\}}|jd|t|fq W|jrPd|_n |jddS)Nrz %s=%sTr)rRrErrrLrM)rrattrsr r r r startElementszXMLGenerator.startElementcCs*|jr|jdd|_n|jd|dS)Nz/>Fz)rMrE)rrr r r rQs zXMLGenerator.endElementcCs|j|jd|j|x8|jD].\}}|rD|jd||fq$|jd|q$Wg|_x0|jD]$\}}|jd|j|t|fqfW|jrd|_n |jddS)Nrz xmlns:%s="%s"z xmlns="%s"z %s=%sTr)rRrErPrJrrrLrM)rrqnamerYrOrVr r r r startElementNSs zXMLGenerator.startElementNScCs0|jr|jdd|_n|jd|j|dS)Nz/>Fz)rMrErP)rrr[r r r endElementNSs zXMLGenerator.endElementNScCs4|r0|jt|ts"t||j}|jt|dS)N)rRr/strrKrEr)rcontentr r r characterss   zXMLGenerator.characterscCs0|r,|jt|ts"t||j}|j|dS)N)rRr/r^rKrE)rr_r r r ignorableWhitespaces   z XMLGenerator.ignorableWhitespacecCs|j|jd||fdS)Nz )rRrE)rtargetrr r r processingInstructionsz"XMLGenerator.processingInstruction)NrAF)F)r"r#r$rDrPrRrSrTrWrXrZrQr\r]r`rarcr r r r r@qs   r@c@seZdZdZd;ddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:ZdS)< XMLFilterBaseaYThis class is designed to sit between an XMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.NcCstjj|||_dS)N)r XMLReaderrD_parent)rparentr r r rDs zXMLFilterBase.__init__cCs|jj|dS)N) _err_handlererror)r exceptionr r r riszXMLFilterBase.errorcCs|jj|dS)N)rh fatalError)rrjr r r rkszXMLFilterBase.fatalErrorcCs|jj|dS)N)rhwarning)rrjr r r rlszXMLFilterBase.warningcCs|jj|dS)N) _cont_handlersetDocumentLocator)rZlocatorr r r rnsz XMLFilterBase.setDocumentLocatorcCs|jjdS)N)rmrS)rr r r rSszXMLFilterBase.startDocumentcCs|jjdS)N)rmrT)rr r r rTszXMLFilterBase.endDocumentcCs|jj||dS)N)rmrW)rrOrVr r r rWsz XMLFilterBase.startPrefixMappingcCs|jj|dS)N)rmrX)rrOr r r rX szXMLFilterBase.endPrefixMappingcCs|jj||dS)N)rmrZ)rrrYr r r rZ szXMLFilterBase.startElementcCs|jj|dS)N)rmrQ)rrr r r rQszXMLFilterBase.endElementcCs|jj|||dS)N)rmr\)rrr[rYr r r r\szXMLFilterBase.startElementNScCs|jj||dS)N)rmr])rrr[r r r r]szXMLFilterBase.endElementNScCs|jj|dS)N)rmr`)rr_r r r r`szXMLFilterBase.characterscCs|jj|dS)N)rmra)rcharsr r r rasz!XMLFilterBase.ignorableWhitespacecCs|jj||dS)N)rmrc)rrbrr r r rcsz#XMLFilterBase.processingInstructioncCs|jj|dS)N)rm skippedEntity)rrr r r rp!szXMLFilterBase.skippedEntitycCs|jj|||dS)N) _dtd_handler notationDecl)rrpublicIdsystemIdr r r rr&szXMLFilterBase.notationDeclcCs|jj||||dS)N)rqunparsedEntityDecl)rrrsrtZndatar r r ru)sz XMLFilterBase.unparsedEntityDeclcCs|jj||S)N)Z _ent_handler resolveEntity)rrsrtr r r rv.szXMLFilterBase.resolveEntitycCs@|jj||jj||jj||jj||jj|dS)N)rfZsetContentHandlerZsetErrorHandlerZsetEntityResolverZ setDTDHandlerparse)rsourcer r r rw3s     zXMLFilterBase.parsecCs|jj|dS)N)rf setLocale)rZlocaler r r ry:szXMLFilterBase.setLocalecCs |jj|S)N)rf getFeature)rrr r r rz=szXMLFilterBase.getFeaturecCs|jj||dS)N)rf setFeature)rrstater r r r{@szXMLFilterBase.setFeaturecCs |jj|S)N)rf getProperty)rrr r r r}CszXMLFilterBase.getPropertycCs|jj||dS)N)rf setProperty)rrr r r r r~FszXMLFilterBase.setPropertycCs|jS)N)rf)rr r r getParentKszXMLFilterBase.getParentcCs ||_dS)N)rf)rrgr r r setParentNszXMLFilterBase.setParent)N) r"r#r$__doc__rDrirkrlrnrSrTrWrXrZrQr\r]r`rarcrprrrurvrwryrzr{r}r~rrr r r r rds: rdcCs t|trtj|}n^t|drt|}tj}t|jdtrH|j|n |j|t|drtt|jtrt|j |j|j dko|j dkr|j }t jjt jj|}t jj||}t jj|r|j |t|d}n$|j tjj||tjj|j }|j||S)zThis function takes an InputSource and an optional base URL and returns a fully resolved InputSource object ready for reading.readrrNrb)r/r^rZ InputSourcehasattrrZsetCharacterStreamZ setByteStreamrZ setSystemIdZgetCharacterStreamZ getByteStreamZ getSystemIdospathdirnamenormpathjoinisfileopenurllibrwZurljoinZrequestZurlopen)rxbasefZsysidZbaseheadZ sysidfilenamer r r prepare_input_sourceSs*          r)r)rrZ urllib.parserZurllib.requestr0r2rrrr rrrr?rCr@rerdrr r r r s     )soPK|]VZ Z )__pycache__/__init__.cpython-36.opt-1.pycnu[3 \.@sdZddlmZddlmZmZddlmZmZm Z m Z m Z efddZ efddZ d gZd Zernd d lZd d lZd d lZejj rd ejkrejd jd Z[dZejd ddkrejjerejjejd ZgfddZejd ddkrddZnddZ[d S)aSimple API for XML (SAX) implementation for Python. This module provides an implementation of the SAX 2 interface; information about the Java version of the interface can be found at http://www.megginson.com/SAX/. The Python version of the interface is documented at <...>. This package contains the following modules: handler -- Base classes and constants which define the SAX 2 API for the 'client-side' of SAX for Python. saxutils -- Implementation of the convenience classes commonly used to work with SAX. xmlreader -- Base classes and constants which define the SAX 2 API for the parsers used with SAX for Python. expatreader -- Driver that allows use of the Expat parser with SAX. ) InputSource)ContentHandler ErrorHandler) SAXExceptionSAXNotRecognizedExceptionSAXParseExceptionSAXNotSupportedExceptionSAXReaderNotAvailablecCs(t}|j||j||j|dS)N) make_parsersetContentHandlersetErrorHandlerparse)sourcehandler errorHandlerparserr(/usr/lib64/python3.6/xml/sax/__init__.pyr s  r cCspddl}|dkrt}t}|j||j|t}t|trR|j|j |n|j |j ||j |dS)N) iorr r r r isinstancestrZsetCharacterStreamStringIOZ setByteStreamBytesIOr )stringrrrrZinpsrcrrr parseString#s   rzxml.sax.expatreaderrNZ PY_SAX_PARSER,zpython.xml.sax.parserjavacCsrxb|tD]V}yt|Stk rL}zddl}||jkr<WYdd}~Xq tk r^Yq Xq WtdddS)a&Creates and returns a SAX parser. Creates the first parser it is able to instantiate of the ones given in the list created by doing parser_list + default_parser_list. The lists must contain the names of Python modules containing both a SAX parser and a create_parser function.rNzNo parsers found)default_parser_list_create_parser ImportErrorsysmodulesr )Z parser_list parser_nameer"rrrr Fs  r cCs$ddlm}|j|dt}|jS)Nr)imp)Zorg.python.corer&Z importNameglobals create_parser)r$r& drv_modulerrrr as r cCst|iidg}|jS)Nr() __import__r()r$r)rrrr gs)__doc__Z xmlreaderrrrr _exceptionsrrrrr r rr_falseZxml.sax.expatreaderZxmlosr"flagsignore_environmentenvironsplitZ_keyplatformregistryZ containsKeyZ getPropertyr r rrrrs*   PK|]_&00"__pycache__/handler.cpython-36.pycnu[3 \b6@sdZdZGdddZGdddZGdddZGdd d Zd Zd Zd Zd Z dZ dZ eeee e e gZ dZ dZdZdZdZdZe eeeeegZdS)a0 This module contains the core classes of version 2.0 of SAX for Python. This file provides only default classes with absolutely minimum functionality, from which drivers and applications can be subclassed. Many of these classes are empty and are included only as documentation of the interfaces. $Id$ z2.0betac@s(eZdZdZddZddZddZdS) ErrorHandleraBasic interface for SAX error handlers. If you create an object that implements this interface, then register the object with your XMLReader, the parser will call the methods in your object to report all warnings and errors. There are three levels of errors available: warnings, (possibly) recoverable errors, and unrecoverable errors. All methods take a SAXParseException as the only parameter.cCs|dS)zHandle a recoverable error.N)self exceptionrr'/usr/lib64/python3.6/xml/sax/handler.pyerror szErrorHandler.errorcCs|dS)zHandle a non-recoverable error.Nr)rrrrr fatalError$szErrorHandler.fatalErrorcCs t|dS)zHandle a warning.N)print)rrrrrwarning(szErrorHandler.warningN)__name__ __module__ __qualname____doc__rrr rrrrrsrc@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZdS)ContentHandlerzInterface for receiving logical document content events. This is the main callback interface in SAX, and the one most important to applications. The order of events in this interface mirrors the order of the information in the document.cCs d|_dS)N)_locator)rrrr__init__6szContentHandler.__init__cCs ||_dS)a#Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface. The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine. Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.N)r)rZlocatorrrrsetDocumentLocator9sz!ContentHandler.setDocumentLocatorcCsdS)zReceive notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).Nr)rrrr startDocumentPszContentHandler.startDocumentcCsdS)aQReceive notification of the end of a document. The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.Nr)rrrr endDocumentWszContentHandler.endDocumentcCsdS)aBegin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default). There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary. Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.Nr)rprefixZurirrrstartPrefixMapping`sz!ContentHandler.startPrefixMappingcCsdS)zEnd the scope of a prefix-URI mapping. See startPrefixMapping for details. This event will always occur after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.Nr)rrrrrendPrefixMappingwszContentHandler.endPrefixMappingcCsdS)aSignals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an instance of the Attributes class containing the attributes of the element.Nr)rnameattrsrrr startElement~szContentHandler.startElementcCsdS)zSignals the end of an element in non-namespace mode. The name parameter contains the name of the element type, just as with the startElement event.Nr)rrrrr endElementszContentHandler.endElementcCsdS)aSignals the start of an element in namespace mode. The name parameter contains the name of the element type as a (uri, localname) tuple, the qname parameter the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the Attributes class containing the attributes of the element. The uri part of the name tuple is None for elements which have no namespace.Nr)rrqnamerrrrstartElementNSszContentHandler.startElementNScCsdS)zSignals the end of an element in namespace mode. The name parameter contains the name of the element type, just as with the startElementNS event.Nr)rrrrrr endElementNSszContentHandler.endElementNScCsdS)aReceive notification of character data. The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.Nr)rZcontentrrr charactersszContentHandler.characterscCsdS)awReceive notification of ignorable whitespace in element content. Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.Nr)rZ whitespacerrrignorableWhitespacesz"ContentHandler.ignorableWhitespacecCsdS)aReceive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.Nr)rtargetdatarrrprocessingInstructionsz$ContentHandler.processingInstructioncCsdS)aReceive notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.Nr)rrrrr skippedEntityszContentHandler.skippedEntityN)r r r r rrrrrrrrrrrrr"r#rrrrr/s    rc@s eZdZdZddZddZdS) DTDHandlerzHandle DTD events. This interface specifies only those DTD events required for basic parsing (unparsed entities and attributes).cCsdS)z$Handle a notation declaration event.Nr)rrpublicIdsystemIdrrr notationDeclszDTDHandler.notationDeclcCsdS)z,Handle an unparsed entity declaration event.Nr)rrr%r&ZndatarrrunparsedEntityDeclszDTDHandler.unparsedEntityDeclN)r r r r r'r(rrrrr$sr$c@seZdZdZddZdS)EntityResolvera7Basic interface for resolving entities. If you create an object implementing this interface, then register the object with your Parser, the parser will call the method in your object to resolve all external entities. Note that DefaultHandler implements this interface with the default behaviour.cCs|S)zResolve the system identifier of an entity and return either the system identifier to read from as a string, or an InputSource to read from.r)rr%r&rrr resolveEntityszEntityResolver.resolveEntityN)r r r r r*rrrrr)sr)z&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictN)r versionrrr$r)Zfeature_namespacesZfeature_namespace_prefixesZfeature_string_interningZfeature_validationZfeature_external_gesZfeature_external_pesZ all_featuresZproperty_lexical_handlerZproperty_declaration_handlerZproperty_dom_nodeZproperty_xml_stringZproperty_encodingZproperty_interning_dictZall_propertiesrrrr s< "  PK|]k0k0&__pycache__/expatreader.cpython-36.pycnu[3 \X=@sdZdZddlTddlmZmZddlmZddlmZmZddlm Z ddlm Z m Z dd l Z e j d d d kr|ed d [ ydd lmZWnek redd YnXeedsedd ddlmZmZmZejZejZy dd lZWnek r ddZYnXdd lZejZ[[GdddZGdddejZGdddej ejZ!ddZ"e#dkrdd l$Z%e"Z&e&j'e%j(jj)e&j*e%j(j+e&j,dd S)z] SAX driver for the pyexpat C module. This driver works with pyexpat.__version__ == '2.22'. z0.20)*)feature_validationfeature_namespaces)feature_namespace_prefixes)feature_external_gesfeature_external_pes)feature_string_interning)property_xml_stringproperty_interning_dictNjavazexpat not available in Java)expatzexpat not supported ParserCreate) xmlreadersaxutilshandlercCs|S)N)orr+/usr/lib64/python3.6/xml/sax/expatreader.py_mkproxy'src@s eZdZdS) _ClosedParserN)__name__ __module__ __qualname__rrrrr.src@s8eZdZdZddZddZddZdd Zd d Zd S) ExpatLocatorzLocator for use with the ExpatParser class. This uses a weak reference to the parser object to avoid creating a circular reference between the parser and the content handler. cCst||_dS)N)r_ref)selfparserrrr__init__9szExpatLocator.__init__cCs|j}|jdkrdS|jjS)N)r_parserErrorColumnNumber)rrrrrgetColumnNumber<s zExpatLocator.getColumnNumbercCs|j}|jdkrdS|jjS)N)rrErrorLineNumber)rrrrr getLineNumberBs zExpatLocator.getLineNumbercCs|j}|dkrdS|jjS)N)r_source getPublicId)rrrrrr&HszExpatLocator.getPublicIdcCs|j}|dkrdS|jjS)N)rr% getSystemId)rrrrrr'NszExpatLocator.getSystemIdN) rrr__doc__rr!r$r&r'rrrrr3s rc@s eZdZdZdGddZdd Zd d Zd d ZddZddZ ddZ ddZ dHddZ ddZ ddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Zdd?Z d@dAZ!dBdCZ"dDS)I ExpatParserz$SAX driver for the pyexpat C module.rcCsFtjj||tj|_d|_||_d|_d|_g|_ d|_ d|_ dS)Nr) rIncrementalParserrZ InputSourcer%r _namespaces_lex_handler_prop_parsing _entity_stack _external_ges _interning)rZnamespaceHandlingbufsizerrrrZs zExpatParser.__init__c CsVtj|}||_y*|j|jjt|tjj ||Wn|j YnXdS)z3Parse an XML document from a URL or an InputSource.N) rprepare_input_sourcer%reset _cont_handlerZsetDocumentLocatorrrr-parse _close_source)rsourcerrrr8gs zExpatParser.parsecCs |jdk r|jj|jdS)N)r'rZSetBase)rr:rrr prepareParserws zExpatParser.prepareParsercCs tjj|||jr|jdS)N)rr-setContentHandlerr0_reset_cont_handler)rrrrrr<}szExpatParser.setContentHandlercCsP|tkr|jS|tkr |jdk S|tttfkr2dS|tkr@|jSt d|dS)NrzFeature '%s' not recognized) rr.rr3rrrrr2SAXNotRecognizedException)rnamerrr getFeatures zExpatParser.getFeaturecCs|jrtd|tkr||_n|tkr.||_nt|tkrT|rL|jdkrRi|_qd|_nN|tkrj|rtdn8|t kr|rtdn"|t kr|rtdn t d|dS)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixeszFeature '%s' not recognized) r0SAXNotSupportedExceptionrr.rr2rr3rrrr>)rr?staterrr setFeatures2 zExpatParser.setFeaturecCsd|tjkr|jS|tkr|jS|tkrT|jrLt|jdrB|jjSt dnt dt d|dS)NGetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsingzProperty '%s' not recognized) rproperty_lexical_handlerr/r r3r rhasattrrDr>rA)rr?rrr getPropertys   zExpatParser.getPropertycCsV|tjkr ||_|jrR|jn2|tkr0||_n"|tkrFtd|n t d|dS)NzProperty '%s' cannot be setzProperty '%s' not recognized) rrEr/r0_reset_lex_handler_propr r3r rAr>)rr?valuerrr setPropertys   zExpatParser.setPropertycCsz|js|jd|_|jjy|jj||WnDtjk rt}z&ttj |j ||}|j j |WYdd}~XnXdS)Nr") r0r6r7Z startDocumentrZParser errorZSAXParseExceptionZ ErrorStringcodeZ _err_handlerZ fatalError)rdataisFinaleexcrrrfeeds zExpatParser.feedc CsB|j}z|j}|dk r |jWd|j}|dk r<|jXdS)N)r%ZgetCharacterStreamcloseZ getByteStream)rr:filerrrr9s zExpatParser._close_sourcec Cs|js|jdkst|jtr dSz(|jddd|jjd|_d|_Wdd|_|jdk rzt}|jj|_|jj |_ ||_|j XdS)Nr")rNr) r1r isinstancerrQr7Z endDocumentr0r r#r9)rrrrrrRs      zExpatParser.closecCs|jj|j_|jj|j_dS)N)r7processingInstructionrZProcessingInstructionHandler charactersZCharacterDataHandler)rrrrr=s zExpatParser._reset_cont_handlercCs`|j}|j}|dkr4d|_d|_d|_d|_d|_n(|j|_|j|_|j |_|j |_|j |_dS)N) r/rZCommentHandlerZStartCdataSectionHandlerZEndCdataSectionHandlerZStartDoctypeDeclHandlerZEndDoctypeDeclHandlerZcommentZ startCDATAZendCDATAstart_doctype_declZendDTD)rZlexrrrrrHsz#ExpatParser._reset_lex_handler_propc Cs|jr>tj|jjd|jd|_d|j_|j|j_ |j |j_ n,tj|jj|jd|_|j |j_ |j |j_ |j|j|j_|j|j_|j|j_|j|j_d|_|jr|j|j|j_y|j|j_Wntk rYnX|jjtj d|_!g|_"dS)N )internr"r)#r.r rr%Z getEncodingr3rZnamespace_prefixesstart_element_nsZStartElementHandlerend_element_nsZEndElementHandler start_element end_elementr=unparsed_entity_declZUnparsedEntityDeclHandler notation_declZNotationDeclHandlerstart_namespace_declZStartNamespaceDeclHandlerend_namespace_declZEndNamespaceDeclHandlerZ_decl_handler_propr/rHexternal_entity_refZExternalEntityRefHandlerskipped_entity_handlerZSkippedEntityHandlerAttributeErrorZSetParamEntityParsingZ*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr0r1)rrrrr6s6            zExpatParser.resetcCs|jdkrdS|jjS)N)rr )rrrrr!;s zExpatParser.getColumnNumbercCs|jdkrdS|jjS)Nr")rr#)rrrrr$@s zExpatParser.getLineNumbercCs |jjS)N)r%r&)rrrrr&EszExpatParser.getPublicIdcCs |jjS)N)r%r')rrrrr'HszExpatParser.getSystemIdcCs|jj|t|dS)N)r7Z startElementAttributesImpl)rr?attrsrrrr]LszExpatParser.start_elementcCs|jj|dS)N)r7Z endElement)rr?rrrr^OszExpatParser.end_elementc Cs|j}t|dkrd|f}n&t|dkr<|d|df}nt|}i}i}x|jD]|\}}|j}t|} | dkr|} d|f} n>| dkrd|d|df} |d|df} n|d} t|} ||| <| || <qVW|jj|dt||dS)Nr"rz%s:%sr*)splitlentupleitemsr7ZstartElementNSAttributesNSImpl) rr?rgpairZnewattrsZqnamesZanamerIpartsZlengthZqnameZapairrrrr[Rs.      zExpatParser.start_element_nscCsV|j}t|dkrd|f}n&t|dkr<|d|df}nt|}|jj|ddS)Nr"rhr)rirjrkr7Z endElementNS)rr?rnrrrr\ts   zExpatParser.end_element_nscCs|jj||dS)N)r7rV)rtargetrMrrrprocessing_instructionsz"ExpatParser.processing_instructioncCs|jj|dS)N)r7rW)rrMrrrcharacter_dataszExpatParser.character_datacCs|jj||dS)N)r7ZstartPrefixMapping)rprefixZurirrrrasz ExpatParser.start_namespace_declcCs|jj|dS)N)r7ZendPrefixMapping)rrsrrrrbszExpatParser.end_namespace_declcCs|jj|||dS)N)r/ZstartDTD)rr?sysidpubidZhas_internal_subsetrrrrXszExpatParser.start_doctype_declcCs|jj||||dS)N) _dtd_handlerZunparsedEntityDecl)rr?basertruZ notation_namerrrr_sz ExpatParser.unparsed_entity_declcCs|jj|||dS)N)rvZ notationDecl)rr?rwrtrurrrr`szExpatParser.notation_declc Cs|js dS|jj||}tj||jjp*d}|jj|j |jf|j j ||_ ||_yt j j ||Wn dS|jd\|_ |_|jd=dS)Nr"rTrrx)r2Z _ent_handlerZ resolveEntityrr5r%r'r1appendrZExternalEntityParserCreaterr-r8)rcontextrwrtrur:rrrrcs  zExpatParser.external_entity_refcCs|r d|}|jj|dS)N%)r7Z skippedEntity)rr?Zis_perrrrdsz"ExpatParser.skipped_entity_handlerNi)rr|)r)#rrrr(rr8r;r<r@rCrGrJrQr9rRr=rHr6r!r$r&r'r]r^r[r\rqrrrarbrXr_r`rcrdrrrrr)Ws@    '" r)cOs t||S)N)r))argskwargsrrr create_parsersr__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml)-r(versionZxml.sax._exceptionsZxml.sax.handlerrrrrrrr r sysplatformZSAXReaderNotAvailableZ xml.parsersr ImportErrorrFZxml.saxrrrrfrm_weakrefrweakrefproxyrZLocatorrr-r)rrZxml.sax.saxutilsZxmlpr<ZsaxZ XMLGeneratorZsetErrorHandlerZ ErrorHandlerr8rrrrsN      $_ PK|])[[&__pycache__/_exceptions.cpython-36.pycnu[3 \@sdZddlZejdddkr*ddlmZ[GdddeZGdd d eZGd d d eZGd d d eZGdddeZ dS)z!Different kinds of SAX ExceptionsNjava) Exceptionc@s:eZdZdZd ddZddZddZd d Zd d ZdS) SAXExceptionaEncapsulate an XML error or warning. This class can contain basic error or warning information from either the XML parser or the application: you can subclass it to provide additional functionality, or to add localization. Note that although you will receive a SAXException as the argument to the handlers in the ErrorHandler interface, you are not actually required to raise the exception; instead, you can simply read the information in it.NcCs||_||_tj||dS)zUCreates an exception. The message is required, but the exception is optional.N)_msg _exceptionr__init__)selfmsg exceptionr +/usr/lib64/python3.6/xml/sax/_exceptions.pyrszSAXException.__init__cCs|jS)z$Return a message for this exception.)r)r r r r getMessageszSAXException.getMessagecCs|jS)z9Return the embedded exception, or None if there was none.)r)r r r r getExceptionszSAXException.getExceptioncCs|jS)z0Create a string representation of the exception.)r)r r r r __str__"szSAXException.__str__cCs tddS)zvAvoids weird error messages if someone does exception[ix] by mistake, since Exception has __getitem__ defined. __getitem__N)AttributeError)r Zixr r r r&szSAXException.__getitem__)N) __name__ __module__ __qualname____doc__rrrrrr r r r r s  rc@s@eZdZdZddZddZddZdd Zd d Zd d Z dS)SAXParseExceptiona#Encapsulate an XML parse error or warning. This exception will include information for locating the error in the original XML document. Note that although the application will receive a SAXParseException as the argument to the handlers in the ErrorHandler interface, the application is not actually required to raise the exception; instead, it can simply read the information in it and take a different action. Since this exception is a subclass of SAXException, it inherits the ability to wrap another exception.cCs<tj|||||_|jj|_|jj|_|jj|_dS)zECreates the exception. The exception parameter is allowed to be None.N) rr_locator getSystemId _systemIdgetColumnNumber_colnum getLineNumber_linenum)r r r Zlocatorr r r r;s   zSAXParseException.__init__cCs|jS)zNThe column number of the end of the text where the exception occurred.)r)r r r r rHsz!SAXParseException.getColumnNumbercCs|jS)zDThe line number of the end of the text where the exception occurred.)r)r r r r rMszSAXParseException.getLineNumbercCs |jjS)zEGet the public identifier of the entity where the exception occurred.)r getPublicId)r r r r rQszSAXParseException.getPublicIdcCs|jS)zEGet the system identifier of the entity where the exception occurred.)r)r r r r rUszSAXParseException.getSystemIdcCsN|j}|dkrd}|j}|dkr(d}|j}|dkr?z %s:%s:%s: %s)rrrr)r ZsysidZlinenumZcolnumr r r rYszSAXParseException.__str__N) rrrrrrrrrrr r r r r.s  rc@seZdZdZdS)SAXNotRecognizedExceptionzException class for an unrecognized identifier. An XMLReader will raise this exception when it is confronted with an unrecognized feature or property. SAX applications and extensions may use this class for similar purposes.N)rrrrr r r r r!isr!c@seZdZdZdS)SAXNotSupportedExceptionaException class for an unsupported operation. An XMLReader will raise this exception when a service it cannot perform is requested (specifically setting a state or value). SAX applications and extensions may use this class for similar purposes.N)rrrrr r r r r"ssr"c@seZdZdZdS)SAXReaderNotAvailableaException class for a missing driver. An XMLReader module (driver) should raise this exception when it is first imported, e.g. when a support module cannot be imported. It also may be raised during parsing, e.g. if executing an external program is not permitted.N)rrrrr r r r r#}sr#) rsysplatformZ java.langrrrr!r"r#r r r r s %;  PK|]P' ,__pycache__/_exceptions.cpython-36.opt-2.pycnu[3 \@s|ddlZejdddkr&ddlmZ[GdddeZGdddeZGd d d eZGd d d eZGd ddeZdS)Njava) Exceptionc@s6eZdZd ddZddZddZdd Zd d ZdS) SAXExceptionNcCs||_||_tj||dS)N)_msg _exceptionr__init__)selfmsg exceptionr +/usr/lib64/python3.6/xml/sax/_exceptions.pyrszSAXException.__init__cCs|jS)N)r)r r r r getMessageszSAXException.getMessagecCs|jS)N)r)r r r r getExceptionszSAXException.getExceptioncCs|jS)N)r)r r r r __str__"szSAXException.__str__cCs tddS)N __getitem__)AttributeError)r Zixr r r r&szSAXException.__getitem__)N)__name__ __module__ __qualname__rrrrrr r r r r s  rc@s<eZdZddZddZddZddZd d Zd d Zd S)SAXParseExceptioncCs<tj|||||_|jj|_|jj|_|jj|_dS)N) rr_locator getSystemId _systemIdgetColumnNumber_colnum getLineNumber_linenum)r r r Zlocatorr r r r;s   zSAXParseException.__init__cCs|jS)N)r)r r r r rHsz!SAXParseException.getColumnNumbercCs|jS)N)r)r r r r rMszSAXParseException.getLineNumbercCs |jjS)N)r getPublicId)r r r r rQszSAXParseException.getPublicIdcCs|jS)N)r)r r r r rUszSAXParseException.getSystemIdcCsN|j}|dkrd}|j}|dkr(d}|j}|dkr?z %s:%s:%s: %s)rrrr)r ZsysidZlinenumZcolnumr r r rYszSAXParseException.__str__N) rrrrrrrrrr r r r r.s   rc@s eZdZdS)SAXNotRecognizedExceptionN)rrrr r r r r isr c@s eZdZdS)SAXNotSupportedExceptionN)rrrr r r r r!ssr!c@s eZdZdS)SAXReaderNotAvailableN)rrrr r r r r"}sr") sysplatformZ java.langrrrr r!r"r r r r s %;  PK|]leBB*__pycache__/xmlreader.cpython-36.opt-1.pycnu[3 \1@sdZddlmZddlmZmZGdddZGdddeZGdd d ZGd d d Z Gd d d Z Gddde Z ddZ e dkre dS)z]An XML Reader is the SAX 2 name for an XML parser. XML Parsers should be based on this code. )handler)SAXNotSupportedExceptionSAXNotRecognizedExceptionc@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZddZd S)! XMLReadera%Interface for reading an XML document using callbacks. XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse. All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.cCs,tj|_tj|_tj|_tj|_dS)N) rZContentHandler _cont_handlerZ DTDHandler _dtd_handlerZEntityResolver _ent_handlerZ ErrorHandler _err_handler)selfr )/usr/lib64/python3.6/xml/sax/xmlreader.py__init__s   zXMLReader.__init__cCs tddS)zAParse an XML document from a system identifier or an InputSource.z This method must be implemented!N)NotImplementedError)r sourcer r r parseszXMLReader.parsecCs|jS)z#Returns the current ContentHandler.)r)r r r r getContentHandler"szXMLReader.getContentHandlercCs ||_dS)z:Registers a new object to receive document content events.N)r)r rr r r setContentHandler&szXMLReader.setContentHandlercCs|jS)z Returns the current DTD handler.)r)r r r r getDTDHandler*szXMLReader.getDTDHandlercCs ||_dS)z7Register an object to receive basic DTD-related events.N)r)r rr r r setDTDHandler.szXMLReader.setDTDHandlercCs|jS)z#Returns the current EntityResolver.)r)r r r r getEntityResolver2szXMLReader.getEntityResolvercCs ||_dS)z0Register an object to resolve external entities.N)r)r Zresolverr r r setEntityResolver6szXMLReader.setEntityResolvercCs|jS)z!Returns the current ErrorHandler.)r )r r r r getErrorHandler:szXMLReader.getErrorHandlercCs ||_dS)z3Register an object to receive error-message events.N)r )r rr r r setErrorHandler>szXMLReader.setErrorHandlercCs tddS)aHAllow an application to set the locale for errors and warnings. SAX parsers are not required to provide localization for errors and warnings; if they cannot support the requested locale, however, they must raise a SAX exception. Applications may request a locale change in the middle of a parse.zLocale support not implementedN)r)r Zlocaler r r setLocaleBszXMLReader.setLocalecCstd|dS)z1Looks up and returns the state of a SAX2 feature.zFeature '%s' not recognizedN)r)r namer r r getFeatureKszXMLReader.getFeaturecCstd|dS)z!Sets the state of a SAX2 feature.zFeature '%s' not recognizedN)r)r rstater r r setFeatureOszXMLReader.setFeaturecCstd|dS)z2Looks up and returns the value of a SAX2 property.zProperty '%s' not recognizedN)r)r rr r r getPropertySszXMLReader.getPropertycCstd|dS)z"Sets the value of a SAX2 property.zProperty '%s' not recognizedN)r)r rvaluer r r setPropertyWszXMLReader.setPropertyN)__name__ __module__ __qualname____doc__r rrrrrrrrrrrrrr r r r r r s   rc@sBeZdZdZdddZddZdd Zd d Zd d ZddZ dS)IncrementalParserasThis interface adds three extra methods to the XMLReader interface that allow XML parsers to support incremental parsing. Support for this interface is optional, since not all underlying XML parsers support this functionality. When the parser is instantiated it is ready to begin accepting data from the feed method immediately. After parsing has been finished with a call to close the reset method must be called to make the parser ready to accept new data, either from feed or using the parse method. Note that these methods must _not_ be called during parsing, that is, after parse has been called and before it returns. By default, the class also implements the parse method of the XMLReader interface using the feed, close and reset methods of the IncrementalParser interface as a convenience to SAX 2.0 driver writers.cCs||_tj|dS)N)_bufsizerr )r bufsizer r r r oszIncrementalParser.__init__cCspddlm}|j|}|j||j}|dkr8|j}|j|j}x|rb|j||j|j}qFW|j dS)Nr)saxutils) r*Zprepare_input_source prepareParsergetCharacterStream getByteStreamreadr(feedclose)r rr*filebufferr r r rss     zIncrementalParser.parsecCs tddS)aThis method gives the raw XML data in the data parameter to the parser and makes it parse the data, emitting the corresponding events. It is allowed for XML constructs to be split across several calls to feed. feed may raise SAXException.z This method must be implemented!N)r)r datar r r r0szIncrementalParser.feedcCs tddS)ztThis method is called by the parse implementation to allow the SAX 2.0 driver to prepare itself for parsing.z!prepareParser must be overridden!N)r)r rr r r r,szIncrementalParser.prepareParsercCs tddS)aThis method is called when the entire XML document has been passed to the parser through the feed method, to notify the parser that there are no more data. This allows the parser to do the final checks on the document and empty the internal data buffer. The parser will not be ready to parse another document until the reset method has been called. close may raise SAXException.z This method must be implemented!N)r)r r r r r1s zIncrementalParser.closecCs tddS)zThis method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.z This method must be implemented!N)r)r r r r resetszIncrementalParser.resetN)r6) r!r"r#r$r rr0r,r1r5r r r r r%[s   r%c@s0eZdZdZddZddZddZdd Zd S) LocatorzInterface for associating a SAX event with a document location. A locator object will return valid results only during calls to DocumentHandler methods; at any other time, the results are unpredictable.cCsdS)z6Return the column number where the current event ends.rr )r r r r getColumnNumberszLocator.getColumnNumbercCsdS)z4Return the line number where the current event ends.rr8r )r r r r getLineNumberszLocator.getLineNumbercCsdS)z3Return the public identifier for the current event.Nr )r r r r getPublicIdszLocator.getPublicIdcCsdS)z3Return the system identifier for the current event.Nr )r r r r getSystemIdszLocator.getSystemIdN)r!r"r#r$r9r:r;r<r r r r r7s r7c@sjeZdZdZdddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZdS) InputSourceanEncapsulation of the information needed by the XMLReader to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will create objects of this class for use in the XMLReader.parse method and for returning from EntityResolver.resolveEntity. An InputSource belongs to the application, the XMLReader is not allowed to modify InputSource objects passed to it from the application, although it may make copies and modify those.NcCs"||_d|_d|_d|_d|_dS)N)_InputSource__system_id_InputSource__public_id_InputSource__encoding_InputSource__bytefile_InputSource__charfile)r system_idr r r r s zInputSource.__init__cCs ||_dS)z/Sets the public identifier of this InputSource.N)r?)r Z public_idr r r setPublicIdszInputSource.setPublicIdcCs|jS)z2Returns the public identifier of this InputSource.)r?)r r r r r;szInputSource.getPublicIdcCs ||_dS)z/Sets the system identifier of this InputSource.N)r>)r rCr r r setSystemIdszInputSource.setSystemIdcCs|jS)z2Returns the system identifier of this InputSource.)r>)r r r r r<szInputSource.getSystemIdcCs ||_dS)a4Sets the character encoding of this InputSource. The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML recommendation). The encoding attribute of the InputSource is ignored if the InputSource also contains a character stream.N)r@)r encodingr r r setEncodingszInputSource.setEncodingcCs|jS)z/Get the character encoding of this InputSource.)r@)r r r r getEncodingszInputSource.getEncodingcCs ||_dS)aSet the byte stream (a Python file-like object which does not perform byte-to-character conversion) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself. If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.N)rA)r Zbytefiler r r setByteStreams zInputSource.setByteStreamcCs|jS)zGet the byte stream for this input source. The getEncoding method will return the character encoding for this byte stream, or None if unknown.)rA)r r r r r.szInputSource.getByteStreamcCs ||_dS)a^Set the character stream for this input source. (The stream must be a Python 2.0 Unicode-wrapped file-like that performs conversion to Unicode strings.) If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.N)rB)r Zcharfiler r r setCharacterStreamszInputSource.setCharacterStreamcCs|jS)z/Get the character stream for this input source.)rB)r r r r r-szInputSource.getCharacterStream)N)r!r"r#r$r rDr;rEr<rGrHrIr.rJr-r r r r r=s    r=c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZd$ddZddZd d!Zd"d#ZdS)%AttributesImplcCs ||_dS)zQNon-NS-aware implementation. attrs should be of the form {name : value}.N)_attrs)r attrsr r r r szAttributesImpl.__init__cCs t|jS)N)lenrL)r r r r getLengthszAttributesImpl.getLengthcCsdS)NZCDATAr )r rr r r getType!szAttributesImpl.getTypecCs |j|S)N)rL)r rr r r getValue$szAttributesImpl.getValuecCs |j|S)N)rL)r rr r r getValueByQName'szAttributesImpl.getValueByQNamecCs||jkrt||S)N)rLKeyError)r rr r r getNameByQName*s zAttributesImpl.getNameByQNamecCs||jkrt||S)N)rLrS)r rr r r getQNameByName/s zAttributesImpl.getQNameByNamecCst|jjS)N)listrLkeys)r r r r getNames4szAttributesImpl.getNamescCst|jjS)N)rVrLrW)r r r r getQNames7szAttributesImpl.getQNamescCs t|jS)N)rNrL)r r r r __len__:szAttributesImpl.__len__cCs |j|S)N)rL)r rr r r __getitem__=szAttributesImpl.__getitem__cCst|jjS)N)rVrLrW)r r r r rW@szAttributesImpl.keyscCs ||jkS)N)rL)r rr r r __contains__CszAttributesImpl.__contains__NcCs|jj||S)N)rLget)r r alternativer r r r]FszAttributesImpl.getcCs |j|jS)N) __class__rL)r r r r copyIszAttributesImpl.copycCst|jjS)N)rVrLitems)r r r r raLszAttributesImpl.itemscCst|jjS)N)rVrLvalues)r r r r rbOszAttributesImpl.values)N)r!r"r#r rOrPrQrRrTrUrXrYrZr[rWr\r]r`rarbr r r r rKs" rKc@s<eZdZddZddZddZddZd d Zd d Zd S)AttributesNSImplcCs||_||_dS)zNS-aware implementation. attrs should be of the form {(ns_uri, lname): value, ...}. qnames of the form {(ns_uri, lname): qname, ...}.N)rL_qnames)r rMZqnamesr r r r VszAttributesNSImpl.__init__cCs6x(|jjD]\}}||kr |j|Sq Wt|dS)N)rdrarLrS)r rnsnameqnamer r r rR^sz AttributesNSImpl.getValueByQNamecCs0x"|jjD]\}}||kr |Sq Wt|dS)N)rdrarS)r rrerfr r r rTeszAttributesNSImpl.getNameByQNamecCs |j|S)N)rd)r rr r r rUlszAttributesNSImpl.getQNameByNamecCst|jjS)N)rVrdrb)r r r r rYoszAttributesNSImpl.getQNamescCs|j|j|jS)N)r_rLrd)r r r r r`rszAttributesNSImpl.copyN) r!r"r#r rRrTrUrYr`r r r r rcTs rccCstttdS)N)rr%r7r r r r _testvsrg__main__N)r$r+r _exceptionsrrrr%r7r=rKrcrgr!r r r r s PJY>"PK|]// saxutils.pynu["""\ A library of useful helper classes to the SAX classes, for the convenience of application and driver writers. """ import os, urllib.parse, urllib.request import io import codecs from . import handler from . import xmlreader def __dict_replace(s, d): """Replace substrings of a string using a dictionary.""" for key, value in d.items(): s = s.replace(key, value) return s def escape(data, entities={}): """Escape &, <, and > in a string of data. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. """ # must do ampersand first data = data.replace("&", "&") data = data.replace(">", ">") data = data.replace("<", "<") if entities: data = __dict_replace(data, entities) return data def unescape(data, entities={}): """Unescape &, <, and > in a string of data. You can unescape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. """ data = data.replace("<", "<") data = data.replace(">", ">") if entities: data = __dict_replace(data, entities) # must do ampersand last return data.replace("&", "&") def quoteattr(data, entities={}): """Escape and quote an attribute value. Escape &, <, and > in a string of data, then quote it for use as an attribute value. The \" character will be escaped as well, if necessary. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. """ entities = {**entities, '\n': ' ', '\r': ' ', '\t':' '} data = escape(data, entities) if '"' in data: if "'" in data: data = '"%s"' % data.replace('"', """) else: data = "'%s'" % data else: data = '"%s"' % data return data def _gettextwriter(out, encoding): if out is None: import sys return sys.stdout if isinstance(out, io.TextIOBase): # use a text writer as is return out if isinstance(out, (codecs.StreamWriter, codecs.StreamReaderWriter)): # use a codecs stream writer as is return out # wrap a binary writer with TextIOWrapper if isinstance(out, io.RawIOBase): # Keep the original file open when the TextIOWrapper is # destroyed class _wrapper: __class__ = out.__class__ def __getattr__(self, name): return getattr(out, name) buffer = _wrapper() buffer.close = lambda: None else: # This is to handle passed objects that aren't in the # IOBase hierarchy, but just have a write method buffer = io.BufferedIOBase() buffer.writable = lambda: True buffer.write = out.write try: # TextIOWrapper uses this methods to determine # if BOM (for UTF-16, etc) should be added buffer.seekable = out.seekable buffer.tell = out.tell except AttributeError: pass return io.TextIOWrapper(buffer, encoding=encoding, errors='xmlcharrefreplace', newline='\n', write_through=True) class XMLGenerator(handler.ContentHandler): def __init__(self, out=None, encoding="iso-8859-1", short_empty_elements=False): handler.ContentHandler.__init__(self) out = _gettextwriter(out, encoding) self._write = out.write self._flush = out.flush self._ns_contexts = [{}] # contains uri -> prefix dicts self._current_context = self._ns_contexts[-1] self._undeclared_ns_maps = [] self._encoding = encoding self._short_empty_elements = short_empty_elements self._pending_start_element = False def _qname(self, name): """Builds a qualified name from a (ns_url, localname) pair""" if name[0]: # Per http://www.w3.org/XML/1998/namespace, The 'xml' prefix is # bound by definition to http://www.w3.org/XML/1998/namespace. It # does not need to be declared and will not usually be found in # self._current_context. if 'http://www.w3.org/XML/1998/namespace' == name[0]: return 'xml:' + name[1] # The name is in a non-empty namespace prefix = self._current_context[name[0]] if prefix: # If it is not the default namespace, prepend the prefix return prefix + ":" + name[1] # Return the unqualified name return name[1] def _finish_pending_start_element(self,endElement=False): if self._pending_start_element: self._write('>') self._pending_start_element = False # ContentHandler methods def startDocument(self): self._write('\n' % self._encoding) def endDocument(self): self._flush() def startPrefixMapping(self, prefix, uri): self._ns_contexts.append(self._current_context.copy()) self._current_context[uri] = prefix self._undeclared_ns_maps.append((prefix, uri)) def endPrefixMapping(self, prefix): self._current_context = self._ns_contexts[-1] del self._ns_contexts[-1] def startElement(self, name, attrs): self._finish_pending_start_element() self._write('<' + name) for (name, value) in attrs.items(): self._write(' %s=%s' % (name, quoteattr(value))) if self._short_empty_elements: self._pending_start_element = True else: self._write(">") def endElement(self, name): if self._pending_start_element: self._write('/>') self._pending_start_element = False else: self._write('' % name) def startElementNS(self, name, qname, attrs): self._finish_pending_start_element() self._write('<' + self._qname(name)) for prefix, uri in self._undeclared_ns_maps: if prefix: self._write(' xmlns:%s="%s"' % (prefix, uri)) else: self._write(' xmlns="%s"' % uri) self._undeclared_ns_maps = [] for (name, value) in attrs.items(): self._write(' %s=%s' % (self._qname(name), quoteattr(value))) if self._short_empty_elements: self._pending_start_element = True else: self._write(">") def endElementNS(self, name, qname): if self._pending_start_element: self._write('/>') self._pending_start_element = False else: self._write('' % self._qname(name)) def characters(self, content): if content: self._finish_pending_start_element() if not isinstance(content, str): content = str(content, self._encoding) self._write(escape(content)) def ignorableWhitespace(self, content): if content: self._finish_pending_start_element() if not isinstance(content, str): content = str(content, self._encoding) self._write(content) def processingInstruction(self, target, data): self._finish_pending_start_element() self._write('' % (target, data)) class XMLFilterBase(xmlreader.XMLReader): """This class is designed to sit between an XMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.""" def __init__(self, parent = None): xmlreader.XMLReader.__init__(self) self._parent = parent # ErrorHandler methods def error(self, exception): self._err_handler.error(exception) def fatalError(self, exception): self._err_handler.fatalError(exception) def warning(self, exception): self._err_handler.warning(exception) # ContentHandler methods def setDocumentLocator(self, locator): self._cont_handler.setDocumentLocator(locator) def startDocument(self): self._cont_handler.startDocument() def endDocument(self): self._cont_handler.endDocument() def startPrefixMapping(self, prefix, uri): self._cont_handler.startPrefixMapping(prefix, uri) def endPrefixMapping(self, prefix): self._cont_handler.endPrefixMapping(prefix) def startElement(self, name, attrs): self._cont_handler.startElement(name, attrs) def endElement(self, name): self._cont_handler.endElement(name) def startElementNS(self, name, qname, attrs): self._cont_handler.startElementNS(name, qname, attrs) def endElementNS(self, name, qname): self._cont_handler.endElementNS(name, qname) def characters(self, content): self._cont_handler.characters(content) def ignorableWhitespace(self, chars): self._cont_handler.ignorableWhitespace(chars) def processingInstruction(self, target, data): self._cont_handler.processingInstruction(target, data) def skippedEntity(self, name): self._cont_handler.skippedEntity(name) # DTDHandler methods def notationDecl(self, name, publicId, systemId): self._dtd_handler.notationDecl(name, publicId, systemId) def unparsedEntityDecl(self, name, publicId, systemId, ndata): self._dtd_handler.unparsedEntityDecl(name, publicId, systemId, ndata) # EntityResolver methods def resolveEntity(self, publicId, systemId): return self._ent_handler.resolveEntity(publicId, systemId) # XMLReader methods def parse(self, source): self._parent.setContentHandler(self) self._parent.setErrorHandler(self) self._parent.setEntityResolver(self) self._parent.setDTDHandler(self) self._parent.parse(source) def setLocale(self, locale): self._parent.setLocale(locale) def getFeature(self, name): return self._parent.getFeature(name) def setFeature(self, name, state): self._parent.setFeature(name, state) def getProperty(self, name): return self._parent.getProperty(name) def setProperty(self, name, value): self._parent.setProperty(name, value) # XMLFilter methods def getParent(self): return self._parent def setParent(self, parent): self._parent = parent # --- Utility functions def prepare_input_source(source, base=""): """This function takes an InputSource and an optional base URL and returns a fully resolved InputSource object ready for reading.""" if isinstance(source, os.PathLike): source = os.fspath(source) if isinstance(source, str): source = xmlreader.InputSource(source) elif hasattr(source, "read"): f = source source = xmlreader.InputSource() if isinstance(f.read(0), str): source.setCharacterStream(f) else: source.setByteStream(f) if hasattr(f, "name") and isinstance(f.name, str): source.setSystemId(f.name) if source.getCharacterStream() is None and source.getByteStream() is None: sysid = source.getSystemId() basehead = os.path.dirname(os.path.normpath(base)) sysidfilename = os.path.join(basehead, sysid) if os.path.isfile(sysidfilename): source.setSystemId(sysidfilename) f = open(sysidfilename, "rb") else: source.setSystemId(urllib.parse.urljoin(base, sysid)) f = urllib.request.urlopen(source.getSystemId()) source.setByteStream(f) return source PK|]ᶨP1P1 xmlreader.pynu["""An XML Reader is the SAX 2 name for an XML parser. XML Parsers should be based on this code. """ from . import handler from ._exceptions import SAXNotSupportedException, SAXNotRecognizedException # ===== XMLREADER ===== class XMLReader: """Interface for reading an XML document using callbacks. XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse. All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.""" def __init__(self): self._cont_handler = handler.ContentHandler() self._dtd_handler = handler.DTDHandler() self._ent_handler = handler.EntityResolver() self._err_handler = handler.ErrorHandler() def parse(self, source): "Parse an XML document from a system identifier or an InputSource." raise NotImplementedError("This method must be implemented!") def getContentHandler(self): "Returns the current ContentHandler." return self._cont_handler def setContentHandler(self, handler): "Registers a new object to receive document content events." self._cont_handler = handler def getDTDHandler(self): "Returns the current DTD handler." return self._dtd_handler def setDTDHandler(self, handler): "Register an object to receive basic DTD-related events." self._dtd_handler = handler def getEntityResolver(self): "Returns the current EntityResolver." return self._ent_handler def setEntityResolver(self, resolver): "Register an object to resolve external entities." self._ent_handler = resolver def getErrorHandler(self): "Returns the current ErrorHandler." return self._err_handler def setErrorHandler(self, handler): "Register an object to receive error-message events." self._err_handler = handler def setLocale(self, locale): """Allow an application to set the locale for errors and warnings. SAX parsers are not required to provide localization for errors and warnings; if they cannot support the requested locale, however, they must raise a SAX exception. Applications may request a locale change in the middle of a parse.""" raise SAXNotSupportedException("Locale support not implemented") def getFeature(self, name): "Looks up and returns the state of a SAX2 feature." raise SAXNotRecognizedException("Feature '%s' not recognized" % name) def setFeature(self, name, state): "Sets the state of a SAX2 feature." raise SAXNotRecognizedException("Feature '%s' not recognized" % name) def getProperty(self, name): "Looks up and returns the value of a SAX2 property." raise SAXNotRecognizedException("Property '%s' not recognized" % name) def setProperty(self, name, value): "Sets the value of a SAX2 property." raise SAXNotRecognizedException("Property '%s' not recognized" % name) class IncrementalParser(XMLReader): """This interface adds three extra methods to the XMLReader interface that allow XML parsers to support incremental parsing. Support for this interface is optional, since not all underlying XML parsers support this functionality. When the parser is instantiated it is ready to begin accepting data from the feed method immediately. After parsing has been finished with a call to close the reset method must be called to make the parser ready to accept new data, either from feed or using the parse method. Note that these methods must _not_ be called during parsing, that is, after parse has been called and before it returns. By default, the class also implements the parse method of the XMLReader interface using the feed, close and reset methods of the IncrementalParser interface as a convenience to SAX 2.0 driver writers.""" def __init__(self, bufsize=2**16): self._bufsize = bufsize XMLReader.__init__(self) def parse(self, source): from . import saxutils source = saxutils.prepare_input_source(source) self.prepareParser(source) file = source.getCharacterStream() if file is None: file = source.getByteStream() while buffer := file.read(self._bufsize): self.feed(buffer) self.close() def feed(self, data): """This method gives the raw XML data in the data parameter to the parser and makes it parse the data, emitting the corresponding events. It is allowed for XML constructs to be split across several calls to feed. feed may raise SAXException.""" raise NotImplementedError("This method must be implemented!") def prepareParser(self, source): """This method is called by the parse implementation to allow the SAX 2.0 driver to prepare itself for parsing.""" raise NotImplementedError("prepareParser must be overridden!") def close(self): """This method is called when the entire XML document has been passed to the parser through the feed method, to notify the parser that there are no more data. This allows the parser to do the final checks on the document and empty the internal data buffer. The parser will not be ready to parse another document until the reset method has been called. close may raise SAXException.""" raise NotImplementedError("This method must be implemented!") def reset(self): """This method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.""" raise NotImplementedError("This method must be implemented!") # ===== LOCATOR ===== class Locator: """Interface for associating a SAX event with a document location. A locator object will return valid results only during calls to DocumentHandler methods; at any other time, the results are unpredictable.""" def getColumnNumber(self): "Return the column number where the current event ends." return -1 def getLineNumber(self): "Return the line number where the current event ends." return -1 def getPublicId(self): "Return the public identifier for the current event." return None def getSystemId(self): "Return the system identifier for the current event." return None # ===== INPUTSOURCE ===== class InputSource: """Encapsulation of the information needed by the XMLReader to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will create objects of this class for use in the XMLReader.parse method and for returning from EntityResolver.resolveEntity. An InputSource belongs to the application, the XMLReader is not allowed to modify InputSource objects passed to it from the application, although it may make copies and modify those.""" def __init__(self, system_id = None): self.__system_id = system_id self.__public_id = None self.__encoding = None self.__bytefile = None self.__charfile = None def setPublicId(self, public_id): "Sets the public identifier of this InputSource." self.__public_id = public_id def getPublicId(self): "Returns the public identifier of this InputSource." return self.__public_id def setSystemId(self, system_id): "Sets the system identifier of this InputSource." self.__system_id = system_id def getSystemId(self): "Returns the system identifier of this InputSource." return self.__system_id def setEncoding(self, encoding): """Sets the character encoding of this InputSource. The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML recommendation). The encoding attribute of the InputSource is ignored if the InputSource also contains a character stream.""" self.__encoding = encoding def getEncoding(self): "Get the character encoding of this InputSource." return self.__encoding def setByteStream(self, bytefile): """Set the byte stream (a Python file-like object which does not perform byte-to-character conversion) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself. If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.""" self.__bytefile = bytefile def getByteStream(self): """Get the byte stream for this input source. The getEncoding method will return the character encoding for this byte stream, or None if unknown.""" return self.__bytefile def setCharacterStream(self, charfile): """Set the character stream for this input source. (The stream must be a Python 2.0 Unicode-wrapped file-like that performs conversion to Unicode strings.) If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.""" self.__charfile = charfile def getCharacterStream(self): "Get the character stream for this input source." return self.__charfile # ===== ATTRIBUTESIMPL ===== class AttributesImpl: def __init__(self, attrs): """Non-NS-aware implementation. attrs should be of the form {name : value}.""" self._attrs = attrs def getLength(self): return len(self._attrs) def getType(self, name): return "CDATA" def getValue(self, name): return self._attrs[name] def getValueByQName(self, name): return self._attrs[name] def getNameByQName(self, name): if name not in self._attrs: raise KeyError(name) return name def getQNameByName(self, name): if name not in self._attrs: raise KeyError(name) return name def getNames(self): return list(self._attrs.keys()) def getQNames(self): return list(self._attrs.keys()) def __len__(self): return len(self._attrs) def __getitem__(self, name): return self._attrs[name] def keys(self): return list(self._attrs.keys()) def __contains__(self, name): return name in self._attrs def get(self, name, alternative=None): return self._attrs.get(name, alternative) def copy(self): return self.__class__(self._attrs) def items(self): return list(self._attrs.items()) def values(self): return list(self._attrs.values()) # ===== ATTRIBUTESNSIMPL ===== class AttributesNSImpl(AttributesImpl): def __init__(self, attrs, qnames): """NS-aware implementation. attrs should be of the form {(ns_uri, lname): value, ...}. qnames of the form {(ns_uri, lname): qname, ...}.""" self._attrs = attrs self._qnames = qnames def getValueByQName(self, name): for (nsname, qname) in self._qnames.items(): if qname == name: return self._attrs[nsname] raise KeyError(name) def getNameByQName(self, name): for (nsname, qname) in self._qnames.items(): if qname == name: return nsname raise KeyError(name) def getQNameByName(self, name): return self._qnames[name] def getQNames(self): return list(self._qnames.values()) def copy(self): return self.__class__(self._attrs, self._qnames) def _test(): XMLReader() IncrementalParser() Locator() if __name__ == "__main__": _test() PK|]R>>expatreader.pynu[""" SAX driver for the pyexpat C module. This driver works with pyexpat.__version__ == '2.22'. """ version = "0.20" from xml.sax._exceptions import * from xml.sax.handler import feature_validation, feature_namespaces from xml.sax.handler import feature_namespace_prefixes from xml.sax.handler import feature_external_ges, feature_external_pes from xml.sax.handler import feature_string_interning from xml.sax.handler import property_xml_string, property_interning_dict try: from xml.parsers import expat except ImportError: raise SAXReaderNotAvailable("expat not supported", None) else: if not hasattr(expat, "ParserCreate"): raise SAXReaderNotAvailable("expat not supported", None) from xml.sax import xmlreader, saxutils, handler AttributesImpl = xmlreader.AttributesImpl AttributesNSImpl = xmlreader.AttributesNSImpl # If we're using a sufficiently recent version of Python, we can use # weak references to avoid cycles between the parser and content # handler, otherwise we'll just have to pretend. try: import _weakref except ImportError: def _mkproxy(o): return o else: import weakref _mkproxy = weakref.proxy del weakref, _weakref class _ClosedParser: pass # --- ExpatLocator class ExpatLocator(xmlreader.Locator): """Locator for use with the ExpatParser class. This uses a weak reference to the parser object to avoid creating a circular reference between the parser and the content handler. """ def __init__(self, parser): self._ref = _mkproxy(parser) def getColumnNumber(self): parser = self._ref if parser._parser is None: return None return parser._parser.ErrorColumnNumber def getLineNumber(self): parser = self._ref if parser._parser is None: return 1 return parser._parser.ErrorLineNumber def getPublicId(self): parser = self._ref if parser is None: return None return parser._source.getPublicId() def getSystemId(self): parser = self._ref if parser is None: return None return parser._source.getSystemId() # --- ExpatParser class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator): """SAX driver for the pyexpat C module.""" def __init__(self, namespaceHandling=0, bufsize=2**16-20): xmlreader.IncrementalParser.__init__(self, bufsize) self._source = xmlreader.InputSource() self._parser = None self._namespaces = namespaceHandling self._lex_handler_prop = None self._parsing = False self._entity_stack = [] self._external_ges = 0 self._interning = None # XMLReader methods def parse(self, source): "Parse an XML document from a URL or an InputSource." source = saxutils.prepare_input_source(source) self._source = source try: self.reset() self._cont_handler.setDocumentLocator(ExpatLocator(self)) xmlreader.IncrementalParser.parse(self, source) except: # bpo-30264: Close the source on error to not leak resources: # xml.sax.parse() doesn't give access to the underlying parser # to the caller self._close_source() raise def prepareParser(self, source): if source.getSystemId() is not None: self._parser.SetBase(source.getSystemId()) # Redefined setContentHandler to allow changing handlers during parsing def setContentHandler(self, handler): xmlreader.IncrementalParser.setContentHandler(self, handler) if self._parsing: self._reset_cont_handler() def getFeature(self, name): if name == feature_namespaces: return self._namespaces elif name == feature_string_interning: return self._interning is not None elif name in (feature_validation, feature_external_pes, feature_namespace_prefixes): return 0 elif name == feature_external_ges: return self._external_ges raise SAXNotRecognizedException("Feature '%s' not recognized" % name) def setFeature(self, name, state): if self._parsing: raise SAXNotSupportedException("Cannot set features while parsing") if name == feature_namespaces: self._namespaces = state elif name == feature_external_ges: self._external_ges = state elif name == feature_string_interning: if state: if self._interning is None: self._interning = {} else: self._interning = None elif name == feature_validation: if state: raise SAXNotSupportedException( "expat does not support validation") elif name == feature_external_pes: if state: raise SAXNotSupportedException( "expat does not read external parameter entities") elif name == feature_namespace_prefixes: if state: raise SAXNotSupportedException( "expat does not report namespace prefixes") else: raise SAXNotRecognizedException( "Feature '%s' not recognized" % name) def getProperty(self, name): if name == handler.property_lexical_handler: return self._lex_handler_prop elif name == property_interning_dict: return self._interning elif name == property_xml_string: if self._parser: if hasattr(self._parser, "GetInputContext"): return self._parser.GetInputContext() else: raise SAXNotRecognizedException( "This version of expat does not support getting" " the XML string") else: raise SAXNotSupportedException( "XML string cannot be returned when not parsing") raise SAXNotRecognizedException("Property '%s' not recognized" % name) def setProperty(self, name, value): if name == handler.property_lexical_handler: self._lex_handler_prop = value if self._parsing: self._reset_lex_handler_prop() elif name == property_interning_dict: self._interning = value elif name == property_xml_string: raise SAXNotSupportedException("Property '%s' cannot be set" % name) else: raise SAXNotRecognizedException("Property '%s' not recognized" % name) # IncrementalParser methods def feed(self, data, isFinal=False): if not self._parsing: self.reset() self._parsing = True self._cont_handler.startDocument() try: # The isFinal parameter is internal to the expat reader. # If it is set to true, expat will check validity of the entire # document. When feeding chunks, they are not normally final - # except when invoked from close. self._parser.Parse(data, isFinal) except expat.error as e: exc = SAXParseException(expat.ErrorString(e.code), e, self) # FIXME: when to invoke error()? self._err_handler.fatalError(exc) def flush(self): if self._parser is None: return was_enabled = self._parser.GetReparseDeferralEnabled() try: self._parser.SetReparseDeferralEnabled(False) self._parser.Parse(b"", False) except expat.error as e: exc = SAXParseException(expat.ErrorString(e.code), e, self) self._err_handler.fatalError(exc) finally: self._parser.SetReparseDeferralEnabled(was_enabled) def _close_source(self): source = self._source try: file = source.getCharacterStream() if file is not None: file.close() finally: file = source.getByteStream() if file is not None: file.close() def close(self): if (self._entity_stack or self._parser is None or isinstance(self._parser, _ClosedParser)): # If we are completing an external entity, do nothing here return try: self.feed(b"", isFinal=True) self._cont_handler.endDocument() self._parsing = False # break cycle created by expat handlers pointing to our methods self._parser = None finally: self._parsing = False if self._parser is not None: # Keep ErrorColumnNumber and ErrorLineNumber after closing. parser = _ClosedParser() parser.ErrorColumnNumber = self._parser.ErrorColumnNumber parser.ErrorLineNumber = self._parser.ErrorLineNumber self._parser = parser self._close_source() def _reset_cont_handler(self): self._parser.ProcessingInstructionHandler = \ self._cont_handler.processingInstruction self._parser.CharacterDataHandler = self._cont_handler.characters def _reset_lex_handler_prop(self): lex = self._lex_handler_prop parser = self._parser if lex is None: parser.CommentHandler = None parser.StartCdataSectionHandler = None parser.EndCdataSectionHandler = None parser.StartDoctypeDeclHandler = None parser.EndDoctypeDeclHandler = None else: parser.CommentHandler = lex.comment parser.StartCdataSectionHandler = lex.startCDATA parser.EndCdataSectionHandler = lex.endCDATA parser.StartDoctypeDeclHandler = self.start_doctype_decl parser.EndDoctypeDeclHandler = lex.endDTD def reset(self): if self._namespaces: self._parser = expat.ParserCreate(self._source.getEncoding(), " ", intern=self._interning) self._parser.namespace_prefixes = 1 self._parser.StartElementHandler = self.start_element_ns self._parser.EndElementHandler = self.end_element_ns else: self._parser = expat.ParserCreate(self._source.getEncoding(), intern = self._interning) self._parser.StartElementHandler = self.start_element self._parser.EndElementHandler = self.end_element self._reset_cont_handler() self._parser.UnparsedEntityDeclHandler = self.unparsed_entity_decl self._parser.NotationDeclHandler = self.notation_decl self._parser.StartNamespaceDeclHandler = self.start_namespace_decl self._parser.EndNamespaceDeclHandler = self.end_namespace_decl self._decl_handler_prop = None if self._lex_handler_prop: self._reset_lex_handler_prop() # self._parser.DefaultHandler = # self._parser.DefaultHandlerExpand = # self._parser.NotStandaloneHandler = self._parser.ExternalEntityRefHandler = self.external_entity_ref try: self._parser.SkippedEntityHandler = self.skipped_entity_handler except AttributeError: # This pyexpat does not support SkippedEntity pass self._parser.SetParamEntityParsing( expat.XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) self._parsing = False self._entity_stack = [] # Locator methods def getColumnNumber(self): if self._parser is None: return None return self._parser.ErrorColumnNumber def getLineNumber(self): if self._parser is None: return 1 return self._parser.ErrorLineNumber def getPublicId(self): return self._source.getPublicId() def getSystemId(self): return self._source.getSystemId() # event handlers def start_element(self, name, attrs): self._cont_handler.startElement(name, AttributesImpl(attrs)) def end_element(self, name): self._cont_handler.endElement(name) def start_element_ns(self, name, attrs): pair = name.split() if len(pair) == 1: # no namespace pair = (None, name) elif len(pair) == 3: pair = pair[0], pair[1] else: # default namespace pair = tuple(pair) newattrs = {} qnames = {} for (aname, value) in attrs.items(): parts = aname.split() length = len(parts) if length == 1: # no namespace qname = aname apair = (None, aname) elif length == 3: qname = "%s:%s" % (parts[2], parts[1]) apair = parts[0], parts[1] else: # default namespace qname = parts[1] apair = tuple(parts) newattrs[apair] = value qnames[apair] = qname self._cont_handler.startElementNS(pair, None, AttributesNSImpl(newattrs, qnames)) def end_element_ns(self, name): pair = name.split() if len(pair) == 1: pair = (None, name) elif len(pair) == 3: pair = pair[0], pair[1] else: pair = tuple(pair) self._cont_handler.endElementNS(pair, None) # this is not used (call directly to ContentHandler) def processing_instruction(self, target, data): self._cont_handler.processingInstruction(target, data) # this is not used (call directly to ContentHandler) def character_data(self, data): self._cont_handler.characters(data) def start_namespace_decl(self, prefix, uri): self._cont_handler.startPrefixMapping(prefix, uri) def end_namespace_decl(self, prefix): self._cont_handler.endPrefixMapping(prefix) def start_doctype_decl(self, name, sysid, pubid, has_internal_subset): self._lex_handler_prop.startDTD(name, pubid, sysid) def unparsed_entity_decl(self, name, base, sysid, pubid, notation_name): self._dtd_handler.unparsedEntityDecl(name, pubid, sysid, notation_name) def notation_decl(self, name, base, sysid, pubid): self._dtd_handler.notationDecl(name, pubid, sysid) def external_entity_ref(self, context, base, sysid, pubid): if not self._external_ges: return 1 source = self._ent_handler.resolveEntity(pubid, sysid) source = saxutils.prepare_input_source(source, self._source.getSystemId() or "") self._entity_stack.append((self._parser, self._source)) self._parser = self._parser.ExternalEntityParserCreate(context) self._source = source try: xmlreader.IncrementalParser.parse(self, source) except: return 0 # FIXME: save error info here? (self._parser, self._source) = self._entity_stack[-1] del self._entity_stack[-1] return 1 def skipped_entity_handler(self, name, is_pe): if is_pe: # The SAX spec requires to report skipped PEs with a '%' name = '%'+name self._cont_handler.skippedEntity(name) # --- def create_parser(*args, **kwargs): return ExpatParser(*args, **kwargs) # --- if __name__ == "__main__": import xml.sax.saxutils p = create_parser() p.setContentHandler(xml.sax.saxutils.XMLGenerator()) p.setErrorHandler(xml.sax.ErrorHandler()) p.parse("http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml") PK|]9== handler.pynu[""" This module contains the core classes of version 2.0 of SAX for Python. This file provides only default classes with absolutely minimum functionality, from which drivers and applications can be subclassed. Many of these classes are empty and are included only as documentation of the interfaces. $Id$ """ version = '2.0beta' #============================================================================ # # HANDLER INTERFACES # #============================================================================ # ===== ERRORHANDLER ===== class ErrorHandler: """Basic interface for SAX error handlers. If you create an object that implements this interface, then register the object with your XMLReader, the parser will call the methods in your object to report all warnings and errors. There are three levels of errors available: warnings, (possibly) recoverable errors, and unrecoverable errors. All methods take a SAXParseException as the only parameter.""" def error(self, exception): "Handle a recoverable error." raise exception def fatalError(self, exception): "Handle a non-recoverable error." raise exception def warning(self, exception): "Handle a warning." print(exception) # ===== CONTENTHANDLER ===== class ContentHandler: """Interface for receiving logical document content events. This is the main callback interface in SAX, and the one most important to applications. The order of events in this interface mirrors the order of the information in the document.""" def __init__(self): self._locator = None def setDocumentLocator(self, locator): """Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface. The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine. Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.""" self._locator = locator def startDocument(self): """Receive notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).""" def endDocument(self): """Receive notification of the end of a document. The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.""" def startPrefixMapping(self, prefix, uri): """Begin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default). There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary. Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.""" def endPrefixMapping(self, prefix): """End the scope of a prefix-URI mapping. See startPrefixMapping for details. This event will always occur after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.""" def startElement(self, name, attrs): """Signals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an instance of the Attributes class containing the attributes of the element.""" def endElement(self, name): """Signals the end of an element in non-namespace mode. The name parameter contains the name of the element type, just as with the startElement event.""" def startElementNS(self, name, qname, attrs): """Signals the start of an element in namespace mode. The name parameter contains the name of the element type as a (uri, localname) tuple, the qname parameter the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the Attributes class containing the attributes of the element. The uri part of the name tuple is None for elements which have no namespace.""" def endElementNS(self, name, qname): """Signals the end of an element in namespace mode. The name parameter contains the name of the element type, just as with the startElementNS event.""" def characters(self, content): """Receive notification of character data. The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.""" def ignorableWhitespace(self, whitespace): """Receive notification of ignorable whitespace in element content. Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.""" def processingInstruction(self, target, data): """Receive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.""" def skippedEntity(self, name): """Receive notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.""" # ===== DTDHandler ===== class DTDHandler: """Handle DTD events. This interface specifies only those DTD events required for basic parsing (unparsed entities and attributes).""" def notationDecl(self, name, publicId, systemId): "Handle a notation declaration event." def unparsedEntityDecl(self, name, publicId, systemId, ndata): "Handle an unparsed entity declaration event." # ===== ENTITYRESOLVER ===== class EntityResolver: """Basic interface for resolving entities. If you create an object implementing this interface, then register the object with your Parser, the parser will call the method in your object to resolve all external entities. Note that DefaultHandler implements this interface with the default behaviour.""" def resolveEntity(self, publicId, systemId): """Resolve the system identifier of an entity and return either the system identifier to read from as a string, or an InputSource to read from.""" return systemId #============================================================================ # # CORE FEATURES # #============================================================================ feature_namespaces = "http://xml.org/sax/features/namespaces" # true: Perform Namespace processing (default). # false: Optionally do not perform Namespace processing # (implies namespace-prefixes). # access: (parsing) read-only; (not parsing) read/write feature_namespace_prefixes = "http://xml.org/sax/features/namespace-prefixes" # true: Report the original prefixed names and attributes used for Namespace # declarations. # false: Do not report attributes used for Namespace declarations, and # optionally do not report original prefixed names (default). # access: (parsing) read-only; (not parsing) read/write feature_string_interning = "http://xml.org/sax/features/string-interning" # true: All element names, prefixes, attribute names, Namespace URIs, and # local names are interned using the built-in intern function. # false: Names are not necessarily interned, although they may be (default). # access: (parsing) read-only; (not parsing) read/write feature_validation = "http://xml.org/sax/features/validation" # true: Report all validation errors (implies external-general-entities and # external-parameter-entities). # false: Do not report validation errors. # access: (parsing) read-only; (not parsing) read/write feature_external_ges = "http://xml.org/sax/features/external-general-entities" # true: Include all external general (text) entities. # false: Do not include external general entities. # access: (parsing) read-only; (not parsing) read/write feature_external_pes = "http://xml.org/sax/features/external-parameter-entities" # true: Include all external parameter entities, including the external # DTD subset. # false: Do not include any external parameter entities, even the external # DTD subset. # access: (parsing) read-only; (not parsing) read/write all_features = [feature_namespaces, feature_namespace_prefixes, feature_string_interning, feature_validation, feature_external_ges, feature_external_pes] #============================================================================ # # CORE PROPERTIES # #============================================================================ property_lexical_handler = "http://xml.org/sax/properties/lexical-handler" # data type: xml.sax.sax2lib.LexicalHandler # description: An optional extension handler for lexical events like comments. # access: read/write property_declaration_handler = "http://xml.org/sax/properties/declaration-handler" # data type: xml.sax.sax2lib.DeclHandler # description: An optional extension handler for DTD-related events other # than notations and unparsed entities. # access: read/write property_dom_node = "http://xml.org/sax/properties/dom-node" # data type: org.w3c.dom.Node # description: When parsing, the current DOM node being visited if this is # a DOM iterator; when not parsing, the root DOM node for # iteration. # access: (parsing) read-only; (not parsing) read/write property_xml_string = "http://xml.org/sax/properties/xml-string" # data type: String # description: The literal string of characters that was the source for # the current event. # access: read-only property_encoding = "http://www.python.org/sax/properties/encoding" # data type: String # description: The name of the encoding to assume for input data. # access: write: set the encoding, e.g. established by a higher-level # protocol. May change during parsing (e.g. after # processing a META tag) # read: return the current encoding (possibly established through # auto-detection. # initial value: UTF-8 # property_interning_dict = "http://www.python.org/sax/properties/interning-dict" # data type: Dictionary # description: The dictionary used to intern common strings in the document # access: write: Request that the parser uses a specific dictionary, to # allow interning across different documents # read: return the current interning dictionary, or None # all_properties = [property_lexical_handler, property_dom_node, property_declaration_handler, property_xml_string, property_encoding, property_interning_dict] class LexicalHandler: """Optional SAX2 handler for lexical events. This handler is used to obtain lexical information about an XML document, that is, information about how the document was encoded (as opposed to what it contains, which is reported to the ContentHandler), such as comments and CDATA marked section boundaries. To set the LexicalHandler of an XMLReader, use the setProperty method with the property identifier 'http://xml.org/sax/properties/lexical-handler'.""" def comment(self, content): """Reports a comment anywhere in the document (including the DTD and outside the document element). content is a string that holds the contents of the comment.""" def startDTD(self, name, public_id, system_id): """Report the start of the DTD declarations, if the document has an associated DTD. A startEntity event will be reported before declaration events from the external DTD subset are reported, and this can be used to infer from which subset DTD declarations derive. name is the name of the document element type, public_id the public identifier of the DTD (or None if none were supplied) and system_id the system identfier of the external subset (or None if none were supplied).""" def endDTD(self): """Signals the end of DTD declarations.""" def startCDATA(self): """Reports the beginning of a CDATA marked section. The contents of the CDATA marked section will be reported through the characters event.""" def endCDATA(self): """Reports the end of a CDATA marked section.""" PK|]|.x __init__.pynu["""Simple API for XML (SAX) implementation for Python. This module provides an implementation of the SAX 2 interface; information about the Java version of the interface can be found at http://www.megginson.com/SAX/. The Python version of the interface is documented at <...>. This package contains the following modules: handler -- Base classes and constants which define the SAX 2 API for the 'client-side' of SAX for Python. saxutils -- Implementation of the convenience classes commonly used to work with SAX. xmlreader -- Base classes and constants which define the SAX 2 API for the parsers used with SAX for Python. expatreader -- Driver that allows use of the Expat parser with SAX. """ from .xmlreader import InputSource from .handler import ContentHandler, ErrorHandler from ._exceptions import SAXException, SAXNotRecognizedException, \ SAXParseException, SAXNotSupportedException, \ SAXReaderNotAvailable def parse(source, handler, errorHandler=ErrorHandler()): parser = make_parser() parser.setContentHandler(handler) parser.setErrorHandler(errorHandler) parser.parse(source) def parseString(string, handler, errorHandler=ErrorHandler()): import io if errorHandler is None: errorHandler = ErrorHandler() parser = make_parser() parser.setContentHandler(handler) parser.setErrorHandler(errorHandler) inpsrc = InputSource() if isinstance(string, str): inpsrc.setCharacterStream(io.StringIO(string)) else: inpsrc.setByteStream(io.BytesIO(string)) parser.parse(inpsrc) # this is the parser list used by the make_parser function if no # alternatives are given as parameters to the function default_parser_list = ["xml.sax.expatreader"] # tell modulefinder that importing sax potentially imports expatreader _false = 0 if _false: import xml.sax.expatreader import os, sys if not sys.flags.ignore_environment and "PY_SAX_PARSER" in os.environ: default_parser_list = os.environ["PY_SAX_PARSER"].split(",") del os, sys def make_parser(parser_list=()): """Creates and returns a SAX parser. Creates the first parser it is able to instantiate of the ones given in the iterable created by chaining parser_list and default_parser_list. The iterables must contain the names of Python modules containing both a SAX parser and a create_parser function.""" for parser_name in list(parser_list) + default_parser_list: try: return _create_parser(parser_name) except ImportError: import sys if parser_name in sys.modules: # The parser module was found, but importing it # failed unexpectedly, pass this exception through raise except SAXReaderNotAvailable: # The parser module detected that it won't work properly, # so try the next one pass raise SAXReaderNotAvailable("No parsers found", None) # --- Internal utility methods used by make_parser def _create_parser(parser_name): drv_module = __import__(parser_name,{},{},['create_parser']) return drv_module.create_parser() PK|]C[[_exceptions.pynu["""Different kinds of SAX Exceptions""" # ===== SAXEXCEPTION ===== class SAXException(Exception): """Encapsulate an XML error or warning. This class can contain basic error or warning information from either the XML parser or the application: you can subclass it to provide additional functionality, or to add localization. Note that although you will receive a SAXException as the argument to the handlers in the ErrorHandler interface, you are not actually required to raise the exception; instead, you can simply read the information in it.""" def __init__(self, msg, exception=None): """Creates an exception. The message is required, but the exception is optional.""" self._msg = msg self._exception = exception Exception.__init__(self, msg) def getMessage(self): "Return a message for this exception." return self._msg def getException(self): "Return the embedded exception, or None if there was none." return self._exception def __str__(self): "Create a string representation of the exception." return self._msg def __getitem__(self, ix): """Avoids weird error messages if someone does exception[ix] by mistake, since Exception has __getitem__ defined.""" raise AttributeError("__getitem__") # ===== SAXPARSEEXCEPTION ===== class SAXParseException(SAXException): """Encapsulate an XML parse error or warning. This exception will include information for locating the error in the original XML document. Note that although the application will receive a SAXParseException as the argument to the handlers in the ErrorHandler interface, the application is not actually required to raise the exception; instead, it can simply read the information in it and take a different action. Since this exception is a subclass of SAXException, it inherits the ability to wrap another exception.""" def __init__(self, msg, exception, locator): "Creates the exception. The exception parameter is allowed to be None." SAXException.__init__(self, msg, exception) self._locator = locator # We need to cache this stuff at construction time. # If this exception is raised, the objects through which we must # traverse to get this information may be deleted by the time # it gets caught. self._systemId = self._locator.getSystemId() self._colnum = self._locator.getColumnNumber() self._linenum = self._locator.getLineNumber() def getColumnNumber(self): """The column number of the end of the text where the exception occurred.""" return self._colnum def getLineNumber(self): "The line number of the end of the text where the exception occurred." return self._linenum def getPublicId(self): "Get the public identifier of the entity where the exception occurred." return self._locator.getPublicId() def getSystemId(self): "Get the system identifier of the entity where the exception occurred." return self._systemId def __str__(self): "Create a string representation of the exception." sysid = self.getSystemId() if sysid is None: sysid = "" linenum = self.getLineNumber() if linenum is None: linenum = "?" colnum = self.getColumnNumber() if colnum is None: colnum = "?" return "%s:%s:%s: %s" % (sysid, linenum, colnum, self._msg) # ===== SAXNOTRECOGNIZEDEXCEPTION ===== class SAXNotRecognizedException(SAXException): """Exception class for an unrecognized identifier. An XMLReader will raise this exception when it is confronted with an unrecognized feature or property. SAX applications and extensions may use this class for similar purposes.""" # ===== SAXNOTSUPPORTEDEXCEPTION ===== class SAXNotSupportedException(SAXException): """Exception class for an unsupported operation. An XMLReader will raise this exception when a service it cannot perform is requested (specifically setting a state or value). SAX applications and extensions may use this class for similar purposes.""" # ===== SAXNOTSUPPORTEDEXCEPTION ===== class SAXReaderNotAvailable(SAXNotSupportedException): """Exception class for a missing driver. An XMLReader module (driver) should raise this exception when it is first imported, e.g. when a support module cannot be imported. It also may be raised during parsing, e.g. if executing an external program is not permitted.""" PKA ]'ZE;E;expatreader.pycnu[ {fc@s3dZdZddlTddlmZmZddlmZddlmZmZddlm Z ddlm Z m Z dd l Z e j d d kred en[ ydd lmZWn ek reden#Xeed redenddlmZmZmZejZejZydd lZWnek r_dZnXdd lZejZ[[dfdYZdejfdYZ dej!ejfdYZ"dZ#e$dkr/dd l%Z&e#Z'e'j(e&j)jj*e'j+e&j)j,e'j-dnd S(s] SAX driver for the pyexpat C module. This driver works with pyexpat.__version__ == '2.22'. s0.20i(t*(tfeature_validationtfeature_namespaces(tfeature_namespace_prefixes(tfeature_external_gestfeature_external_pes(tfeature_string_interning(tproperty_xml_stringtproperty_interning_dictNitjavasexpat not available in Java(texpatsexpat not supportedt ParserCreate(t xmlreadertsaxutilsthandlercCs|S(N((to((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt_mkproxy'st _ClosedParsercBseZRS((t__name__t __module__(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR.st ExpatLocatorcBs;eZdZdZdZdZdZdZRS(sLocator for use with the ExpatParser class. This uses a weak reference to the parser object to avoid creating a circular reference between the parser and the content handler. cCst||_dS(N(Rt_ref(tselftparser((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt__init__9scCs&|j}|jdkrdS|jjS(N(Rt_parsertNonetErrorColumnNumber(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytgetColumnNumber<s cCs&|j}|jdkrdS|jjS(Ni(RRRtErrorLineNumber(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt getLineNumberBs cCs&|j}|dkrdS|jjS(N(RRt_sourcet getPublicId(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR Hs  cCs&|j}|dkrdS|jjS(N(RRRt getSystemId(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR!Ns  (RRt__doc__RRRR R!(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR3s     t ExpatParsercBs.eZdZdd%dZdZdZdZd Zd Zd Z d Z dd Z dZ dZ dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zd!Zd"Z d#Z!RS(&s$SAX driver for the pyexpat C module.iiiicCsetjj||tj|_d|_||_d|_d|_ g|_ d|_ d|_ dS(Nii( R tIncrementalParserRt InputSourceRRRt _namespacest_lex_handler_propt_parsingt _entity_stackt _external_gest _interning(RtnamespaceHandlingtbufsize((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRZs      cCsjtj|}||_y7|j|jjt|tjj ||Wn|j nXdS(s3Parse an XML document from a URL or an InputSource.N( R tprepare_input_sourceRtresett _cont_handlertsetDocumentLocatorRR R$tparset _close_source(Rtsource((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR2gs   cCsV|jdk rR|j}t|tr?|jd}n|jj|ndS(Nsutf-8(R!Rt isinstancetunicodetencodeRtSetBase(RR4tbase((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt prepareParserws  cCs-tjj|||jr)|jndS(N(R R$tsetContentHandlerR(t_reset_cont_handler(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR;s cCsl|tkr|jS|tkr,|jdk S|tttfkrEdS|tkrX|j St d|dS(NisFeature '%s' not recognized( RR&RR+RRRRRR*tSAXNotRecognizedException(Rtname((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt getFeatures      cCs|jrtdn|tkr0||_n|tkrH||_n|tkr|rx|jdkri|_qqd|_n||t kr|rtdqnX|t kr|rtdqn4|t kr|rtdqnt d|dS(Ns!Cannot set features while parsings!expat does not support validations/expat does not read external parameter entitiess(expat does not report namespace prefixessFeature '%s' not recognized( R(tSAXNotSupportedExceptionRR&RR*RR+RRRRR=(RR>tstate((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt setFeatures2          cCs|tjkr|jS|tkr)|jS|tkr{|jrlt|jdr]|jjSt dq{t dnt d|dS(NtGetInputContexts=This version of expat does not support getting the XML strings.XML string cannot be returned when not parsingsProperty '%s' not recognized( Rtproperty_lexical_handlerR'RR+RRthasattrRCR=R@(RR>((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt getPropertys      cCs||tjkr1||_|jrx|jqxnG|tkrI||_n/|tkrhtd|nt d|dS(NsProperty '%s' cannot be setsProperty '%s' not recognized( RRDR'R(t_reset_lex_handler_propRR+RR@R=(RR>tvalue((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt setPropertys      cCs|js,|jd|_|jjny|jj||WnDtjk r}ttj |j ||}|j j |nXdS(Ni( R(R/R0t startDocumentRtParseR terrortSAXParseExceptiont ErrorStringtcodet _err_handlert fatalError(RtdatatisFinaltetexc((s+/usr/lib64/python2.7/xml/sax/expatreader.pytfeeds   cCs_|j}z)|j}|dk r1|jnWd|j}|dk rZ|jnXdS(N(RtgetCharacterStreamRtcloset getByteStream(RR4tfile((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR3s     cCs|js*|jdks*t|jtr.dSz6|jddd|jjd|_d|_Wdd|_|jdk rt}|jj |_ |jj |_ ||_n|j XdS(NtRSii( R)RRR5RRVR0t endDocumentR(RRR3(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRXs      cCs(|jj|j_|jj|j_dS(N(R0tprocessingInstructionRtProcessingInstructionHandlert characterstCharacterDataHandler(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR<scCs|j}|j}|dkrNd|_d|_d|_d|_d|_n<|j|_|j |_|j |_|j |_|j |_dS(N( R'RRtCommentHandlertStartCdataSectionHandlertEndCdataSectionHandlertStartDoctypeDeclHandlertEndDoctypeDeclHandlertcommentt startCDATAtendCDATAtstart_doctype_decltendDTD(RtlexR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRGs            cCsc|jr]tj|jjdd|j|_d|j_|j|j_ |j |j_ nBtj|jjd|j|_|j |j_ |j |j_ |j|j|j_|j|j_|j|j_|j|j_d|_|jr|jn|j|j_y|j|j_Wntk r9nX|jj tj!d|_"g|_#dS(Nt tinternii($R&R R Rt getEncodingR+Rtnamespace_prefixeststart_element_nstStartElementHandlertend_element_nstEndElementHandlert start_elementt end_elementR<tunparsed_entity_decltUnparsedEntityDeclHandlert notation_decltNotationDeclHandlertstart_namespace_decltStartNamespaceDeclHandlertend_namespace_decltEndNamespaceDeclHandlerRt_decl_handler_propR'RGtexternal_entity_reftExternalEntityRefHandlertskipped_entity_handlertSkippedEntityHandlertAttributeErrortSetParamEntityParsingt*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONER(R)(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR/s6          cCs|jdkrdS|jjS(N(RRR(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR>scCs|jdkrdS|jjS(Ni(RRR(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRCscCs |jjS(N(RR (R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR HscCs |jjS(N(RR!(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR!KscCs|jj|t|dS(N(R0t startElementtAttributesImpl(RR>tattrs((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRtOscCs|jj|dS(N(R0t endElement(RR>((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRuRsc CsL|j}t|dkr-d|f}n5t|dkrV|d|df}n t|}i}i}x|jD]\}}|j}t|} | dkr|} d|f} nQ| dkrd|d|df} |d|df} n|d} t|} ||| <| || RtpairtnewattrstqnamestanameRHtpartstlengthtqnametapair((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRpUs.         cCsy|j}t|dkr-d|f}n5t|dkrV|d|df}n t|}|jj|ddS(Niii(RRRRR0t endElementNS(RR>R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRrws  cCs|jj||dS(N(R0R](RttargetRR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytprocessing_instructionscCs|jj|dS(N(R0R_(RRR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytcharacter_datascCs|jj||dS(N(R0tstartPrefixMapping(Rtprefixturi((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRzscCs|jj|dS(N(R0tendPrefixMapping(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR|scCs|jj|||dS(N(R'tstartDTD(RR>tsysidtpubidthas_internal_subset((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRiscCs|jj||||dS(N(t _dtd_handlertunparsedEntityDecl(RR>R9RRt notation_name((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRvscCs|jj|||dS(N(Rt notationDecl(RR>R9RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRxscCs|js dS|jj||}tj||jjp=d}|jj|j |jf|j j ||_ ||_yt j j ||WndSX|jd\|_ |_|jd=dS(NiR[ii(R*t _ent_handlert resolveEntityR R.RR!R)tappendRtExternalEntityParserCreateR R$R2(RtcontextR9RRR4((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRs      cCs'|rd|}n|jj|dS(Nt%(R0t skippedEntity(RR>tis_pe((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRs ii("RRR"RR2R:R;R?RBRFRIRVR3RXR<RGR/RRR R!RtRuRpRrRRRzR|RiRvRxRR(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR#Ws@          '       "        cOs t||S(N(R#(targstkwargs((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt create_parserst__main__s:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml(.R"tversiontxml.sax._exceptionstxml.sax.handlerRRRRRRRRtsystplatformtSAXReaderNotAvailableRt xml.parsersR t ImportErrorREtxml.saxR R RRRt_weakrefRtweakreftproxyRtLocatorRR$R#RRtxml.sax.saxutilstxmltpR;tsaxt XMLGeneratortsetErrorHandlert ErrorHandlerR2(((s+/usr/lib64/python2.7/xml/sax/expatreader.pytsL         $a    PKB ]hj __init__.pycnu[ {fc@sjdZddlmZddlmZmZddlmZmZm Z m Z m Z edZ edZ dgZdZerdd lZndd lZdd lZejj rd ejkrejd jd Zn[d Zejd dkr/ejjer/ejjejd ZngdZejd dkrZdZn dZ[d S(sSimple API for XML (SAX) implementation for Python. This module provides an implementation of the SAX 2 interface; information about the Java version of the interface can be found at http://www.megginson.com/SAX/. The Python version of the interface is documented at <...>. This package contains the following modules: handler -- Base classes and constants which define the SAX 2 API for the 'client-side' of SAX for Python. saxutils -- Implementation of the convenience classes commonly used to work with SAX. xmlreader -- Base classes and constants which define the SAX 2 API for the parsers used with SAX for Python. expatreader -- Driver that allows use of the Expat parser with SAX. i(t InputSource(tContentHandlert ErrorHandler(t SAXExceptiontSAXNotRecognizedExceptiontSAXParseExceptiontSAXNotSupportedExceptiontSAXReaderNotAvailablecCs4t}|j||j||j|dS(N(t make_parsertsetContentHandlertsetErrorHandlertparse(tsourcethandlert errorHandlertparser((s(/usr/lib64/python2.7/xml/sax/__init__.pyR s   cCsyddlm}Wn!tk r7ddlm}nX|dkrPt}nt}|j||j|t}|j |||j |dS(Ni(tStringIO( t cStringIORt ImportErrortNoneRRR R Rt setByteStreamR (tstringR RRRtinpsrc((s(/usr/lib64/python2.7/xml/sax/__init__.pyt parseString#s       sxml.sax.expatreaderiNt PY_SAX_PARSERt,spython.xml.sax.parseritjavacCs}xg|tD][}yt|SWq tk rU}ddl}||jkrfqfq tk req Xq WtdddS(s&Creates and returns a SAX parser. Creates the first parser it is able to instantiate of the ones given in the list created by doing parser_list + default_parser_list. The lists must contain the names of Python modules containing both a SAX parser and a create_parser function.iNsNo parsers found(tdefault_parser_listt_create_parserRtsystmodulesRR(t parser_listt parser_nameteR((s(/usr/lib64/python2.7/xml/sax/__init__.pyRGs   cCs2ddlm}|j|dt}|jS(Ni(timpi(torg.python.coreR"t importNametglobalst create_parser(R R"t drv_module((s(/usr/lib64/python2.7/xml/sax/__init__.pyRbscCs"t|iidg}|jS(NR&(t __import__R&(R R'((s(/usr/lib64/python2.7/xml/sax/__init__.pyRhs(t__doc__t xmlreaderRR RRt _exceptionsRRRRRR RRt_falsetxml.sax.expatreadertxmltosRtflagstignore_environmenttenvirontsplitt_keytplatformtregistryt containsKeyt getPropertyRR(((s(/usr/lib64/python2.7/xml/sax/__init__.pyts*( %   PKB ]'ZE;E;expatreader.pyonu[ {fc@s3dZdZddlTddlmZmZddlmZddlmZmZddlm Z ddlm Z m Z dd l Z e j d d kred en[ ydd lmZWn ek reden#Xeed redenddlmZmZmZejZejZydd lZWnek r_dZnXdd lZejZ[[dfdYZdejfdYZ dej!ejfdYZ"dZ#e$dkr/dd l%Z&e#Z'e'j(e&j)jj*e'j+e&j)j,e'j-dnd S(s] SAX driver for the pyexpat C module. This driver works with pyexpat.__version__ == '2.22'. s0.20i(t*(tfeature_validationtfeature_namespaces(tfeature_namespace_prefixes(tfeature_external_gestfeature_external_pes(tfeature_string_interning(tproperty_xml_stringtproperty_interning_dictNitjavasexpat not available in Java(texpatsexpat not supportedt ParserCreate(t xmlreadertsaxutilsthandlercCs|S(N((to((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt_mkproxy'st _ClosedParsercBseZRS((t__name__t __module__(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR.st ExpatLocatorcBs;eZdZdZdZdZdZdZRS(sLocator for use with the ExpatParser class. This uses a weak reference to the parser object to avoid creating a circular reference between the parser and the content handler. cCst||_dS(N(Rt_ref(tselftparser((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt__init__9scCs&|j}|jdkrdS|jjS(N(Rt_parsertNonetErrorColumnNumber(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytgetColumnNumber<s cCs&|j}|jdkrdS|jjS(Ni(RRRtErrorLineNumber(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt getLineNumberBs cCs&|j}|dkrdS|jjS(N(RRt_sourcet getPublicId(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR Hs  cCs&|j}|dkrdS|jjS(N(RRRt getSystemId(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR!Ns  (RRt__doc__RRRR R!(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR3s     t ExpatParsercBs.eZdZdd%dZdZdZdZd Zd Zd Z d Z dd Z dZ dZ dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zd!Zd"Z d#Z!RS(&s$SAX driver for the pyexpat C module.iiiicCsetjj||tj|_d|_||_d|_d|_ g|_ d|_ d|_ dS(Nii( R tIncrementalParserRt InputSourceRRRt _namespacest_lex_handler_propt_parsingt _entity_stackt _external_gest _interning(RtnamespaceHandlingtbufsize((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRZs      cCsjtj|}||_y7|j|jjt|tjj ||Wn|j nXdS(s3Parse an XML document from a URL or an InputSource.N( R tprepare_input_sourceRtresett _cont_handlertsetDocumentLocatorRR R$tparset _close_source(Rtsource((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR2gs   cCsV|jdk rR|j}t|tr?|jd}n|jj|ndS(Nsutf-8(R!Rt isinstancetunicodetencodeRtSetBase(RR4tbase((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt prepareParserws  cCs-tjj|||jr)|jndS(N(R R$tsetContentHandlerR(t_reset_cont_handler(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR;s cCsl|tkr|jS|tkr,|jdk S|tttfkrEdS|tkrX|j St d|dS(NisFeature '%s' not recognized( RR&RR+RRRRRR*tSAXNotRecognizedException(Rtname((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt getFeatures      cCs|jrtdn|tkr0||_n|tkrH||_n|tkr|rx|jdkri|_qqd|_n||t kr|rtdqnX|t kr|rtdqn4|t kr|rtdqnt d|dS(Ns!Cannot set features while parsings!expat does not support validations/expat does not read external parameter entitiess(expat does not report namespace prefixessFeature '%s' not recognized( R(tSAXNotSupportedExceptionRR&RR*RR+RRRRR=(RR>tstate((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt setFeatures2          cCs|tjkr|jS|tkr)|jS|tkr{|jrlt|jdr]|jjSt dq{t dnt d|dS(NtGetInputContexts=This version of expat does not support getting the XML strings.XML string cannot be returned when not parsingsProperty '%s' not recognized( Rtproperty_lexical_handlerR'RR+RRthasattrRCR=R@(RR>((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt getPropertys      cCs||tjkr1||_|jrx|jqxnG|tkrI||_n/|tkrhtd|nt d|dS(NsProperty '%s' cannot be setsProperty '%s' not recognized( RRDR'R(t_reset_lex_handler_propRR+RR@R=(RR>tvalue((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt setPropertys      cCs|js,|jd|_|jjny|jj||WnDtjk r}ttj |j ||}|j j |nXdS(Ni( R(R/R0t startDocumentRtParseR terrortSAXParseExceptiont ErrorStringtcodet _err_handlert fatalError(RtdatatisFinaltetexc((s+/usr/lib64/python2.7/xml/sax/expatreader.pytfeeds   cCs_|j}z)|j}|dk r1|jnWd|j}|dk rZ|jnXdS(N(RtgetCharacterStreamRtcloset getByteStream(RR4tfile((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR3s     cCs|js*|jdks*t|jtr.dSz6|jddd|jjd|_d|_Wdd|_|jdk rt}|jj |_ |jj |_ ||_n|j XdS(NtRSii( R)RRR5RRVR0t endDocumentR(RRR3(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRXs      cCs(|jj|j_|jj|j_dS(N(R0tprocessingInstructionRtProcessingInstructionHandlert characterstCharacterDataHandler(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR<scCs|j}|j}|dkrNd|_d|_d|_d|_d|_n<|j|_|j |_|j |_|j |_|j |_dS(N( R'RRtCommentHandlertStartCdataSectionHandlertEndCdataSectionHandlertStartDoctypeDeclHandlertEndDoctypeDeclHandlertcommentt startCDATAtendCDATAtstart_doctype_decltendDTD(RtlexR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRGs            cCsc|jr]tj|jjdd|j|_d|j_|j|j_ |j |j_ nBtj|jjd|j|_|j |j_ |j |j_ |j|j|j_|j|j_|j|j_|j|j_d|_|jr|jn|j|j_y|j|j_Wntk r9nX|jj tj!d|_"g|_#dS(Nt tinternii($R&R R Rt getEncodingR+Rtnamespace_prefixeststart_element_nstStartElementHandlertend_element_nstEndElementHandlert start_elementt end_elementR<tunparsed_entity_decltUnparsedEntityDeclHandlert notation_decltNotationDeclHandlertstart_namespace_decltStartNamespaceDeclHandlertend_namespace_decltEndNamespaceDeclHandlerRt_decl_handler_propR'RGtexternal_entity_reftExternalEntityRefHandlertskipped_entity_handlertSkippedEntityHandlertAttributeErrortSetParamEntityParsingt*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONER(R)(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR/s6          cCs|jdkrdS|jjS(N(RRR(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR>scCs|jdkrdS|jjS(Ni(RRR(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRCscCs |jjS(N(RR (R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR HscCs |jjS(N(RR!(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR!KscCs|jj|t|dS(N(R0t startElementtAttributesImpl(RR>tattrs((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRtOscCs|jj|dS(N(R0t endElement(RR>((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRuRsc CsL|j}t|dkr-d|f}n5t|dkrV|d|df}n t|}i}i}x|jD]\}}|j}t|} | dkr|} d|f} nQ| dkrd|d|df} |d|df} n|d} t|} ||| <| || RtpairtnewattrstqnamestanameRHtpartstlengthtqnametapair((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRpUs.         cCsy|j}t|dkr-d|f}n5t|dkrV|d|df}n t|}|jj|ddS(Niii(RRRRR0t endElementNS(RR>R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRrws  cCs|jj||dS(N(R0R](RttargetRR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytprocessing_instructionscCs|jj|dS(N(R0R_(RRR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytcharacter_datascCs|jj||dS(N(R0tstartPrefixMapping(Rtprefixturi((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRzscCs|jj|dS(N(R0tendPrefixMapping(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR|scCs|jj|||dS(N(R'tstartDTD(RR>tsysidtpubidthas_internal_subset((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRiscCs|jj||||dS(N(t _dtd_handlertunparsedEntityDecl(RR>R9RRt notation_name((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRvscCs|jj|||dS(N(Rt notationDecl(RR>R9RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRxscCs|js dS|jj||}tj||jjp=d}|jj|j |jf|j j ||_ ||_yt j j ||WndSX|jd\|_ |_|jd=dS(NiR[ii(R*t _ent_handlert resolveEntityR R.RR!R)tappendRtExternalEntityParserCreateR R$R2(RtcontextR9RRR4((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRs      cCs'|rd|}n|jj|dS(Nt%(R0t skippedEntity(RR>tis_pe((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRs ii("RRR"RR2R:R;R?RBRFRIRVR3RXR<RGR/RRR R!RtRuRpRrRRRzR|RiRvRxRR(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR#Ws@          '       "        cOs t||S(N(R#(targstkwargs((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt create_parserst__main__s:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml(.R"tversiontxml.sax._exceptionstxml.sax.handlerRRRRRRRRtsystplatformtSAXReaderNotAvailableRt xml.parsersR t ImportErrorREtxml.saxR R RRRt_weakrefRtweakreftproxyRtLocatorRR$R#RRtxml.sax.saxutilstxmltpR;tsaxt XMLGeneratortsetErrorHandlert ErrorHandlerR2(((s+/usr/lib64/python2.7/xml/sax/expatreader.pytsL         $a    PKB ]/_exceptions.pycnu[ {fc@sdZddlZejd dkr8ddlmZn[defdYZdefd YZd efd YZd efd YZdefdYZ dS(s!Different kinds of SAX ExceptionsiNitjava(t Exceptiont SAXExceptioncBs>eZdZddZdZdZdZdZRS(sEncapsulate an XML error or warning. This class can contain basic error or warning information from either the XML parser or the application: you can subclass it to provide additional functionality, or to add localization. Note that although you will receive a SAXException as the argument to the handlers in the ErrorHandler interface, you are not actually required to raise the exception; instead, you can simply read the information in it.cCs&||_||_tj||dS(sUCreates an exception. The message is required, but the exception is optional.N(t_msgt _exceptionRt__init__(tselftmsgt exception((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRs  cCs|jS(s$Return a message for this exception.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyt getMessagescCs|jS(s9Return the embedded exception, or None if there was none.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyt getExceptionscCs|jS(s0Create a string representation of the exception.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyt__str__"scCstddS(svAvoids weird error messages if someone does exception[ix] by mistake, since Exception has __getitem__ defined.t __getitem__N(tAttributeError(Rtix((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR &sN( t__name__t __module__t__doc__tNoneRR R R R (((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR s     tSAXParseExceptioncBsDeZdZdZdZdZdZdZdZRS(s#Encapsulate an XML parse error or warning. This exception will include information for locating the error in the original XML document. Note that although the application will receive a SAXParseException as the argument to the handlers in the ErrorHandler interface, the application is not actually required to raise the exception; instead, it can simply read the information in it and take a different action. Since this exception is a subclass of SAXException, it inherits the ability to wrap another exception.cCsVtj|||||_|jj|_|jj|_|jj|_dS(sECreates the exception. The exception parameter is allowed to be None.N( RRt_locatort getSystemIdt _systemIdtgetColumnNumbert_colnumt getLineNumbert_linenum(RRRtlocator((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR;s  cCs|jS(sNThe column number of the end of the text where the exception occurred.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRHscCs|jS(sDThe line number of the end of the text where the exception occurred.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRMscCs |jjS(sEGet the public identifier of the entity where the exception occurred.(Rt getPublicId(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRQscCs|jS(sEGet the system identifier of the entity where the exception occurred.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRUscCsz|j}|dkr!d}n|j}|dkrBd}n|j}|dkrcd}nd||||jfS(s0Create a string representation of the exception.s t?s %s:%s:%s: %sN(RRRRR(Rtsysidtlinenumtcolnum((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR Ys         ( RRRRRRRRR (((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR.s     tSAXNotRecognizedExceptioncBseZdZRS(sException class for an unrecognized identifier. An XMLReader will raise this exception when it is confronted with an unrecognized feature or property. SAX applications and extensions may use this class for similar purposes.(RRR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR!istSAXNotSupportedExceptioncBseZdZRS(sException class for an unsupported operation. An XMLReader will raise this exception when a service it cannot perform is requested (specifically setting a state or value). SAX applications and extensions may use this class for similar purposes.(RRR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR"sstSAXReaderNotAvailablecBseZdZRS(sException class for a missing driver. An XMLReader module (driver) should raise this exception when it is first imported, e.g. when a support module cannot be imported. It also may be raised during parsing, e.g. if executing an external program is not permitted.(RRR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR#}s( Rtsystplatformt java.langRRRR!R"R#(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyts %;  PKB ]hj __init__.pyonu[ {fc@sjdZddlmZddlmZmZddlmZmZm Z m Z m Z edZ edZ dgZdZerdd lZndd lZdd lZejj rd ejkrejd jd Zn[d Zejd dkr/ejjer/ejjejd ZngdZejd dkrZdZn dZ[d S(sSimple API for XML (SAX) implementation for Python. This module provides an implementation of the SAX 2 interface; information about the Java version of the interface can be found at http://www.megginson.com/SAX/. The Python version of the interface is documented at <...>. This package contains the following modules: handler -- Base classes and constants which define the SAX 2 API for the 'client-side' of SAX for Python. saxutils -- Implementation of the convenience classes commonly used to work with SAX. xmlreader -- Base classes and constants which define the SAX 2 API for the parsers used with SAX for Python. expatreader -- Driver that allows use of the Expat parser with SAX. i(t InputSource(tContentHandlert ErrorHandler(t SAXExceptiontSAXNotRecognizedExceptiontSAXParseExceptiontSAXNotSupportedExceptiontSAXReaderNotAvailablecCs4t}|j||j||j|dS(N(t make_parsertsetContentHandlertsetErrorHandlertparse(tsourcethandlert errorHandlertparser((s(/usr/lib64/python2.7/xml/sax/__init__.pyR s   cCsyddlm}Wn!tk r7ddlm}nX|dkrPt}nt}|j||j|t}|j |||j |dS(Ni(tStringIO( t cStringIORt ImportErrortNoneRRR R Rt setByteStreamR (tstringR RRRtinpsrc((s(/usr/lib64/python2.7/xml/sax/__init__.pyt parseString#s       sxml.sax.expatreaderiNt PY_SAX_PARSERt,spython.xml.sax.parseritjavacCs}xg|tD][}yt|SWq tk rU}ddl}||jkrfqfq tk req Xq WtdddS(s&Creates and returns a SAX parser. Creates the first parser it is able to instantiate of the ones given in the list created by doing parser_list + default_parser_list. The lists must contain the names of Python modules containing both a SAX parser and a create_parser function.iNsNo parsers found(tdefault_parser_listt_create_parserRtsystmodulesRR(t parser_listt parser_nameteR((s(/usr/lib64/python2.7/xml/sax/__init__.pyRGs   cCs2ddlm}|j|dt}|jS(Ni(timpi(torg.python.coreR"t importNametglobalst create_parser(R R"t drv_module((s(/usr/lib64/python2.7/xml/sax/__init__.pyRbscCs"t|iidg}|jS(NR&(t __import__R&(R R'((s(/usr/lib64/python2.7/xml/sax/__init__.pyRhs(t__doc__t xmlreaderRR RRt _exceptionsRRRRRR RRt_falsetxml.sax.expatreadertxmltosRtflagstignore_environmenttenvirontsplitt_keytplatformtregistryt containsKeyt getPropertyRR(((s(/usr/lib64/python2.7/xml/sax/__init__.pyts*( %   PKB ]/_exceptions.pyonu[ {fc@sdZddlZejd dkr8ddlmZn[defdYZdefd YZd efd YZd efd YZdefdYZ dS(s!Different kinds of SAX ExceptionsiNitjava(t Exceptiont SAXExceptioncBs>eZdZddZdZdZdZdZRS(sEncapsulate an XML error or warning. This class can contain basic error or warning information from either the XML parser or the application: you can subclass it to provide additional functionality, or to add localization. Note that although you will receive a SAXException as the argument to the handlers in the ErrorHandler interface, you are not actually required to raise the exception; instead, you can simply read the information in it.cCs&||_||_tj||dS(sUCreates an exception. The message is required, but the exception is optional.N(t_msgt _exceptionRt__init__(tselftmsgt exception((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRs  cCs|jS(s$Return a message for this exception.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyt getMessagescCs|jS(s9Return the embedded exception, or None if there was none.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyt getExceptionscCs|jS(s0Create a string representation of the exception.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyt__str__"scCstddS(svAvoids weird error messages if someone does exception[ix] by mistake, since Exception has __getitem__ defined.t __getitem__N(tAttributeError(Rtix((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR &sN( t__name__t __module__t__doc__tNoneRR R R R (((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR s     tSAXParseExceptioncBsDeZdZdZdZdZdZdZdZRS(s#Encapsulate an XML parse error or warning. This exception will include information for locating the error in the original XML document. Note that although the application will receive a SAXParseException as the argument to the handlers in the ErrorHandler interface, the application is not actually required to raise the exception; instead, it can simply read the information in it and take a different action. Since this exception is a subclass of SAXException, it inherits the ability to wrap another exception.cCsVtj|||||_|jj|_|jj|_|jj|_dS(sECreates the exception. The exception parameter is allowed to be None.N( RRt_locatort getSystemIdt _systemIdtgetColumnNumbert_colnumt getLineNumbert_linenum(RRRtlocator((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR;s  cCs|jS(sNThe column number of the end of the text where the exception occurred.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRHscCs|jS(sDThe line number of the end of the text where the exception occurred.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRMscCs |jjS(sEGet the public identifier of the entity where the exception occurred.(Rt getPublicId(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRQscCs|jS(sEGet the system identifier of the entity where the exception occurred.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRUscCsz|j}|dkr!d}n|j}|dkrBd}n|j}|dkrcd}nd||||jfS(s0Create a string representation of the exception.s t?s %s:%s:%s: %sN(RRRRR(Rtsysidtlinenumtcolnum((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR Ys         ( RRRRRRRRR (((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR.s     tSAXNotRecognizedExceptioncBseZdZRS(sException class for an unrecognized identifier. An XMLReader will raise this exception when it is confronted with an unrecognized feature or property. SAX applications and extensions may use this class for similar purposes.(RRR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR!istSAXNotSupportedExceptioncBseZdZRS(sException class for an unsupported operation. An XMLReader will raise this exception when a service it cannot perform is requested (specifically setting a state or value). SAX applications and extensions may use this class for similar purposes.(RRR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR"sstSAXReaderNotAvailablecBseZdZRS(sException class for a missing driver. An XMLReader module (driver) should raise this exception when it is first imported, e.g. when a support module cannot be imported. It also may be raised during parsing, e.g. if executing an external program is not permitted.(RRR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR#}s( Rtsystplatformt java.langRRRR!R"R#(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyts %;  PKB ]ȳKK xmlreader.pyonu[ {fc@sdZddlZddlmZmZdddYZdefdYZddd YZd dd YZd dd YZ de fdYZ dZ e dkre ndS(s]An XML Reader is the SAX 2 name for an XML parser. XML Parsers should be based on this code. iN(tSAXNotSupportedExceptiontSAXNotRecognizedExceptiont XMLReadercBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZRS(s%Interface for reading an XML document using callbacks. XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse. All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.cCs@tj|_tj|_tj|_tj|_dS(N( thandlertContentHandlert _cont_handlert DTDHandlert _dtd_handlertEntityResolvert _ent_handlert ErrorHandlert _err_handler(tself((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt__init__scCstddS(sAParse an XML document from a system identifier or an InputSource.s This method must be implemented!N(tNotImplementedError(R tsource((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytparsescCs|jS(s#Returns the current ContentHandler.(R(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetContentHandler"scCs ||_dS(s:Registers a new object to receive document content events.N(R(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetContentHandler&scCs|jS(s Returns the current DTD handler.(R(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getDTDHandler*scCs ||_dS(s7Register an object to receive basic DTD-related events.N(R(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setDTDHandler.scCs|jS(s#Returns the current EntityResolver.(R (R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetEntityResolver2scCs ||_dS(s0Register an object to resolve external entities.N(R (R tresolver((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetEntityResolver6scCs|jS(s!Returns the current ErrorHandler.(R (R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetErrorHandler:scCs ||_dS(s3Register an object to receive error-message events.N(R (R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetErrorHandler>scCstddS(sHAllow an application to set the locale for errors and warnings. SAX parsers are not required to provide localization for errors and warnings; if they cannot support the requested locale, however, they must raise a SAX exception. Applications may request a locale change in the middle of a parse.sLocale support not implementedN(R(R tlocale((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setLocaleBscCstd|dS(s1Looks up and returns the state of a SAX2 feature.sFeature '%s' not recognizedN(R(R tname((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getFeatureKscCstd|dS(s!Sets the state of a SAX2 feature.sFeature '%s' not recognizedN(R(R Rtstate((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setFeatureOscCstd|dS(s2Looks up and returns the value of a SAX2 property.sProperty '%s' not recognizedN(R(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getPropertySscCstd|dS(s"Sets the value of a SAX2 property.sProperty '%s' not recognizedN(R(R Rtvalue((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setPropertyWs(t__name__t __module__t__doc__R RRRRRRRRRRRRR R"(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR s               tIncrementalParsercBsGeZdZd dZdZdZdZdZdZRS( ssThis interface adds three extra methods to the XMLReader interface that allow XML parsers to support incremental parsing. Support for this interface is optional, since not all underlying XML parsers support this functionality. When the parser is instantiated it is ready to begin accepting data from the feed method immediately. After parsing has been finished with a call to close the reset method must be called to make the parser ready to accept new data, either from feed or using the parse method. Note that these methods must _not_ be called during parsing, that is, after parse has been called and before it returns. By default, the class also implements the parse method of the XMLReader interface using the feed, close and reset methods of the IncrementalParser interface as a convenience to SAX 2.0 driver writers.iicCs||_tj|dS(N(t_bufsizeRR (R tbufsize((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR os cCsddl}|j|}|j||j}|j|j}x/|dkrw|j||j|j}qIW|jdS(Nit(tsaxutilstprepare_input_sourcet prepareParsert getByteStreamtreadR'tfeedtclose(R RR*tfiletbuffer((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRss    cCstddS(sThis method gives the raw XML data in the data parameter to the parser and makes it parse the data, emitting the corresponding events. It is allowed for XML constructs to be split across several calls to feed. feed may raise SAXException.s This method must be implemented!N(R(R tdata((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR/scCstddS(stThis method is called by the parse implementation to allow the SAX 2.0 driver to prepare itself for parsing.s!prepareParser must be overridden!N(R(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR,scCstddS(sThis method is called when the entire XML document has been passed to the parser through the feed method, to notify the parser that there are no more data. This allows the parser to do the final checks on the document and empty the internal data buffer. The parser will not be ready to parse another document until the reset method has been called. close may raise SAXException.s This method must be implemented!N(R(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR0s cCstddS(sThis method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.s This method must be implemented!N(R(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytresetsi( R#R$R%R RR/R,R0R4(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR&[s   tLocatorcBs2eZdZdZdZdZdZRS(sInterface for associating a SAX event with a document location. A locator object will return valid results only during calls to DocumentHandler methods; at any other time, the results are unpredictable.cCsdS(s6Return the column number where the current event ends.i((R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetColumnNumberscCsdS(s4Return the line number where the current event ends.i((R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getLineNumberscCsdS(s3Return the public identifier for the current event.N(tNone(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getPublicIdscCsdS(s3Return the system identifier for the current event.N(R8(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getSystemIds(R#R$R%R6R7R9R:(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR5s    t InputSourcecBsteZdZd dZdZdZdZdZdZ dZ dZ d Z d Z d ZRS( snEncapsulation of the information needed by the XMLReader to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will create objects of this class for use in the XMLReader.parse method and for returning from EntityResolver.resolveEntity. An InputSource belongs to the application, the XMLReader is not allowed to modify InputSource objects passed to it from the application, although it may make copies and modify those.cCs1||_d|_d|_d|_d|_dS(N(t_InputSource__system_idR8t_InputSource__public_idt_InputSource__encodingt_InputSource__bytefilet_InputSource__charfile(R t system_id((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR s     cCs ||_dS(s/Sets the public identifier of this InputSource.N(R=(R t public_id((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setPublicIdscCs|jS(s2Returns the public identifier of this InputSource.(R=(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR9scCs ||_dS(s/Sets the system identifier of this InputSource.N(R<(R RA((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setSystemIdscCs|jS(s2Returns the system identifier of this InputSource.(R<(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR:scCs ||_dS(s4Sets the character encoding of this InputSource. The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML recommendation). The encoding attribute of the InputSource is ignored if the InputSource also contains a character stream.N(R>(R tencoding((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setEncodingscCs|jS(s/Get the character encoding of this InputSource.(R>(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getEncodingscCs ||_dS(sSet the byte stream (a Python file-like object which does not perform byte-to-character conversion) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself. If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.N(R?(R tbytefile((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setByteStreams cCs|jS(sGet the byte stream for this input source. The getEncoding method will return the character encoding for this byte stream, or None if unknown.(R?(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR-scCs ||_dS(s^Set the character stream for this input source. (The stream must be a Python 2.0 Unicode-wrapped file-like that performs conversion to Unicode strings.) If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.N(R@(R tcharfile((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetCharacterStreamscCs|jS(s/Get the character stream for this input source.(R@(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetCharacterStreamsN(R#R$R%R8R RCR9RDR:RFRGRIR-RKRL(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR;s        tAttributesImplcBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZddZdZdZdZRS(cCs ||_dS(sQNon-NS-aware implementation. attrs should be of the form {name : value}.N(t_attrs(R tattrs((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR scCs t|jS(N(tlenRN(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getLengthscCsdS(NtCDATA((R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetTypescCs |j|S(N(RN(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetValue"scCs |j|S(N(RN(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetValueByQName%scCs||jkrt|n|S(N(RNtKeyError(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetNameByQName(s cCs||jkrt|n|S(N(RNRV(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetQNameByName-s cCs |jjS(N(RNtkeys(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetNames2scCs |jjS(N(RNRY(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getQNames5scCs t|jS(N(RPRN(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt__len__8scCs |j|S(N(RN(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt __getitem__;scCs |jjS(N(RNRY(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRY>scCs ||jkS(N(RN(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pythas_keyAscCs ||jkS(N(RN(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt __contains__DscCs|jj||S(N(RNtget(R Rt alternative((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR`GscCs|j|jS(N(t __class__RN(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytcopyJscCs |jjS(N(RNtitems(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRdMscCs |jjS(N(RNtvalues(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRePsN(R#R$R RQRSRTRURWRXRZR[R\R]RYR^R_R8R`RcRdRe(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRMs$                 tAttributesNSImplcBs>eZdZdZdZdZdZdZRS(cCs||_||_dS(sNS-aware implementation. attrs should be of the form {(ns_uri, lname): value, ...}. qnames of the form {(ns_uri, lname): qname, ...}.N(RNt_qnames(R ROtqnames((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR Ws cCsDx4|jjD]#\}}||kr|j|SqWt|dS(N(RgRdRNRV(R Rtnsnametqname((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRU_s cCs=x-|jjD]\}}||kr|SqWt|dS(N(RgRdRV(R RRiRj((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRWfs cCs |j|S(N(Rg(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRXmscCs |jjS(N(RgRe(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR[pscCs|j|j|jS(N(RbRNRg(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRcss(R#R$R RURWRXR[Rc(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRfUs      cCstttdS(N(RR&R5(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt_testwst__main__((((( R%Rt _exceptionsRRRR&R5R;RMRfRkR#(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyts PHYA"  PKB ]deq22 handler.pycnu[ {fc@sdZdZdddYZdddYZdddYZddd YZd Zd Zd Zd Z dZ dZ eeee e e gZ dZ dZdZdZdZdZe eeeeegZdS(s0 This module contains the core classes of version 2.0 of SAX for Python. This file provides only default classes with absolutely minimum functionality, from which drivers and applications can be subclassed. Many of these classes are empty and are included only as documentation of the interfaces. $Id$ s2.0betat ErrorHandlercBs)eZdZdZdZdZRS(sBasic interface for SAX error handlers. If you create an object that implements this interface, then register the object with your XMLReader, the parser will call the methods in your object to report all warnings and errors. There are three levels of errors available: warnings, (possibly) recoverable errors, and unrecoverable errors. All methods take a SAXParseException as the only parameter.cCs |dS(sHandle a recoverable error.N((tselft exception((s'/usr/lib64/python2.7/xml/sax/handler.pyterror scCs |dS(sHandle a non-recoverable error.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pyt fatalError$scCs |GHdS(sHandle a warning.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pytwarning(s(t__name__t __module__t__doc__RRR(((s'/usr/lib64/python2.7/xml/sax/handler.pyRs  tContentHandlercBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZRS(sInterface for receiving logical document content events. This is the main callback interface in SAX, and the one most important to applications. The order of events in this interface mirrors the order of the information in the document.cCs d|_dS(N(tNonet_locator(R((s'/usr/lib64/python2.7/xml/sax/handler.pyt__init__6scCs ||_dS(s#Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface. The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine. Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.N(R (Rtlocator((s'/usr/lib64/python2.7/xml/sax/handler.pytsetDocumentLocator9scCsdS(sReceive notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).N((R((s'/usr/lib64/python2.7/xml/sax/handler.pyt startDocumentPtcCsdS(sQReceive notification of the end of a document. The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.N((R((s'/usr/lib64/python2.7/xml/sax/handler.pyt endDocumentWRcCsdS(sBegin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default). There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary. Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.N((Rtprefixturi((s'/usr/lib64/python2.7/xml/sax/handler.pytstartPrefixMapping`RcCsdS(sEnd the scope of a prefix-URI mapping. See startPrefixMapping for details. This event will always occur after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pytendPrefixMappingwRcCsdS(sSignals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an instance of the Attributes class containing the attributes of the element.N((Rtnametattrs((s'/usr/lib64/python2.7/xml/sax/handler.pyt startElement~RcCsdS(sSignals the end of an element in non-namespace mode. The name parameter contains the name of the element type, just as with the startElement event.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pyt endElementRcCsdS(sSignals the start of an element in namespace mode. The name parameter contains the name of the element type as a (uri, localname) tuple, the qname parameter the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the Attributes class containing the attributes of the element. The uri part of the name tuple is None for elements which have no namespace.N((RRtqnameR((s'/usr/lib64/python2.7/xml/sax/handler.pytstartElementNSRcCsdS(sSignals the end of an element in namespace mode. The name parameter contains the name of the element type, just as with the startElementNS event.N((RRR((s'/usr/lib64/python2.7/xml/sax/handler.pyt endElementNSRcCsdS(sReceive notification of character data. The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.N((Rtcontent((s'/usr/lib64/python2.7/xml/sax/handler.pyt charactersRcCsdS(swReceive notification of ignorable whitespace in element content. Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.N((Rt whitespace((s'/usr/lib64/python2.7/xml/sax/handler.pytignorableWhitespaceRcCsdS(sReceive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.N((Rttargettdata((s'/usr/lib64/python2.7/xml/sax/handler.pytprocessingInstructionRcCsdS(sReceive notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pyt skippedEntityR(RRRR RRRRRRRRRRR R#R$(((s'/usr/lib64/python2.7/xml/sax/handler.pyR /s          t DTDHandlercBs eZdZdZdZRS(sHandle DTD events. This interface specifies only those DTD events required for basic parsing (unparsed entities and attributes).cCsdS(s$Handle a notation declaration event.N((RRtpublicIdtsystemId((s'/usr/lib64/python2.7/xml/sax/handler.pyt notationDeclRcCsdS(s,Handle an unparsed entity declaration event.N((RRR&R'tndata((s'/usr/lib64/python2.7/xml/sax/handler.pytunparsedEntityDeclR(RRRR(R*(((s'/usr/lib64/python2.7/xml/sax/handler.pyR%s tEntityResolvercBseZdZdZRS(s7Basic interface for resolving entities. If you create an object implementing this interface, then register the object with your Parser, the parser will call the method in your object to resolve all external entities. Note that DefaultHandler implements this interface with the default behaviour.cCs|S(sResolve the system identifier of an entity and return either the system identifier to read from as a string, or an InputSource to read from.((RR&R'((s'/usr/lib64/python2.7/xml/sax/handler.pyt resolveEntitys(RRRR,(((s'/usr/lib64/python2.7/xml/sax/handler.pyR+ss&http://xml.org/sax/features/namespacess.http://xml.org/sax/features/namespace-prefixess,http://xml.org/sax/features/string-internings&http://xml.org/sax/features/validations5http://xml.org/sax/features/external-general-entitiess7http://xml.org/sax/features/external-parameter-entitiess-http://xml.org/sax/properties/lexical-handlers1http://xml.org/sax/properties/declaration-handlers&http://xml.org/sax/properties/dom-nodes(http://xml.org/sax/properties/xml-strings-http://www.python.org/sax/properties/encodings3http://www.python.org/sax/properties/interning-dictN(((((RtversionRR R%R+tfeature_namespacestfeature_namespace_prefixestfeature_string_interningtfeature_validationtfeature_external_gestfeature_external_pest all_featurestproperty_lexical_handlertproperty_declaration_handlertproperty_dom_nodetproperty_xml_stringtproperty_encodingtproperty_interning_dicttall_properties(((s'/usr/lib64/python2.7/xml/sax/handler.pyt s:   PKB ]99 saxutils.pycnu[ {fc@s-dZddlZddlZddlZddlZddlZddlZddlZddlZyej ej gZ Wne k rej gZ nXdZ idZidZidZdZdejfd YZd ejfd YZd ejfd YZddZdS(snA library of useful helper classes to the SAX classes, for the convenience of application and driver writers. iNcCs3x,|jD]\}}|j||}q W|S(s2Replace substrings of a string using a dictionary.(titemstreplace(tstdtkeytvalue((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt__dict_replacescCsR|jdd}|jdd}|jdd}|rNt||}n|S(sEscape &, <, and > in a string of data. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. t&s&t>s>t in a string of data, then quote it for use as an attribute value. The " character will be escaped as well, if necessary. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. s s s s s s t"t's"%s"s"s'%s'(tcopytupdateR R(R R ((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt quoteattr5s "    cCs|dkr$ddl}|j}nt|tjrTtj|}d|_nTtj}d|_|j |_ y|j |_ |j |_ Wnt k rnXt |d|ddddS( NicSsdS(N(tNone(((s(/usr/lib64/python2.7/xml/sax/saxutils.pytVtcSstS(N(tTrue(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR[Rtencodingterrorstxmlcharrefreplacetnewlines (Rtsyststdoutt isinstancetiot RawIOBasetBufferedIOBasetclosetwritabletwritetseekablettelltAttributeErrort_UnbufferedTextIOWrapper(toutRRtbuffer((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt_gettextwriterMs"        R'cBseZdZRS(cCs$tt|j||jdS(N(tsuperR'R#tflush(tselfR((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR#ks(t__name__t __module__R#(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR'jst XMLGeneratorcBseZdddZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZRS(s iso-8859-1cCsitjj|t||}|j|_|j|_ig|_|jd|_ g|_ ||_ dS(Ni( thandlertContentHandlert__init__R*R#t_writeR,t_flusht _ns_contextst_current_contextt_undeclared_ns_mapst _encoding(R-R(R((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR3rs    cCsX|drPd|dkr&d|dS|j|d}|rP|d|dSn|dS(s7Builds a qualified name from a (ns_url, localname) pairis$http://www.w3.org/XML/1998/namespacesxml:it:(R7(R-tnametprefix((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt_qname|s  cCs|jd|jdS(Nu$ (R4R9(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt startDocuments cCs|jdS(N(R5(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt endDocumentscCs@|jj|jj||j|<|jj||fdS(N(R6tappendR7RR8(R-R<turi((s(/usr/lib64/python2.7/xml/sax/saxutils.pytstartPrefixMappings cCs|jd|_|jd=dS(Ni(R6R7(R-R<((s(/usr/lib64/python2.7/xml/sax/saxutils.pytendPrefixMappingscCs\|jd|x7|jD])\}}|jd|t|fqW|jddS(Nu(R4RR(R-R;tattrsR((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt startElements!cCs|jd|dS(Nu(R4(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt endElementscCs|jd|j|xH|jD]=\}}|rP|jd||fq$|jd|q$Wg|_x@|jD]2\}}|jd|j|t|fq{W|jddS(Nu(R4R=R8RR(R-R;tqnameRDR<RAR((s(/usr/lib64/python2.7/xml/sax/saxutils.pytstartElementNSs *cCs|jd|j|dS(Nu(R4R=(R-R;RG((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt endElementNSscCs;t|ts$t||j}n|jt|dS(N(RtunicodeR9R4R (R-tcontent((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt charactersscCs5t|ts$t||j}n|j|dS(N(RRJR9R4(R-RK((s(/usr/lib64/python2.7/xml/sax/saxutils.pytignorableWhitespacescCs|jd||fdS(Nu (R4(R-ttargetR ((s(/usr/lib64/python2.7/xml/sax/saxutils.pytprocessingInstructionsN(R.R/RR3R=R>R?RBRCRERFRHRIRLRMRO(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR0ps           t XMLFilterBasecBs eZdZddZdZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZRS(sYThis class is designed to sit between an XMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.cCstjj|||_dS(N(t xmlreadert XMLReaderR3t_parent(R-tparent((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR3scCs|jj|dS(N(t _err_handlerterror(R-t exception((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRVscCs|jj|dS(N(RUt fatalError(R-RW((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRXscCs|jj|dS(N(RUtwarning(R-RW((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRYscCs|jj|dS(N(t _cont_handlertsetDocumentLocator(R-tlocator((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR[scCs|jjdS(N(RZR>(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR>scCs|jjdS(N(RZR?(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR?scCs|jj||dS(N(RZRB(R-R<RA((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRBscCs|jj|dS(N(RZRC(R-R<((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRCscCs|jj||dS(N(RZRE(R-R;RD((s(/usr/lib64/python2.7/xml/sax/saxutils.pyREscCs|jj|dS(N(RZRF(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRFscCs|jj|||dS(N(RZRH(R-R;RGRD((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRHscCs|jj||dS(N(RZRI(R-R;RG((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRIscCs|jj|dS(N(RZRL(R-RK((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRLscCs|jj|dS(N(RZRM(R-tchars((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRMscCs|jj||dS(N(RZRO(R-RNR ((s(/usr/lib64/python2.7/xml/sax/saxutils.pyROscCs|jj|dS(N(RZt skippedEntity(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR^scCs|jj|||dS(N(t _dtd_handlert notationDecl(R-R;tpublicIdtsystemId((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR` scCs|jj||||dS(N(R_tunparsedEntityDecl(R-R;RaRbtndata((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRc scCs|jj||S(N(t _ent_handlert resolveEntity(R-RaRb((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRfscCsT|jj||jj||jj||jj||jj|dS(N(RStsetContentHandlertsetErrorHandlertsetEntityResolvert setDTDHandlertparse(R-tsource((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRks cCs|jj|dS(N(RSt setLocale(R-tlocale((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRmscCs|jj|S(N(RSt getFeature(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRo scCs|jj||dS(N(RSt setFeature(R-R;tstate((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRp#scCs|jj|S(N(RSt getProperty(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRr&scCs|jj||dS(N(RSt setProperty(R-R;R((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRs)scCs|jS(N(RS(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt getParent.scCs ||_dS(N(RS(R-RT((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt setParent1sN( R.R/t__doc__RR3RVRXRYR[R>R?RBRCRERFRHRIRLRMROR^R`RcRfRkRmRoRpRrRsRtRu(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRPs:                           RcCst|tkr$tj|}nSt|drw|}tj}|j|t|drw|j|jqwn|jdkry|j }t j j t j j|}tj}t|trt|tsdy|j|}Wqtk r|j|}qXqdnHt|trdy|j|}Wqdtk r`|j|}qdXnt j j||}t j j|}Wntk rt}nX|r|j|t|d}n4|jtj||j tj|j }|j|n|S(sThis function takes an InputSource and an optional base URL and returns a fully resolved InputSource object ready for reading.treadR;trbN(ttypet _StringTypesRQt InputSourcethasattrt setByteStreamt setSystemIdR;t getByteStreamRt getSystemIdtostpathtdirnametnormpathRtgetfilesystemencodingRRJtdecodetUnicodeDecodeErrortencodetjointisfilet UnicodeErrortFalsetopenturlparseturljointurllibturlopen(RltbasetftsysidtbaseheadRt sysidfilenameR((s(/usr/lib64/python2.7/xml/sax/saxutils.pytprepare_input_source6sF         (RvRRRttypesRRR1RQt StringTypet UnicodeTypeRzR&RR R RR*t TextIOWrapperR'R2R0RRRPR(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyts$0          WoPKB ]deq22 handler.pyonu[ {fc@sdZdZdddYZdddYZdddYZddd YZd Zd Zd Zd Z dZ dZ eeee e e gZ dZ dZdZdZdZdZe eeeeegZdS(s0 This module contains the core classes of version 2.0 of SAX for Python. This file provides only default classes with absolutely minimum functionality, from which drivers and applications can be subclassed. Many of these classes are empty and are included only as documentation of the interfaces. $Id$ s2.0betat ErrorHandlercBs)eZdZdZdZdZRS(sBasic interface for SAX error handlers. If you create an object that implements this interface, then register the object with your XMLReader, the parser will call the methods in your object to report all warnings and errors. There are three levels of errors available: warnings, (possibly) recoverable errors, and unrecoverable errors. All methods take a SAXParseException as the only parameter.cCs |dS(sHandle a recoverable error.N((tselft exception((s'/usr/lib64/python2.7/xml/sax/handler.pyterror scCs |dS(sHandle a non-recoverable error.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pyt fatalError$scCs |GHdS(sHandle a warning.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pytwarning(s(t__name__t __module__t__doc__RRR(((s'/usr/lib64/python2.7/xml/sax/handler.pyRs  tContentHandlercBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZRS(sInterface for receiving logical document content events. This is the main callback interface in SAX, and the one most important to applications. The order of events in this interface mirrors the order of the information in the document.cCs d|_dS(N(tNonet_locator(R((s'/usr/lib64/python2.7/xml/sax/handler.pyt__init__6scCs ||_dS(s#Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface. The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine. Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.N(R (Rtlocator((s'/usr/lib64/python2.7/xml/sax/handler.pytsetDocumentLocator9scCsdS(sReceive notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).N((R((s'/usr/lib64/python2.7/xml/sax/handler.pyt startDocumentPtcCsdS(sQReceive notification of the end of a document. The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.N((R((s'/usr/lib64/python2.7/xml/sax/handler.pyt endDocumentWRcCsdS(sBegin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default). There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary. Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.N((Rtprefixturi((s'/usr/lib64/python2.7/xml/sax/handler.pytstartPrefixMapping`RcCsdS(sEnd the scope of a prefix-URI mapping. See startPrefixMapping for details. This event will always occur after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pytendPrefixMappingwRcCsdS(sSignals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an instance of the Attributes class containing the attributes of the element.N((Rtnametattrs((s'/usr/lib64/python2.7/xml/sax/handler.pyt startElement~RcCsdS(sSignals the end of an element in non-namespace mode. The name parameter contains the name of the element type, just as with the startElement event.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pyt endElementRcCsdS(sSignals the start of an element in namespace mode. The name parameter contains the name of the element type as a (uri, localname) tuple, the qname parameter the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the Attributes class containing the attributes of the element. The uri part of the name tuple is None for elements which have no namespace.N((RRtqnameR((s'/usr/lib64/python2.7/xml/sax/handler.pytstartElementNSRcCsdS(sSignals the end of an element in namespace mode. The name parameter contains the name of the element type, just as with the startElementNS event.N((RRR((s'/usr/lib64/python2.7/xml/sax/handler.pyt endElementNSRcCsdS(sReceive notification of character data. The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.N((Rtcontent((s'/usr/lib64/python2.7/xml/sax/handler.pyt charactersRcCsdS(swReceive notification of ignorable whitespace in element content. Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.N((Rt whitespace((s'/usr/lib64/python2.7/xml/sax/handler.pytignorableWhitespaceRcCsdS(sReceive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.N((Rttargettdata((s'/usr/lib64/python2.7/xml/sax/handler.pytprocessingInstructionRcCsdS(sReceive notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pyt skippedEntityR(RRRR RRRRRRRRRRR R#R$(((s'/usr/lib64/python2.7/xml/sax/handler.pyR /s          t DTDHandlercBs eZdZdZdZRS(sHandle DTD events. This interface specifies only those DTD events required for basic parsing (unparsed entities and attributes).cCsdS(s$Handle a notation declaration event.N((RRtpublicIdtsystemId((s'/usr/lib64/python2.7/xml/sax/handler.pyt notationDeclRcCsdS(s,Handle an unparsed entity declaration event.N((RRR&R'tndata((s'/usr/lib64/python2.7/xml/sax/handler.pytunparsedEntityDeclR(RRRR(R*(((s'/usr/lib64/python2.7/xml/sax/handler.pyR%s tEntityResolvercBseZdZdZRS(s7Basic interface for resolving entities. If you create an object implementing this interface, then register the object with your Parser, the parser will call the method in your object to resolve all external entities. Note that DefaultHandler implements this interface with the default behaviour.cCs|S(sResolve the system identifier of an entity and return either the system identifier to read from as a string, or an InputSource to read from.((RR&R'((s'/usr/lib64/python2.7/xml/sax/handler.pyt resolveEntitys(RRRR,(((s'/usr/lib64/python2.7/xml/sax/handler.pyR+ss&http://xml.org/sax/features/namespacess.http://xml.org/sax/features/namespace-prefixess,http://xml.org/sax/features/string-internings&http://xml.org/sax/features/validations5http://xml.org/sax/features/external-general-entitiess7http://xml.org/sax/features/external-parameter-entitiess-http://xml.org/sax/properties/lexical-handlers1http://xml.org/sax/properties/declaration-handlers&http://xml.org/sax/properties/dom-nodes(http://xml.org/sax/properties/xml-strings-http://www.python.org/sax/properties/encodings3http://www.python.org/sax/properties/interning-dictN(((((RtversionRR R%R+tfeature_namespacestfeature_namespace_prefixestfeature_string_interningtfeature_validationtfeature_external_gestfeature_external_pest all_featurestproperty_lexical_handlertproperty_declaration_handlertproperty_dom_nodetproperty_xml_stringtproperty_encodingtproperty_interning_dicttall_properties(((s'/usr/lib64/python2.7/xml/sax/handler.pyt s:   PKB ]ȳKK xmlreader.pycnu[ {fc@sdZddlZddlmZmZdddYZdefdYZddd YZd dd YZd dd YZ de fdYZ dZ e dkre ndS(s]An XML Reader is the SAX 2 name for an XML parser. XML Parsers should be based on this code. iN(tSAXNotSupportedExceptiontSAXNotRecognizedExceptiont XMLReadercBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZRS(s%Interface for reading an XML document using callbacks. XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse. All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.cCs@tj|_tj|_tj|_tj|_dS(N( thandlertContentHandlert _cont_handlert DTDHandlert _dtd_handlertEntityResolvert _ent_handlert ErrorHandlert _err_handler(tself((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt__init__scCstddS(sAParse an XML document from a system identifier or an InputSource.s This method must be implemented!N(tNotImplementedError(R tsource((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytparsescCs|jS(s#Returns the current ContentHandler.(R(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetContentHandler"scCs ||_dS(s:Registers a new object to receive document content events.N(R(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetContentHandler&scCs|jS(s Returns the current DTD handler.(R(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getDTDHandler*scCs ||_dS(s7Register an object to receive basic DTD-related events.N(R(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setDTDHandler.scCs|jS(s#Returns the current EntityResolver.(R (R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetEntityResolver2scCs ||_dS(s0Register an object to resolve external entities.N(R (R tresolver((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetEntityResolver6scCs|jS(s!Returns the current ErrorHandler.(R (R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetErrorHandler:scCs ||_dS(s3Register an object to receive error-message events.N(R (R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetErrorHandler>scCstddS(sHAllow an application to set the locale for errors and warnings. SAX parsers are not required to provide localization for errors and warnings; if they cannot support the requested locale, however, they must raise a SAX exception. Applications may request a locale change in the middle of a parse.sLocale support not implementedN(R(R tlocale((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setLocaleBscCstd|dS(s1Looks up and returns the state of a SAX2 feature.sFeature '%s' not recognizedN(R(R tname((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getFeatureKscCstd|dS(s!Sets the state of a SAX2 feature.sFeature '%s' not recognizedN(R(R Rtstate((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setFeatureOscCstd|dS(s2Looks up and returns the value of a SAX2 property.sProperty '%s' not recognizedN(R(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getPropertySscCstd|dS(s"Sets the value of a SAX2 property.sProperty '%s' not recognizedN(R(R Rtvalue((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setPropertyWs(t__name__t __module__t__doc__R RRRRRRRRRRRRR R"(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR s               tIncrementalParsercBsGeZdZd dZdZdZdZdZdZRS( ssThis interface adds three extra methods to the XMLReader interface that allow XML parsers to support incremental parsing. Support for this interface is optional, since not all underlying XML parsers support this functionality. When the parser is instantiated it is ready to begin accepting data from the feed method immediately. After parsing has been finished with a call to close the reset method must be called to make the parser ready to accept new data, either from feed or using the parse method. Note that these methods must _not_ be called during parsing, that is, after parse has been called and before it returns. By default, the class also implements the parse method of the XMLReader interface using the feed, close and reset methods of the IncrementalParser interface as a convenience to SAX 2.0 driver writers.iicCs||_tj|dS(N(t_bufsizeRR (R tbufsize((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR os cCsddl}|j|}|j||j}|j|j}x/|dkrw|j||j|j}qIW|jdS(Nit(tsaxutilstprepare_input_sourcet prepareParsert getByteStreamtreadR'tfeedtclose(R RR*tfiletbuffer((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRss    cCstddS(sThis method gives the raw XML data in the data parameter to the parser and makes it parse the data, emitting the corresponding events. It is allowed for XML constructs to be split across several calls to feed. feed may raise SAXException.s This method must be implemented!N(R(R tdata((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR/scCstddS(stThis method is called by the parse implementation to allow the SAX 2.0 driver to prepare itself for parsing.s!prepareParser must be overridden!N(R(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR,scCstddS(sThis method is called when the entire XML document has been passed to the parser through the feed method, to notify the parser that there are no more data. This allows the parser to do the final checks on the document and empty the internal data buffer. The parser will not be ready to parse another document until the reset method has been called. close may raise SAXException.s This method must be implemented!N(R(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR0s cCstddS(sThis method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.s This method must be implemented!N(R(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytresetsi( R#R$R%R RR/R,R0R4(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR&[s   tLocatorcBs2eZdZdZdZdZdZRS(sInterface for associating a SAX event with a document location. A locator object will return valid results only during calls to DocumentHandler methods; at any other time, the results are unpredictable.cCsdS(s6Return the column number where the current event ends.i((R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetColumnNumberscCsdS(s4Return the line number where the current event ends.i((R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getLineNumberscCsdS(s3Return the public identifier for the current event.N(tNone(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getPublicIdscCsdS(s3Return the system identifier for the current event.N(R8(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getSystemIds(R#R$R%R6R7R9R:(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR5s    t InputSourcecBsteZdZd dZdZdZdZdZdZ dZ dZ d Z d Z d ZRS( snEncapsulation of the information needed by the XMLReader to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will create objects of this class for use in the XMLReader.parse method and for returning from EntityResolver.resolveEntity. An InputSource belongs to the application, the XMLReader is not allowed to modify InputSource objects passed to it from the application, although it may make copies and modify those.cCs1||_d|_d|_d|_d|_dS(N(t_InputSource__system_idR8t_InputSource__public_idt_InputSource__encodingt_InputSource__bytefilet_InputSource__charfile(R t system_id((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR s     cCs ||_dS(s/Sets the public identifier of this InputSource.N(R=(R t public_id((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setPublicIdscCs|jS(s2Returns the public identifier of this InputSource.(R=(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR9scCs ||_dS(s/Sets the system identifier of this InputSource.N(R<(R RA((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setSystemIdscCs|jS(s2Returns the system identifier of this InputSource.(R<(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR:scCs ||_dS(s4Sets the character encoding of this InputSource. The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML recommendation). The encoding attribute of the InputSource is ignored if the InputSource also contains a character stream.N(R>(R tencoding((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setEncodingscCs|jS(s/Get the character encoding of this InputSource.(R>(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getEncodingscCs ||_dS(sSet the byte stream (a Python file-like object which does not perform byte-to-character conversion) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself. If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.N(R?(R tbytefile((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setByteStreams cCs|jS(sGet the byte stream for this input source. The getEncoding method will return the character encoding for this byte stream, or None if unknown.(R?(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR-scCs ||_dS(s^Set the character stream for this input source. (The stream must be a Python 2.0 Unicode-wrapped file-like that performs conversion to Unicode strings.) If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.N(R@(R tcharfile((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetCharacterStreamscCs|jS(s/Get the character stream for this input source.(R@(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetCharacterStreamsN(R#R$R%R8R RCR9RDR:RFRGRIR-RKRL(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR;s        tAttributesImplcBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZddZdZdZdZRS(cCs ||_dS(sQNon-NS-aware implementation. attrs should be of the form {name : value}.N(t_attrs(R tattrs((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR scCs t|jS(N(tlenRN(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getLengthscCsdS(NtCDATA((R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetTypescCs |j|S(N(RN(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetValue"scCs |j|S(N(RN(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetValueByQName%scCs||jkrt|n|S(N(RNtKeyError(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetNameByQName(s cCs||jkrt|n|S(N(RNRV(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetQNameByName-s cCs |jjS(N(RNtkeys(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetNames2scCs |jjS(N(RNRY(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getQNames5scCs t|jS(N(RPRN(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt__len__8scCs |j|S(N(RN(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt __getitem__;scCs |jjS(N(RNRY(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRY>scCs ||jkS(N(RN(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pythas_keyAscCs ||jkS(N(RN(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt __contains__DscCs|jj||S(N(RNtget(R Rt alternative((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR`GscCs|j|jS(N(t __class__RN(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytcopyJscCs |jjS(N(RNtitems(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRdMscCs |jjS(N(RNtvalues(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRePsN(R#R$R RQRSRTRURWRXRZR[R\R]RYR^R_R8R`RcRdRe(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRMs$                 tAttributesNSImplcBs>eZdZdZdZdZdZdZRS(cCs||_||_dS(sNS-aware implementation. attrs should be of the form {(ns_uri, lname): value, ...}. qnames of the form {(ns_uri, lname): qname, ...}.N(RNt_qnames(R ROtqnames((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR Ws cCsDx4|jjD]#\}}||kr|j|SqWt|dS(N(RgRdRNRV(R Rtnsnametqname((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRU_s cCs=x-|jjD]\}}||kr|SqWt|dS(N(RgRdRV(R RRiRj((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRWfs cCs |j|S(N(Rg(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRXmscCs |jjS(N(RgRe(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR[pscCs|j|j|jS(N(RbRNRg(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRcss(R#R$R RURWRXR[Rc(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRfUs      cCstttdS(N(RR&R5(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt_testwst__main__((((( R%Rt _exceptionsRRRR&R5R;RMRfRkR#(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyts PHYA"  PKB ]99 saxutils.pyonu[ {fc@s-dZddlZddlZddlZddlZddlZddlZddlZddlZyej ej gZ Wne k rej gZ nXdZ idZidZidZdZdejfd YZd ejfd YZd ejfd YZddZdS(snA library of useful helper classes to the SAX classes, for the convenience of application and driver writers. iNcCs3x,|jD]\}}|j||}q W|S(s2Replace substrings of a string using a dictionary.(titemstreplace(tstdtkeytvalue((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt__dict_replacescCsR|jdd}|jdd}|jdd}|rNt||}n|S(sEscape &, <, and > in a string of data. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. t&s&t>s>t in a string of data, then quote it for use as an attribute value. The " character will be escaped as well, if necessary. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. s s s s s s t"t's"%s"s"s'%s'(tcopytupdateR R(R R ((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt quoteattr5s "    cCs|dkr$ddl}|j}nt|tjrTtj|}d|_nTtj}d|_|j |_ y|j |_ |j |_ Wnt k rnXt |d|ddddS( NicSsdS(N(tNone(((s(/usr/lib64/python2.7/xml/sax/saxutils.pytVtcSstS(N(tTrue(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR[Rtencodingterrorstxmlcharrefreplacetnewlines (Rtsyststdoutt isinstancetiot RawIOBasetBufferedIOBasetclosetwritabletwritetseekablettelltAttributeErrort_UnbufferedTextIOWrapper(toutRRtbuffer((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt_gettextwriterMs"        R'cBseZdZRS(cCs$tt|j||jdS(N(tsuperR'R#tflush(tselfR((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR#ks(t__name__t __module__R#(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR'jst XMLGeneratorcBseZdddZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZRS(s iso-8859-1cCsitjj|t||}|j|_|j|_ig|_|jd|_ g|_ ||_ dS(Ni( thandlertContentHandlert__init__R*R#t_writeR,t_flusht _ns_contextst_current_contextt_undeclared_ns_mapst _encoding(R-R(R((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR3rs    cCsX|drPd|dkr&d|dS|j|d}|rP|d|dSn|dS(s7Builds a qualified name from a (ns_url, localname) pairis$http://www.w3.org/XML/1998/namespacesxml:it:(R7(R-tnametprefix((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt_qname|s  cCs|jd|jdS(Nu$ (R4R9(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt startDocuments cCs|jdS(N(R5(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt endDocumentscCs@|jj|jj||j|<|jj||fdS(N(R6tappendR7RR8(R-R<turi((s(/usr/lib64/python2.7/xml/sax/saxutils.pytstartPrefixMappings cCs|jd|_|jd=dS(Ni(R6R7(R-R<((s(/usr/lib64/python2.7/xml/sax/saxutils.pytendPrefixMappingscCs\|jd|x7|jD])\}}|jd|t|fqW|jddS(Nu(R4RR(R-R;tattrsR((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt startElements!cCs|jd|dS(Nu(R4(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt endElementscCs|jd|j|xH|jD]=\}}|rP|jd||fq$|jd|q$Wg|_x@|jD]2\}}|jd|j|t|fq{W|jddS(Nu(R4R=R8RR(R-R;tqnameRDR<RAR((s(/usr/lib64/python2.7/xml/sax/saxutils.pytstartElementNSs *cCs|jd|j|dS(Nu(R4R=(R-R;RG((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt endElementNSscCs;t|ts$t||j}n|jt|dS(N(RtunicodeR9R4R (R-tcontent((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt charactersscCs5t|ts$t||j}n|j|dS(N(RRJR9R4(R-RK((s(/usr/lib64/python2.7/xml/sax/saxutils.pytignorableWhitespacescCs|jd||fdS(Nu (R4(R-ttargetR ((s(/usr/lib64/python2.7/xml/sax/saxutils.pytprocessingInstructionsN(R.R/RR3R=R>R?RBRCRERFRHRIRLRMRO(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR0ps           t XMLFilterBasecBs eZdZddZdZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZRS(sYThis class is designed to sit between an XMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.cCstjj|||_dS(N(t xmlreadert XMLReaderR3t_parent(R-tparent((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR3scCs|jj|dS(N(t _err_handlerterror(R-t exception((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRVscCs|jj|dS(N(RUt fatalError(R-RW((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRXscCs|jj|dS(N(RUtwarning(R-RW((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRYscCs|jj|dS(N(t _cont_handlertsetDocumentLocator(R-tlocator((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR[scCs|jjdS(N(RZR>(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR>scCs|jjdS(N(RZR?(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR?scCs|jj||dS(N(RZRB(R-R<RA((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRBscCs|jj|dS(N(RZRC(R-R<((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRCscCs|jj||dS(N(RZRE(R-R;RD((s(/usr/lib64/python2.7/xml/sax/saxutils.pyREscCs|jj|dS(N(RZRF(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRFscCs|jj|||dS(N(RZRH(R-R;RGRD((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRHscCs|jj||dS(N(RZRI(R-R;RG((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRIscCs|jj|dS(N(RZRL(R-RK((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRLscCs|jj|dS(N(RZRM(R-tchars((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRMscCs|jj||dS(N(RZRO(R-RNR ((s(/usr/lib64/python2.7/xml/sax/saxutils.pyROscCs|jj|dS(N(RZt skippedEntity(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR^scCs|jj|||dS(N(t _dtd_handlert notationDecl(R-R;tpublicIdtsystemId((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR` scCs|jj||||dS(N(R_tunparsedEntityDecl(R-R;RaRbtndata((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRc scCs|jj||S(N(t _ent_handlert resolveEntity(R-RaRb((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRfscCsT|jj||jj||jj||jj||jj|dS(N(RStsetContentHandlertsetErrorHandlertsetEntityResolvert setDTDHandlertparse(R-tsource((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRks cCs|jj|dS(N(RSt setLocale(R-tlocale((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRmscCs|jj|S(N(RSt getFeature(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRo scCs|jj||dS(N(RSt setFeature(R-R;tstate((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRp#scCs|jj|S(N(RSt getProperty(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRr&scCs|jj||dS(N(RSt setProperty(R-R;R((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRs)scCs|jS(N(RS(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt getParent.scCs ||_dS(N(RS(R-RT((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt setParent1sN( R.R/t__doc__RR3RVRXRYR[R>R?RBRCRERFRHRIRLRMROR^R`RcRfRkRmRoRpRrRsRtRu(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRPs:                           RcCst|tkr$tj|}nSt|drw|}tj}|j|t|drw|j|jqwn|jdkry|j }t j j t j j|}tj}t|trt|tsdy|j|}Wqtk r|j|}qXqdnHt|trdy|j|}Wqdtk r`|j|}qdXnt j j||}t j j|}Wntk rt}nX|r|j|t|d}n4|jtj||j tj|j }|j|n|S(sThis function takes an InputSource and an optional base URL and returns a fully resolved InputSource object ready for reading.treadR;trbN(ttypet _StringTypesRQt InputSourcethasattrt setByteStreamt setSystemIdR;t getByteStreamRt getSystemIdtostpathtdirnametnormpathRtgetfilesystemencodingRRJtdecodetUnicodeDecodeErrortencodetjointisfilet UnicodeErrortFalsetopenturlparseturljointurllibturlopen(RltbasetftsysidtbaseheadRt sysidfilenameR((s(/usr/lib64/python2.7/xml/sax/saxutils.pytprepare_input_source6sF         (RvRRRttypesRRR1RQt StringTypet UnicodeTypeRzR&RR R RR*t TextIOWrapperR'R2R0RRRPR(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyts$0          WoPK]Z;AA*__pycache__/xmlreader.cpython-38.opt-1.pycnu[U e5d1@sdZddlmZddlmZmZGdddZGdddeZGdd d ZGd d d Z Gd d d Z Gddde Z ddZ e dkre dS)z]An XML Reader is the SAX 2 name for an XML parser. XML Parsers should be based on this code. )handler)SAXNotSupportedExceptionSAXNotRecognizedExceptionc@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZddZd S)! XMLReadera%Interface for reading an XML document using callbacks. XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse. All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.cCs,t|_t|_t|_t|_dSN) rZContentHandler _cont_handlerZ DTDHandler _dtd_handlerZEntityResolver _ent_handlerZ ErrorHandler _err_handlerselfr )/usr/lib64/python3.8/xml/sax/xmlreader.py__init__s   zXMLReader.__init__cCs tddS)zAParse an XML document from a system identifier or an InputSource. This method must be implemented!NNotImplementedErrorr sourcer r rparseszXMLReader.parsecCs|jS)z#Returns the current ContentHandler.rr r r rgetContentHandler"szXMLReader.getContentHandlercCs ||_dS)z:Registers a new object to receive document content events.Nrr rr r rsetContentHandler&szXMLReader.setContentHandlercCs|jS)z Returns the current DTD handler.rr r r r getDTDHandler*szXMLReader.getDTDHandlercCs ||_dS)z7Register an object to receive basic DTD-related events.Nrrr r r setDTDHandler.szXMLReader.setDTDHandlercCs|jS)z#Returns the current EntityResolver.r r r r rgetEntityResolver2szXMLReader.getEntityResolvercCs ||_dS)z0Register an object to resolve external entities.Nr)r Zresolverr r rsetEntityResolver6szXMLReader.setEntityResolvercCs|jS)z!Returns the current ErrorHandler.r r r r rgetErrorHandler:szXMLReader.getErrorHandlercCs ||_dS)z3Register an object to receive error-message events.Nr rr r rsetErrorHandler>szXMLReader.setErrorHandlercCs tddS)aHAllow an application to set the locale for errors and warnings. SAX parsers are not required to provide localization for errors and warnings; if they cannot support the requested locale, however, they must raise a SAX exception. Applications may request a locale change in the middle of a parse.zLocale support not implementedN)r)r Zlocaler r r setLocaleBszXMLReader.setLocalecCstd|dS)z1Looks up and returns the state of a SAX2 feature.Feature '%s' not recognizedNrr namer r r getFeatureKszXMLReader.getFeaturecCstd|dS)z!Sets the state of a SAX2 feature.r$Nr%)r r'stater r r setFeatureOszXMLReader.setFeaturecCstd|dS)z2Looks up and returns the value of a SAX2 property.Property '%s' not recognizedNr%r&r r r getPropertySszXMLReader.getPropertycCstd|dS)z"Sets the value of a SAX2 property.r+Nr%)r r'valuer r r setPropertyWszXMLReader.setPropertyN)__name__ __module__ __qualname____doc__rrrrrrrrr!r"r#r(r*r,r.r r r rr s   rc@sBeZdZdZdddZddZddZd d Zd d Zd dZ dS)IncrementalParserasThis interface adds three extra methods to the XMLReader interface that allow XML parsers to support incremental parsing. Support for this interface is optional, since not all underlying XML parsers support this functionality. When the parser is instantiated it is ready to begin accepting data from the feed method immediately. After parsing has been finished with a call to close the reset method must be called to make the parser ready to accept new data, either from feed or using the parse method. Note that these methods must _not_ be called during parsing, that is, after parse has been called and before it returns. By default, the class also implements the parse method of the XMLReader interface using the feed, close and reset methods of the IncrementalParser interface as a convenience to SAX 2.0 driver writers.cCs||_t|dSr)_bufsizerr)r bufsizer r rroszIncrementalParser.__init__cCslddlm}||}|||}|dkr8|}||j}|r`||||j}qD| dS)Nr)saxutils) r7Zprepare_input_source prepareParsergetCharacterStream getByteStreamreadr5feedclose)r rr7filebufferr r rrss     zIncrementalParser.parsecCs tddS)aThis method gives the raw XML data in the data parameter to the parser and makes it parse the data, emitting the corresponding events. It is allowed for XML constructs to be split across several calls to feed. feed may raise SAXException.rNr)r datar r rr=szIncrementalParser.feedcCs tddS)ztThis method is called by the parse implementation to allow the SAX 2.0 driver to prepare itself for parsing.z!prepareParser must be overridden!Nrrr r rr9szIncrementalParser.prepareParsercCs tddS)aThis method is called when the entire XML document has been passed to the parser through the feed method, to notify the parser that there are no more data. This allows the parser to do the final checks on the document and empty the internal data buffer. The parser will not be ready to parse another document until the reset method has been called. close may raise SAXException.rNrr r r rr>s zIncrementalParser.closecCs tddS)zThis method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.rNrr r r rresetszIncrementalParser.resetN)r4) r/r0r1r2rrr=r9r>rBr r r rr3[s   r3c@s0eZdZdZddZddZddZdd Zd S) LocatorzInterface for associating a SAX event with a document location. A locator object will return valid results only during calls to DocumentHandler methods; at any other time, the results are unpredictable.cCsdS)z6Return the column number where the current event ends.r r r r rgetColumnNumberszLocator.getColumnNumbercCsdS)z4Return the line number where the current event ends.rDr r r r r getLineNumberszLocator.getLineNumbercCsdS)z3Return the public identifier for the current event.Nr r r r r getPublicIdszLocator.getPublicIdcCsdS)z3Return the system identifier for the current event.Nr r r r r getSystemIdszLocator.getSystemIdN)r/r0r1r2rErFrGrHr r r rrCs rCc@sjeZdZdZdddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZdS) InputSourceanEncapsulation of the information needed by the XMLReader to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will create objects of this class for use in the XMLReader.parse method and for returning from EntityResolver.resolveEntity. An InputSource belongs to the application, the XMLReader is not allowed to modify InputSource objects passed to it from the application, although it may make copies and modify those.NcCs"||_d|_d|_d|_d|_dSr)_InputSource__system_id_InputSource__public_id_InputSource__encoding_InputSource__bytefile_InputSource__charfiler Z system_idr r rrs zInputSource.__init__cCs ||_dS)z/Sets the public identifier of this InputSource.NrK)r Z public_idr r r setPublicIdszInputSource.setPublicIdcCs|jS)z2Returns the public identifier of this InputSource.rPr r r rrGszInputSource.getPublicIdcCs ||_dS)z/Sets the system identifier of this InputSource.NrJrOr r r setSystemIdszInputSource.setSystemIdcCs|jS)z2Returns the system identifier of this InputSource.rRr r r rrHszInputSource.getSystemIdcCs ||_dS)a4Sets the character encoding of this InputSource. The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML recommendation). The encoding attribute of the InputSource is ignored if the InputSource also contains a character stream.NrL)r encodingr r r setEncodingszInputSource.setEncodingcCs|jS)z/Get the character encoding of this InputSource.rTr r r r getEncodingszInputSource.getEncodingcCs ||_dS)aSet the byte stream (a Python file-like object which does not perform byte-to-character conversion) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself. If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.NrM)r Zbytefiler r r setByteStreams zInputSource.setByteStreamcCs|jS)zGet the byte stream for this input source. The getEncoding method will return the character encoding for this byte stream, or None if unknown.rXr r r rr;szInputSource.getByteStreamcCs ||_dS)a^Set the character stream for this input source. (The stream must be a Python 2.0 Unicode-wrapped file-like that performs conversion to Unicode strings.) If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.NrN)r Zcharfiler r rsetCharacterStreamszInputSource.setCharacterStreamcCs|jS)z/Get the character stream for this input source.rZr r r rr:szInputSource.getCharacterStream)N)r/r0r1r2rrQrGrSrHrVrWrYr;r[r:r r r rrIs    rIc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZd$ddZddZd d!Zd"d#ZdS)%AttributesImplcCs ||_dS)zQNon-NS-aware implementation. attrs should be of the form {name : value}.N_attrs)r attrsr r rrszAttributesImpl.__init__cCs t|jSrlenr^r r r r getLengthszAttributesImpl.getLengthcCsdS)NZCDATAr r&r r rgetType!szAttributesImpl.getTypecCs |j|Srr]r&r r rgetValue$szAttributesImpl.getValuecCs |j|Srr]r&r r rgetValueByQName'szAttributesImpl.getValueByQNamecCs||jkrt||Srr^KeyErrorr&r r rgetNameByQName*s zAttributesImpl.getNameByQNamecCs||jkrt||Srrfr&r r rgetQNameByName/s zAttributesImpl.getQNameByNamecCst|jSrlistr^keysr r r rgetNames4szAttributesImpl.getNamescCst|jSrrjr r r r getQNames7szAttributesImpl.getQNamescCs t|jSrr`r r r r__len__:szAttributesImpl.__len__cCs |j|Srr]r&r r r __getitem__=szAttributesImpl.__getitem__cCst|jSrrjr r r rrl@szAttributesImpl.keyscCs ||jkSrr]r&r r r __contains__CszAttributesImpl.__contains__NcCs|j||Sr)r^get)r r' alternativer r rrrFszAttributesImpl.getcCs ||jSr) __class__r^r r r rcopyIszAttributesImpl.copycCst|jSr)rkr^itemsr r r rrvLszAttributesImpl.itemscCst|jSr)rkr^valuesr r r rrwOszAttributesImpl.values)N)r/r0r1rrbrcrdrerhrirmrnrorprlrqrrrurvrwr r r rr\s" r\c@s<eZdZddZddZddZddZd d Zd d Zd S)AttributesNSImplcCs||_||_dS)zNS-aware implementation. attrs should be of the form {(ns_uri, lname): value, ...}. qnames of the form {(ns_uri, lname): qname, ...}.N)r^_qnames)r r_Zqnamesr r rrVszAttributesNSImpl.__init__cCs6|jD]\}}||kr |j|Sq t|dSr)ryrvr^rgr r'ZnsnameZqnamer r rre^sz AttributesNSImpl.getValueByQNamecCs0|jD]\}}||kr |Sq t|dSr)ryrvrgrzr r rrhes zAttributesNSImpl.getNameByQNamecCs |j|Sr)ryr&r r rrilszAttributesNSImpl.getQNameByNamecCst|jSr)rkryrwr r r rrnoszAttributesNSImpl.getQNamescCs||j|jSr)rtr^ryr r r rrurszAttributesNSImpl.copyN) r/r0r1rrerhrirnrur r r rrxTs rxcCstttdSr)rr3rCr r r r_testvsr{__main__N)r2r8r _exceptionsrrrr3rCrIr\rxr{r/r r r rs PJY>"PK]-y2y2#__pycache__/saxutils.cpython-38.pycnu[U e5d/@sdZddlZddlZddlZddlZddlZddlmZddlm Z ddZ ifdd Z ifd d Z ifd d Z ddZGdddejZGddde jZdddZdS)znA library of useful helper classes to the SAX classes, for the convenience of application and driver writers. N)handler) xmlreadercCs"|D]\}}|||}q|S)z2Replace substrings of a string using a dictionary.)itemsreplace)sdkeyvaluer (/usr/lib64/python3.8/xml/sax/saxutils.py__dict_replace sr cCs6|dd}|dd}|dd}|r2t||}|S)zEscape &, <, and > in a string of data. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. &&>><<rr dataZentitiesr r r escapes    rcCs2|dd}|dd}|r&t||}|ddS)a Unescape &, <, and > in a string of data. You can unescape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. rrrrrrrrr r r unescape"s    rcCsR|dddd}t||}d|krFd|kr in a string of data, then quote it for use as an attribute value. The " character will be escaped as well, if necessary. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. z z z )   "'z"%s"z"z'%s')rrrr r r quoteattr0s   rcsdkrddl}|jSttjr&Sttjtjfr<SttjrlGfddd}|}dd|_ nDt }dd|_ j |_ zj |_ j|_Wntk rYnXtj||ddd d S) NrcseZdZjZfddZdS)z _gettextwriter.._wrappercs t|SN)getattrselfnameoutr r __getattr__Zsz,_gettextwriter.._wrapper.__getattr__N)__name__ __module__ __qualname__ __class__r&r r$r r _wrapperXsr+cSsdSrr r r r r ]z _gettextwriter..cSsdS)NTr r r r r r,br-xmlcharrefreplacerT)encodingerrorsnewline write_through)sysstdout isinstanceio TextIOBasecodecs StreamWriterStreamReaderWriter RawIOBasecloseBufferedIOBasewritablewriteseekabletellAttributeError TextIOWrapper)r%r/r3r+bufferr r$r _gettextwriterGs0     rEc@seZdZd ddZddZd!dd Zd d Zd d ZddZddZ ddZ ddZ ddZ ddZ ddZddZddZdS)" XMLGeneratorN iso-8859-1FcCsVtj|t||}|j|_|j|_ig|_|jd|_ g|_ ||_ ||_ d|_ dS)NF)rContentHandler__init__rEr?_writeflush_flush _ns_contexts_current_context_undeclared_ns_maps _encoding_short_empty_elements_pending_start_element)r"r%r/Zshort_empty_elementsr r r rJrs   zXMLGenerator.__init__cCsJ|drBd|dkr d|dS|j|d}|rB|d|dS|dS)z7Builds a qualified name from a (ns_url, localname) pairrz$http://www.w3.org/XML/1998/namespacezxml:r:)rO)r"r#prefixr r r _qname~s  zXMLGenerator._qnamecCs|jr|dd|_dS)NrFrSrK)r" endElementr r r _finish_pending_start_elements z*XMLGenerator._finish_pending_start_elementcCs|d|jdS)Nz$ )rKrQr"r r r startDocumentszXMLGenerator.startDocumentcCs |dSr)rMrZr r r endDocumentszXMLGenerator.endDocumentcCs0|j|j||j|<|j||fdSr)rNappendrOcopyrPr"rUurir r r startPrefixMappings zXMLGenerator.startPrefixMappingcCs|jd|_|jd=dS)NrH)rNrOr"rUr r r endPrefixMappings zXMLGenerator.endPrefixMappingcCsZ||d||D]\}}|d|t|fq|jrLd|_n |ddS)Nr %s=%sTr)rYrKrrrRrS)r"r#attrsr r r r startElementszXMLGenerator.startElementcCs*|jr|dd|_n|d|dSNz/>FzrWr!r r r rXs zXMLGenerator.endElementcCs||d|||jD].\}}|rB|d||fq"|d|q"g|_|D]$\}}|d||t|fq`|jrd|_n |ddS)Nrz xmlns:%s="%s"z xmlns="%s"rdTr)rYrKrVrPrrrRrS)r"r#qnamererUr`r r r r startElementNSszXMLGenerator.startElementNScCs0|jr|dd|_n|d||dSrg)rSrKrVr"r#rhr r r endElementNSs zXMLGenerator.endElementNScCs4|r0|t|ts"t||j}|t|dSr)rYr5strrQrKrr"Zcontentr r r characterss   zXMLGenerator.characterscCs0|r,|t|ts"t||j}||dSr)rYr5rlrQrKrmr r r ignorableWhitespaces   z XMLGenerator.ignorableWhitespacecCs||d||fdS)Nz )rYrKr"targetrr r r processingInstructionsz"XMLGenerator.processingInstruction)NrGF)F)r'r(r)rJrVrYr[r\rarcrfrXrirkrnrorrr r r r rFps   rFc@seZdZdZd;ddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:ZdS)< XMLFilterBaseaYThis class is designed to sit between an XMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.NcCstj|||_dSr)r XMLReaderrJ_parentr"parentr r r rJs zXMLFilterBase.__init__cCs|j|dSr) _err_handlererrorr"Z exceptionr r r ryszXMLFilterBase.errorcCs|j|dSr)rx fatalErrorrzr r r r{szXMLFilterBase.fatalErrorcCs|j|dSr)rxwarningrzr r r r|szXMLFilterBase.warningcCs|j|dSr) _cont_handlersetDocumentLocator)r"Zlocatorr r r r~sz XMLFilterBase.setDocumentLocatorcCs|jdSr)r}r[rZr r r r[szXMLFilterBase.startDocumentcCs|jdSr)r}r\rZr r r r\szXMLFilterBase.endDocumentcCs|j||dSr)r}rar_r r r rasz XMLFilterBase.startPrefixMappingcCs|j|dSr)r}rcrbr r r rcszXMLFilterBase.endPrefixMappingcCs|j||dSr)r}rf)r"r#rer r r rf szXMLFilterBase.startElementcCs|j|dSr)r}rXr!r r r rXszXMLFilterBase.endElementcCs|j|||dSr)r}ri)r"r#rhrer r r riszXMLFilterBase.startElementNScCs|j||dSr)r}rkrjr r r rkszXMLFilterBase.endElementNScCs|j|dSr)r}rnrmr r r rnszXMLFilterBase.characterscCs|j|dSr)r}ro)r"charsr r r rosz!XMLFilterBase.ignorableWhitespacecCs|j||dSr)r}rrrpr r r rrsz#XMLFilterBase.processingInstructioncCs|j|dSr)r} skippedEntityr!r r r r szXMLFilterBase.skippedEntitycCs|j|||dSr) _dtd_handler notationDecl)r"r#publicIdsystemIdr r r r%szXMLFilterBase.notationDeclcCs|j||||dSr)runparsedEntityDecl)r"r#rrZndatar r r r(sz XMLFilterBase.unparsedEntityDeclcCs|j||Sr)Z _ent_handler resolveEntity)r"rrr r r r-szXMLFilterBase.resolveEntitycCs@|j||j||j||j||j|dSr)ruZsetContentHandlerZsetErrorHandlerZsetEntityResolverZ setDTDHandlerparse)r"sourcer r r r2s     zXMLFilterBase.parsecCs|j|dSr)ru setLocale)r"Zlocaler r r r9szXMLFilterBase.setLocalecCs |j|Sr)ru getFeaturer!r r r r<szXMLFilterBase.getFeaturecCs|j||dSr)ru setFeature)r"r#stater r r r?szXMLFilterBase.setFeaturecCs |j|Sr)ru getPropertyr!r r r rBszXMLFilterBase.getPropertycCs|j||dSr)ru setProperty)r"r#r r r r rEszXMLFilterBase.setPropertycCs|jSrrurZr r r getParentJszXMLFilterBase.getParentcCs ||_dSrrrvr r r setParentMszXMLFilterBase.setParent)N) r'r(r)__doc__rJryr{r|r~r[r\rarcrfrXrirkrnrorrrrrrrrrrrrrrr r r r rss: rscCs$t|tjrt|}t|tr,t|}n^t|dr|}t}t|dtr^| |n | |t|drt|j tr| |j | dkr |dkr |}tjtj|}tj||}tj|r| |t|d}n$| tj||tj|}| ||S)zThis function takes an InputSource and an optional base URL and returns a fully resolved InputSource object ready for reading.readrr#Nrb)r5osPathLikefspathrlrZ InputSourcehasattrrZsetCharacterStreamZ setByteStreamr#Z setSystemIdZgetCharacterStreamZ getByteStreamZ getSystemIdpathdirnamenormpathjoinisfileopenurllibrZurljoinZrequestZurlopen)rbasefZsysidZbaseheadZ sysidfilenamer r r prepare_input_sourceRs.            r)r)rrZ urllib.parserZurllib.requestr6r8rrrr rrrrErIrFrtrsrr r r r s     )soPK]bк((*__pycache__/xmlreader.cpython-38.opt-2.pycnu[U e5d1@sddlmZddlmZmZGdddZGdddeZGdddZGd d d ZGd d d Z Gd dde Z ddZ e dkre dS))handler)SAXNotSupportedExceptionSAXNotRecognizedExceptionc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdS) XMLReadercCs,t|_t|_t|_t|_dSN) rZContentHandler _cont_handlerZ DTDHandler _dtd_handlerZEntityResolver _ent_handlerZ ErrorHandler _err_handlerselfr )/usr/lib64/python3.8/xml/sax/xmlreader.py__init__s   zXMLReader.__init__cCs tddSNz This method must be implemented!NotImplementedErrorr sourcer r rparseszXMLReader.parsecCs|jSrrr r r rgetContentHandler"szXMLReader.getContentHandlercCs ||_dSrrr rr r rsetContentHandler&szXMLReader.setContentHandlercCs|jSrrr r r r getDTDHandler*szXMLReader.getDTDHandlercCs ||_dSrrrr r r setDTDHandler.szXMLReader.setDTDHandlercCs|jSrr r r r rgetEntityResolver2szXMLReader.getEntityResolvercCs ||_dSrr)r Zresolverr r rsetEntityResolver6szXMLReader.setEntityResolvercCs|jSrr r r r rgetErrorHandler:szXMLReader.getErrorHandlercCs ||_dSrr rr r rsetErrorHandler>szXMLReader.setErrorHandlercCs tddS)NzLocale support not implemented)r)r Zlocaler r r setLocaleBszXMLReader.setLocalecCstd|dSNzFeature '%s' not recognizedrr namer r r getFeatureKszXMLReader.getFeaturecCstd|dSr$r%)r r'stater r r setFeatureOszXMLReader.setFeaturecCstd|dSNzProperty '%s' not recognizedr%r&r r r getPropertySszXMLReader.getPropertycCstd|dSr+r%)r r'valuer r r setPropertyWszXMLReader.setPropertyN)__name__ __module__ __qualname__rrrrrrrrr!r"r#r(r*r,r.r r r rr s  rc@s>eZdZdddZddZddZdd Zd d Zd d ZdS)IncrementalParsercCs||_t|dSr)_bufsizerr)r bufsizer r rroszIncrementalParser.__init__cCslddlm}||}|||}|dkr8|}||j}|r`||||j}qD| dS)Nr)saxutils) r6Zprepare_input_source prepareParsergetCharacterStream getByteStreamreadr4feedclose)r rr6filebufferr r rrss     zIncrementalParser.parsecCs tddSrr)r datar r rr<szIncrementalParser.feedcCs tddS)Nz!prepareParser must be overridden!rrr r rr8szIncrementalParser.prepareParsercCs tddSrrr r r rr=s zIncrementalParser.closecCs tddSrrr r r rresetszIncrementalParser.resetN)r3) r/r0r1rrr<r8r=rAr r r rr2[s    r2c@s,eZdZddZddZddZddZd S) LocatorcCsdSNr r r r rgetColumnNumberszLocator.getColumnNumbercCsdSrCr r r r r getLineNumberszLocator.getLineNumbercCsdSrr r r r r getPublicIdszLocator.getPublicIdcCsdSrr r r r r getSystemIdszLocator.getSystemIdN)r/r0r1rErFrGrHr r r rrBsrBc@sfeZdZdddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ dS) InputSourceNcCs"||_d|_d|_d|_d|_dSr)_InputSource__system_id_InputSource__public_id_InputSource__encoding_InputSource__bytefile_InputSource__charfiler Z system_idr r rrs zInputSource.__init__cCs ||_dSrrK)r Z public_idr r r setPublicIdszInputSource.setPublicIdcCs|jSrrPr r r rrGszInputSource.getPublicIdcCs ||_dSrrJrOr r r setSystemIdszInputSource.setSystemIdcCs|jSrrRr r r rrHszInputSource.getSystemIdcCs ||_dSrrL)r encodingr r r setEncodingszInputSource.setEncodingcCs|jSrrTr r r r getEncodingszInputSource.getEncodingcCs ||_dSrrM)r Zbytefiler r r setByteStreams zInputSource.setByteStreamcCs|jSrrXr r r rr:szInputSource.getByteStreamcCs ||_dSrrN)r Zcharfiler r rsetCharacterStreamszInputSource.setCharacterStreamcCs|jSrrZr r r rr9szInputSource.getCharacterStream)N)r/r0r1rrQrGrSrHrVrWrYr:r[r9r r r rrIs    rIc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZd$ddZddZd d!Zd"d#ZdS)%AttributesImplcCs ||_dSr_attrs)r attrsr r rrszAttributesImpl.__init__cCs t|jSrlenr^r r r r getLengthszAttributesImpl.getLengthcCsdS)NZCDATAr r&r r rgetType!szAttributesImpl.getTypecCs |j|Srr]r&r r rgetValue$szAttributesImpl.getValuecCs |j|Srr]r&r r rgetValueByQName'szAttributesImpl.getValueByQNamecCs||jkrt||Srr^KeyErrorr&r r rgetNameByQName*s zAttributesImpl.getNameByQNamecCs||jkrt||Srrfr&r r rgetQNameByName/s zAttributesImpl.getQNameByNamecCst|jSrlistr^keysr r r rgetNames4szAttributesImpl.getNamescCst|jSrrjr r r r getQNames7szAttributesImpl.getQNamescCs t|jSrr`r r r r__len__:szAttributesImpl.__len__cCs |j|Srr]r&r r r __getitem__=szAttributesImpl.__getitem__cCst|jSrrjr r r rrl@szAttributesImpl.keyscCs ||jkSrr]r&r r r __contains__CszAttributesImpl.__contains__NcCs|j||Sr)r^get)r r' alternativer r rrrFszAttributesImpl.getcCs ||jSr) __class__r^r r r rcopyIszAttributesImpl.copycCst|jSr)rkr^itemsr r r rrvLszAttributesImpl.itemscCst|jSr)rkr^valuesr r r rrwOszAttributesImpl.values)N)r/r0r1rrbrcrdrerhrirmrnrorprlrqrrrurvrwr r r rr\s" r\c@s<eZdZddZddZddZddZd d Zd d Zd S)AttributesNSImplcCs||_||_dSr)r^_qnames)r r_Zqnamesr r rrVszAttributesNSImpl.__init__cCs6|jD]\}}||kr |j|Sq t|dSr)ryrvr^rgr r'ZnsnameZqnamer r rre^sz AttributesNSImpl.getValueByQNamecCs0|jD]\}}||kr |Sq t|dSr)ryrvrgrzr r rrhes zAttributesNSImpl.getNameByQNamecCs |j|Sr)ryr&r r rrilszAttributesNSImpl.getQNameByNamecCst|jSr)rkryrwr r r rrnoszAttributesNSImpl.getQNamescCs||j|jSr)rtr^ryr r r rrurszAttributesNSImpl.copyN) r/r0r1rrerhrirnrur r r rrxTs rxcCstttdSr)rr2rBr r r r_testvsr{__main__N) r7r _exceptionsrrrr2rBrIr\rxr{r/r r r rs PJY>"PK]nn)__pycache__/__init__.cpython-38.opt-2.pycnu[U e5d?@sddlmZddlmZmZddlmZmZmZm Z m Z efddZ efddZ dgZ d Zerjd d lZd d lZd d lZejjsd ejkrejd d Z [d Zejd ddkrejerejed Z dddZejd ddkrddZnddZ[d S)) InputSource)ContentHandler ErrorHandler) SAXExceptionSAXNotRecognizedExceptionSAXParseExceptionSAXNotSupportedExceptionSAXReaderNotAvailablecCs(t}||||||dS)N) make_parsersetContentHandlersetErrorHandlerparse)sourcehandler errorHandlerparserr(/usr/lib64/python3.8/xml/sax/__init__.pyr s  r cCspddl}|dkrt}t}||||t}t|trR|| |n| | || |dS)N) iorr r r r isinstancestrZsetCharacterStreamStringIOZ setByteStreamBytesIOr )stringrrrrZinpsrcrrr parseString#s   rzxml.sax.expatreaderrNZ PY_SAX_PARSER,zpython.xml.sax.parserjavarc Csxt|tD]\}zt|WStk rT}zddl}||jkrDW5d}~XYq tk rfYq Xq tdddS)NrzNo parsers found)listdefault_parser_list_create_parser ImportErrorsysmodulesr )Z parser_list parser_nameer#rrrr Fs r cCs$ddlm}||dt}|S)Nr)imp)Zorg.python.corer'Z importNameglobals create_parser)r%r' drv_modulerrrr!as r!cCst|iidg}|S)Nr)) __import__r))r%r*rrrr!gs)r)Z xmlreaderrrrr _exceptionsrrrrr r rr _falseZxml.sax.expatreaderZxmlosr#flagsignore_environmentenvironsplitZ_keyplatformregistryZ containsKeyZ getPropertyr r!rrrrs(   PK](00&__pycache__/expatreader.cpython-38.pycnu[U e5dX=@sdZdZddlTddlmZmZddlmZddlmZmZddlm Z ddlm Z m Z dd l Z e j d d d kr|ed d [ zdd lmZWnek redd YnXeedsedd ddlmZmZmZejZejZz dd lZWnek r ddZYnXdd lZejZ[[GdddZGdddejZGdddej ejZ!ddZ"e#dkrdd l$Z%e"Z&e&'e%j(j)e&*e%j(+e&,dd S)z] SAX driver for the pyexpat C module. This driver works with pyexpat.__version__ == '2.22'. z0.20)*)feature_validationfeature_namespaces)feature_namespace_prefixes)feature_external_gesfeature_external_pes)feature_string_interning)property_xml_stringproperty_interning_dictNjavazexpat not available in Java)expatzexpat not supported ParserCreate) xmlreadersaxutilshandlercCs|SN)orr+/usr/lib64/python3.8/xml/sax/expatreader.py_mkproxy'src@s eZdZdS) _ClosedParserN)__name__ __module__ __qualname__rrrrr.src@s8eZdZdZddZddZddZdd Zd d Zd S) ExpatLocatorzLocator for use with the ExpatParser class. This uses a weak reference to the parser object to avoid creating a circular reference between the parser and the content handler. cCst||_dSr)r_refselfparserrrr__init__9szExpatLocator.__init__cCs|j}|jdkrdS|jjSr)r_parserErrorColumnNumberrrrrgetColumnNumber<s zExpatLocator.getColumnNumbercCs|j}|jdkrdS|jjSN)rr!ErrorLineNumberrrrr getLineNumberBs zExpatLocator.getLineNumbercCs|j}|dkrdS|jSr)r_source getPublicIdrrrrr)HszExpatLocator.getPublicIdcCs|j}|dkrdS|jSr)rr( getSystemIdrrrrr*NszExpatLocator.getSystemIdN) rrr__doc__r r#r'r)r*rrrrr3s rc@s eZdZdZdCddZddZdd Zd d Zd d ZddZ ddZ ddZ dDddZ ddZ ddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Zdd?Z!d@dAZ"dBS)E ExpatParserz$SAX driver for the pyexpat C module.rcCsFtj||t|_d|_||_d|_d|_g|_ d|_ d|_ dS)Nr) rIncrementalParserr Z InputSourcer(r! _namespaces_lex_handler_prop_parsing _entity_stack _external_ges _interning)rZnamespaceHandlingbufsizerrrr Zs zExpatParser.__init__cCsVt|}||_z*||jt|tj ||Wn| YnXdS)z3Parse an XML document from a URL or an InputSource.N) rprepare_input_sourcer(reset _cont_handlerZsetDocumentLocatorrrr.parse _close_sourcersourcerrrr9gs zExpatParser.parsecCs |dk r|j|dSr)r*r!ZSetBaser;rrr prepareParserws zExpatParser.prepareParsercCs tj|||jr|dSr)rr.setContentHandlerr1_reset_cont_handler)rrrrrr>}szExpatParser.setContentHandlercCsP|tkr|jS|tkr |jdk S|tttfkr2dS|tkr@|jSt d|dS)NrFeature '%s' not recognized) rr/rr4rrrrr3SAXNotRecognizedExceptionrnamerrr getFeatures zExpatParser.getFeaturecCs|jrtd|tkr||_n|tkr.||_nt|tkrT|rL|jdkrRi|_qd|_nN|tkrj|rtdn8|t kr|rtdn"|t kr|rtdn t d|dS)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixesr@) r1SAXNotSupportedExceptionrr/rr3rr4rrrrA)rrCstaterrr setFeatures: zExpatParser.setFeaturecCsd|tjkr|jS|tkr|jS|tkrT|jrLt|jdrB|jSt dnt dt d|dS)NGetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsingProperty '%s' not recognized) rproperty_lexical_handlerr0r r4r r!hasattrrHrArErBrrr getPropertys   zExpatParser.getPropertycCsV|tjkr ||_|jrR|n2|tkr0||_n"|tkrFtd|n t d|dS)NzProperty '%s' cannot be setrI) rrJr0r1_reset_lex_handler_propr r4r rErA)rrCvaluerrr setPropertys  zExpatParser.setPropertyc Csz|js|d|_|jz|j||WnDtjk rt}z$tt |j ||}|j |W5d}~XYnXdSr$) r1r7r8Z startDocumentr!ZParser errorZSAXParseExceptionZ ErrorStringcodeZ _err_handlerZ fatalError)rdataisFinaleexcrrrfeeds zExpatParser.feedcCsB|j}z|}|dk r |W5|}|dk r<|XdSr)r(Z getByteStreamcloseZgetCharacterStream)rr<filerrrr:s zExpatParser._close_sourcecCs|js|jdkst|jtr dSz(|jddd|j d|_d|_W5d|_|jdk rzt}|jj|_|jj|_||_|XdS)Nrr%)rS) r2r! isinstancerr1r"r&r:rVr8Z endDocumentrrrrrWs       zExpatParser.closecCs|jj|j_|jj|j_dSr)r8processingInstructionr!ZProcessingInstructionHandler charactersZCharacterDataHandlerrrrrr?szExpatParser._reset_cont_handlercCs`|j}|j}|dkr4d|_d|_d|_d|_d|_n(|j|_|j|_|j |_|j |_|j |_dSr) r0r!ZCommentHandlerZStartCdataSectionHandlerZEndCdataSectionHandlerZStartDoctypeDeclHandlerZEndDoctypeDeclHandlerZcommentZ startCDATAZendCDATAstart_doctype_declZendDTD)rZlexrrrrrMsz#ExpatParser._reset_lex_handler_propcCs|jr>tj|jd|jd|_d|j_|j|j_ |j |j_ n,tj|j|jd|_|j |j_ |j |j_ ||j|j_|j|j_|j|j_|j|j_d|_|jr||j|j_z|j|j_Wntk rYnX|jtj d|_!g|_"dS)N )internr%r)#r/r rr(Z getEncodingr4r!Znamespace_prefixesstart_element_nsZStartElementHandlerend_element_nsZEndElementHandler start_element end_elementr?unparsed_entity_declZUnparsedEntityDeclHandler notation_declZNotationDeclHandlerstart_namespace_declZStartNamespaceDeclHandlerend_namespace_declZEndNamespaceDeclHandlerZ_decl_handler_propr0rMexternal_entity_refZExternalEntityRefHandlerskipped_entity_handlerZSkippedEntityHandlerAttributeErrorZSetParamEntityParsingZ*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr1r2r]rrrr7s<          zExpatParser.resetcCs|jdkrdS|jjSr)r!r"r]rrrr#;s zExpatParser.getColumnNumbercCs|jdkrdS|jjSr$)r!r&r]rrrr'@s zExpatParser.getLineNumbercCs |jSr)r(r)r]rrrr)EszExpatParser.getPublicIdcCs |jSr)r(r*r]rrrr*HszExpatParser.getSystemIdcCs|j|t|dSr)r8Z startElementAttributesImpl)rrCattrsrrrrcLszExpatParser.start_elementcCs|j|dSr)r8Z endElementrBrrrrdOszExpatParser.end_elementc Cs|}t|dkrd|f}n&t|dkr<|d|df}nt|}i}i}|D]|\}}|}t|} | dkr|} d|f} n>| dkrd|d|df} |d|df} n|d} t|} ||| <| || <qT|j|dt||dS)Nr%rz%s:%s)splitlentupleitemsr8ZstartElementNSAttributesNSImpl) rrCrmpairZnewattrsZqnamesZanamerNpartsZlengthZqnameZapairrrrraRs0      zExpatParser.start_element_nscCsV|}t|dkrd|f}n&t|dkr<|d|df}nt|}|j|ddS)Nr%rnr)rprqrrr8Z endElementNS)rrCrurrrrbts   zExpatParser.end_element_nscCs|j||dSr)r8r[)rtargetrRrrrprocessing_instructionsz"ExpatParser.processing_instructioncCs|j|dSr)r8r\)rrRrrrcharacter_dataszExpatParser.character_datacCs|j||dSr)r8ZstartPrefixMapping)rprefixZurirrrrgsz ExpatParser.start_namespace_declcCs|j|dSr)r8ZendPrefixMapping)rrzrrrrhszExpatParser.end_namespace_declcCs|j|||dSr)r0ZstartDTD)rrCsysidpubidZhas_internal_subsetrrrr^szExpatParser.start_doctype_declcCs|j||||dSr) _dtd_handlerZunparsedEntityDecl)rrCbaser{r|Z notation_namerrrresz ExpatParser.unparsed_entity_declcCs|j|||dSr)r}Z notationDecl)rrCr~r{r|rrrrfszExpatParser.notation_declcCs|js dS|j||}t||jp*d}|j|j |jf|j ||_ ||_zt j ||WnYdSX|jd\|_ |_|jd=dS)Nr%rYr)r3Z _ent_handlerZ resolveEntityrr6r(r*r2appendr!ZExternalEntityParserCreaterr.r9)rcontextr~r{r|r<rrrris" zExpatParser.external_entity_refcCs|r d|}|j|dS)N%)r8Z skippedEntity)rrCZis_perrrrjsz"ExpatParser.skipped_entity_handlerN)rr-)r)#rrrr+r r9r=r>rDrGrLrOrVr:rWr?rMr7r#r'r)r*rcrdrarbrxryrgrhr^rerfrirjrrrrr,Ws@    '" r,cOs t||Sr)r,)argskwargsrrr create_parsersr__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml)-r+versionZxml.sax._exceptionsZxml.sax.handlerrrrrrrr r sysplatformZSAXReaderNotAvailableZ xml.parsersr ImportErrorrKZxml.saxrrrrlrt_weakrefrweakrefproxyrZLocatorrr.r,rrZxml.sax.saxutilsZxmlpr>ZsaxZ XMLGeneratorZsetErrorHandlerZ ErrorHandlerr9rrrrsN      $_ PK]-y2y2)__pycache__/saxutils.cpython-38.opt-1.pycnu[U e5d/@sdZddlZddlZddlZddlZddlZddlmZddlm Z ddZ ifdd Z ifd d Z ifd d Z ddZGdddejZGddde jZdddZdS)znA library of useful helper classes to the SAX classes, for the convenience of application and driver writers. N)handler) xmlreadercCs"|D]\}}|||}q|S)z2Replace substrings of a string using a dictionary.)itemsreplace)sdkeyvaluer (/usr/lib64/python3.8/xml/sax/saxutils.py__dict_replace sr cCs6|dd}|dd}|dd}|r2t||}|S)zEscape &, <, and > in a string of data. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. &&>><<rr dataZentitiesr r r escapes    rcCs2|dd}|dd}|r&t||}|ddS)a Unescape &, <, and > in a string of data. You can unescape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. rrrrrrrrr r r unescape"s    rcCsR|dddd}t||}d|krFd|kr in a string of data, then quote it for use as an attribute value. The " character will be escaped as well, if necessary. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. z z z )   "'z"%s"z"z'%s')rrrr r r quoteattr0s   rcsdkrddl}|jSttjr&Sttjtjfr<SttjrlGfddd}|}dd|_ nDt }dd|_ j |_ zj |_ j|_Wntk rYnXtj||ddd d S) NrcseZdZjZfddZdS)z _gettextwriter.._wrappercs t|SN)getattrselfnameoutr r __getattr__Zsz,_gettextwriter.._wrapper.__getattr__N)__name__ __module__ __qualname__ __class__r&r r$r r _wrapperXsr+cSsdSrr r r r r ]z _gettextwriter..cSsdS)NTr r r r r r,br-xmlcharrefreplacerT)encodingerrorsnewline write_through)sysstdout isinstanceio TextIOBasecodecs StreamWriterStreamReaderWriter RawIOBasecloseBufferedIOBasewritablewriteseekabletellAttributeError TextIOWrapper)r%r/r3r+bufferr r$r _gettextwriterGs0     rEc@seZdZd ddZddZd!dd Zd d Zd d ZddZddZ ddZ ddZ ddZ ddZ ddZddZddZdS)" XMLGeneratorN iso-8859-1FcCsVtj|t||}|j|_|j|_ig|_|jd|_ g|_ ||_ ||_ d|_ dS)NF)rContentHandler__init__rEr?_writeflush_flush _ns_contexts_current_context_undeclared_ns_maps _encoding_short_empty_elements_pending_start_element)r"r%r/Zshort_empty_elementsr r r rJrs   zXMLGenerator.__init__cCsJ|drBd|dkr d|dS|j|d}|rB|d|dS|dS)z7Builds a qualified name from a (ns_url, localname) pairrz$http://www.w3.org/XML/1998/namespacezxml:r:)rO)r"r#prefixr r r _qname~s  zXMLGenerator._qnamecCs|jr|dd|_dS)NrFrSrK)r" endElementr r r _finish_pending_start_elements z*XMLGenerator._finish_pending_start_elementcCs|d|jdS)Nz$ )rKrQr"r r r startDocumentszXMLGenerator.startDocumentcCs |dSr)rMrZr r r endDocumentszXMLGenerator.endDocumentcCs0|j|j||j|<|j||fdSr)rNappendrOcopyrPr"rUurir r r startPrefixMappings zXMLGenerator.startPrefixMappingcCs|jd|_|jd=dS)NrH)rNrOr"rUr r r endPrefixMappings zXMLGenerator.endPrefixMappingcCsZ||d||D]\}}|d|t|fq|jrLd|_n |ddS)Nr %s=%sTr)rYrKrrrRrS)r"r#attrsr r r r startElementszXMLGenerator.startElementcCs*|jr|dd|_n|d|dSNz/>FzrWr!r r r rXs zXMLGenerator.endElementcCs||d|||jD].\}}|rB|d||fq"|d|q"g|_|D]$\}}|d||t|fq`|jrd|_n |ddS)Nrz xmlns:%s="%s"z xmlns="%s"rdTr)rYrKrVrPrrrRrS)r"r#qnamererUr`r r r r startElementNSszXMLGenerator.startElementNScCs0|jr|dd|_n|d||dSrg)rSrKrVr"r#rhr r r endElementNSs zXMLGenerator.endElementNScCs4|r0|t|ts"t||j}|t|dSr)rYr5strrQrKrr"Zcontentr r r characterss   zXMLGenerator.characterscCs0|r,|t|ts"t||j}||dSr)rYr5rlrQrKrmr r r ignorableWhitespaces   z XMLGenerator.ignorableWhitespacecCs||d||fdS)Nz )rYrKr"targetrr r r processingInstructionsz"XMLGenerator.processingInstruction)NrGF)F)r'r(r)rJrVrYr[r\rarcrfrXrirkrnrorrr r r r rFps   rFc@seZdZdZd;ddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:ZdS)< XMLFilterBaseaYThis class is designed to sit between an XMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.NcCstj|||_dSr)r XMLReaderrJ_parentr"parentr r r rJs zXMLFilterBase.__init__cCs|j|dSr) _err_handlererrorr"Z exceptionr r r ryszXMLFilterBase.errorcCs|j|dSr)rx fatalErrorrzr r r r{szXMLFilterBase.fatalErrorcCs|j|dSr)rxwarningrzr r r r|szXMLFilterBase.warningcCs|j|dSr) _cont_handlersetDocumentLocator)r"Zlocatorr r r r~sz XMLFilterBase.setDocumentLocatorcCs|jdSr)r}r[rZr r r r[szXMLFilterBase.startDocumentcCs|jdSr)r}r\rZr r r r\szXMLFilterBase.endDocumentcCs|j||dSr)r}rar_r r r rasz XMLFilterBase.startPrefixMappingcCs|j|dSr)r}rcrbr r r rcszXMLFilterBase.endPrefixMappingcCs|j||dSr)r}rf)r"r#rer r r rf szXMLFilterBase.startElementcCs|j|dSr)r}rXr!r r r rXszXMLFilterBase.endElementcCs|j|||dSr)r}ri)r"r#rhrer r r riszXMLFilterBase.startElementNScCs|j||dSr)r}rkrjr r r rkszXMLFilterBase.endElementNScCs|j|dSr)r}rnrmr r r rnszXMLFilterBase.characterscCs|j|dSr)r}ro)r"charsr r r rosz!XMLFilterBase.ignorableWhitespacecCs|j||dSr)r}rrrpr r r rrsz#XMLFilterBase.processingInstructioncCs|j|dSr)r} skippedEntityr!r r r r szXMLFilterBase.skippedEntitycCs|j|||dSr) _dtd_handler notationDecl)r"r#publicIdsystemIdr r r r%szXMLFilterBase.notationDeclcCs|j||||dSr)runparsedEntityDecl)r"r#rrZndatar r r r(sz XMLFilterBase.unparsedEntityDeclcCs|j||Sr)Z _ent_handler resolveEntity)r"rrr r r r-szXMLFilterBase.resolveEntitycCs@|j||j||j||j||j|dSr)ruZsetContentHandlerZsetErrorHandlerZsetEntityResolverZ setDTDHandlerparse)r"sourcer r r r2s     zXMLFilterBase.parsecCs|j|dSr)ru setLocale)r"Zlocaler r r r9szXMLFilterBase.setLocalecCs |j|Sr)ru getFeaturer!r r r r<szXMLFilterBase.getFeaturecCs|j||dSr)ru setFeature)r"r#stater r r r?szXMLFilterBase.setFeaturecCs |j|Sr)ru getPropertyr!r r r rBszXMLFilterBase.getPropertycCs|j||dSr)ru setProperty)r"r#r r r r rEszXMLFilterBase.setPropertycCs|jSrrurZr r r getParentJszXMLFilterBase.getParentcCs ||_dSrrrvr r r setParentMszXMLFilterBase.setParent)N) r'r(r)__doc__rJryr{r|r~r[r\rarcrfrXrirkrnrorrrrrrrrrrrrrrr r r r rss: rscCs$t|tjrt|}t|tr,t|}n^t|dr|}t}t|dtr^| |n | |t|drt|j tr| |j | dkr |dkr |}tjtj|}tj||}tj|r| |t|d}n$| tj||tj|}| ||S)zThis function takes an InputSource and an optional base URL and returns a fully resolved InputSource object ready for reading.readrr#Nrb)r5osPathLikefspathrlrZ InputSourcehasattrrZsetCharacterStreamZ setByteStreamr#Z setSystemIdZgetCharacterStreamZ getByteStreamZ getSystemIdpathdirnamenormpathjoinisfileopenurllibrZurljoinZrequestZurlopen)rbasefZsysidZbaseheadZ sysidfilenamer r r prepare_input_sourceRs.            r)r)rrZ urllib.parserZurllib.requestr6r8rrrr rrrrErIrFrtrsrr r r r s     )soPK]G2& #__pycache__/__init__.cpython-38.pycnu[U e5d?@s dZddlmZddlmZmZddlmZmZm Z m Z m Z efddZ efddZ d gZd Zernd d lZd d lZd d lZejjsd ejkrejd d Z[dZejd ddkrejerejed ZdddZejd ddkrddZnddZ[d S)aSimple API for XML (SAX) implementation for Python. This module provides an implementation of the SAX 2 interface; information about the Java version of the interface can be found at http://www.megginson.com/SAX/. The Python version of the interface is documented at <...>. This package contains the following modules: handler -- Base classes and constants which define the SAX 2 API for the 'client-side' of SAX for Python. saxutils -- Implementation of the convenience classes commonly used to work with SAX. xmlreader -- Base classes and constants which define the SAX 2 API for the parsers used with SAX for Python. expatreader -- Driver that allows use of the Expat parser with SAX. ) InputSource)ContentHandler ErrorHandler) SAXExceptionSAXNotRecognizedExceptionSAXParseExceptionSAXNotSupportedExceptionSAXReaderNotAvailablecCs(t}||||||dS)N) make_parsersetContentHandlersetErrorHandlerparse)sourcehandler errorHandlerparserr(/usr/lib64/python3.8/xml/sax/__init__.pyr s  r cCspddl}|dkrt}t}||||t}t|trR|| |n| | || |dS)N) iorr r r r isinstancestrZsetCharacterStreamStringIOZ setByteStreamBytesIOr )stringrrrrZinpsrcrrr parseString#s   rzxml.sax.expatreaderrNZ PY_SAX_PARSER,zpython.xml.sax.parserjavarc Csxt|tD]\}zt|WStk rT}zddl}||jkrDW5d}~XYq tk rfYq Xq tdddS)a3Creates and returns a SAX parser. Creates the first parser it is able to instantiate of the ones given in the iterable created by chaining parser_list and default_parser_list. The iterables must contain the names of Python modules containing both a SAX parser and a create_parser function.rNzNo parsers found)listdefault_parser_list_create_parser ImportErrorsysmodulesr )Z parser_list parser_nameer#rrrr Fs r cCs$ddlm}||dt}|S)Nr)imp)Zorg.python.corer'Z importNameglobals create_parser)r%r' drv_modulerrrr!as r!cCst|iidg}|S)Nr)) __import__r))r%r*rrrr!gs)r)__doc__Z xmlreaderrrrr _exceptionsrrrrr r rr _falseZxml.sax.expatreaderZxmlosr#flagsignore_environmentenvironsplitZ_keyplatformregistryZ containsKeyZ getPropertyr r!rrrrs*   PK]6/6/,__pycache__/expatreader.cpython-38.opt-2.pycnu[U e5dX=@sdZddlTddlmZmZddlmZddlmZmZddlmZddlm Z m Z ddl Z e j dd d krxe d d[ zdd lmZWnek re d dYnXeedse d dddlmZmZmZejZejZz ddlZWnek rddZYnXddlZejZ[[GdddZGdddejZGdddejejZ ddZ!e"dkrddl#Z$e!Z%e%&e$j'j(e%)e$j'*e%+ddS)z0.20)*)feature_validationfeature_namespaces)feature_namespace_prefixes)feature_external_gesfeature_external_pes)feature_string_interning)property_xml_stringproperty_interning_dictNjavazexpat not available in Java)expatzexpat not supported ParserCreate) xmlreadersaxutilshandlercCs|SN)orr+/usr/lib64/python3.8/xml/sax/expatreader.py_mkproxy'src@s eZdZdS) _ClosedParserN)__name__ __module__ __qualname__rrrrr.src@s4eZdZddZddZddZddZd d Zd S) ExpatLocatorcCst||_dSr)r_refselfparserrrr__init__9szExpatLocator.__init__cCs|j}|jdkrdS|jjSr)r_parserErrorColumnNumberrrrrgetColumnNumber<s zExpatLocator.getColumnNumbercCs|j}|jdkrdS|jjSN)rr!ErrorLineNumberrrrr getLineNumberBs zExpatLocator.getLineNumbercCs|j}|dkrdS|jSr)r_source getPublicIdrrrrr)HszExpatLocator.getPublicIdcCs|j}|dkrdS|jSr)rr( getSystemIdrrrrr*NszExpatLocator.getSystemIdN)rrrr r#r'r)r*rrrrr3s rc@seZdZdBddZddZddZd d Zd d Zd dZddZ ddZ dCddZ ddZ ddZ ddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Zd=d>Z d?d@Z!dAS)D ExpatParserrcCsFtj||t|_d|_||_d|_d|_g|_ d|_ d|_ dS)Nr) rIncrementalParserr Z InputSourcer(r! _namespaces_lex_handler_prop_parsing _entity_stack _external_ges _interning)rZnamespaceHandlingbufsizerrrr Zs zExpatParser.__init__cCsVt|}||_z*||jt|tj ||Wn| YnXdSr) rprepare_input_sourcer(reset _cont_handlerZsetDocumentLocatorrrr-parse _close_sourcersourcerrrr8gs zExpatParser.parsecCs |dk r|j|dSr)r*r!ZSetBaser:rrr prepareParserws zExpatParser.prepareParsercCs tj|||jr|dSr)rr-setContentHandlerr0_reset_cont_handler)rrrrrr=}szExpatParser.setContentHandlercCsP|tkr|jS|tkr |jdk S|tttfkr2dS|tkr@|jSt d|dS)NrFeature '%s' not recognized) rr.rr3rrrrr2SAXNotRecognizedExceptionrnamerrr getFeatures zExpatParser.getFeaturecCs|jrtd|tkr||_n|tkr.||_nt|tkrT|rL|jdkrRi|_qd|_nN|tkrj|rtdn8|t kr|rtdn"|t kr|rtdn t d|dS)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixesr?) r0SAXNotSupportedExceptionrr.rr2rr3rrrr@)rrBstaterrr setFeatures: zExpatParser.setFeaturecCsd|tjkr|jS|tkr|jS|tkrT|jrLt|jdrB|jSt dnt dt d|dS)NGetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsingProperty '%s' not recognized) rproperty_lexical_handlerr/r r3r r!hasattrrGr@rDrArrr getPropertys   zExpatParser.getPropertycCsV|tjkr ||_|jrR|n2|tkr0||_n"|tkrFtd|n t d|dS)NzProperty '%s' cannot be setrH) rrIr/r0_reset_lex_handler_propr r3r rDr@)rrBvaluerrr setPropertys  zExpatParser.setPropertyc Csz|js|d|_|jz|j||WnDtjk rt}z$tt |j ||}|j |W5d}~XYnXdSr$) r0r6r7Z startDocumentr!ZParser errorZSAXParseExceptionZ ErrorStringcodeZ _err_handlerZ fatalError)rdataisFinaleexcrrrfeeds zExpatParser.feedcCsB|j}z|}|dk r |W5|}|dk r<|XdSr)r(Z getByteStreamcloseZgetCharacterStream)rr;filerrrr9s zExpatParser._close_sourcecCs|js|jdkst|jtr dSz(|jddd|j d|_d|_W5d|_|jdk rzt}|jj|_|jj|_||_|XdS)Nrr%)rR) r1r! isinstancerr0r"r&r9rUr7Z endDocumentrrrrrVs       zExpatParser.closecCs|jj|j_|jj|j_dSr)r7processingInstructionr!ZProcessingInstructionHandler charactersZCharacterDataHandlerrrrrr>szExpatParser._reset_cont_handlercCs`|j}|j}|dkr4d|_d|_d|_d|_d|_n(|j|_|j|_|j |_|j |_|j |_dSr) r/r!ZCommentHandlerZStartCdataSectionHandlerZEndCdataSectionHandlerZStartDoctypeDeclHandlerZEndDoctypeDeclHandlerZcommentZ startCDATAZendCDATAstart_doctype_declZendDTD)rZlexrrrrrLsz#ExpatParser._reset_lex_handler_propcCs|jr>tj|jd|jd|_d|j_|j|j_ |j |j_ n,tj|j|jd|_|j |j_ |j |j_ ||j|j_|j|j_|j|j_|j|j_d|_|jr||j|j_z|j|j_Wntk rYnX|jtj d|_!g|_"dS)N )internr%r)#r.r rr(Z getEncodingr3r!Znamespace_prefixesstart_element_nsZStartElementHandlerend_element_nsZEndElementHandler start_element end_elementr>unparsed_entity_declZUnparsedEntityDeclHandler notation_declZNotationDeclHandlerstart_namespace_declZStartNamespaceDeclHandlerend_namespace_declZEndNamespaceDeclHandlerZ_decl_handler_propr/rLexternal_entity_refZExternalEntityRefHandlerskipped_entity_handlerZSkippedEntityHandlerAttributeErrorZSetParamEntityParsingZ*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr0r1r\rrrr6s<          zExpatParser.resetcCs|jdkrdS|jjSr)r!r"r\rrrr#;s zExpatParser.getColumnNumbercCs|jdkrdS|jjSr$)r!r&r\rrrr'@s zExpatParser.getLineNumbercCs |jSr)r(r)r\rrrr)EszExpatParser.getPublicIdcCs |jSr)r(r*r\rrrr*HszExpatParser.getSystemIdcCs|j|t|dSr)r7Z startElementAttributesImpl)rrBattrsrrrrbLszExpatParser.start_elementcCs|j|dSr)r7Z endElementrArrrrcOszExpatParser.end_elementc Cs|}t|dkrd|f}n&t|dkr<|d|df}nt|}i}i}|D]|\}}|}t|} | dkr|} d|f} n>| dkrd|d|df} |d|df} n|d} t|} ||| <| || <qT|j|dt||dS)Nr%rz%s:%s)splitlentupleitemsr7ZstartElementNSAttributesNSImpl) rrBrlpairZnewattrsZqnamesZanamerMpartsZlengthZqnameZapairrrrr`Rs0      zExpatParser.start_element_nscCsV|}t|dkrd|f}n&t|dkr<|d|df}nt|}|j|ddS)Nr%rmr)rorprqr7Z endElementNS)rrBrtrrrrats   zExpatParser.end_element_nscCs|j||dSr)r7rZ)rtargetrQrrrprocessing_instructionsz"ExpatParser.processing_instructioncCs|j|dSr)r7r[)rrQrrrcharacter_dataszExpatParser.character_datacCs|j||dSr)r7ZstartPrefixMapping)rprefixZurirrrrfsz ExpatParser.start_namespace_declcCs|j|dSr)r7ZendPrefixMapping)rryrrrrgszExpatParser.end_namespace_declcCs|j|||dSr)r/ZstartDTD)rrBsysidpubidZhas_internal_subsetrrrr]szExpatParser.start_doctype_declcCs|j||||dSr) _dtd_handlerZunparsedEntityDecl)rrBbaserzr{Z notation_namerrrrdsz ExpatParser.unparsed_entity_declcCs|j|||dSr)r|Z notationDecl)rrBr}rzr{rrrreszExpatParser.notation_declcCs|js dS|j||}t||jp*d}|j|j |jf|j ||_ ||_zt j ||WnYdSX|jd\|_ |_|jd=dS)Nr%rXr)r2Z _ent_handlerZ resolveEntityrr5r(r*r1appendr!ZExternalEntityParserCreaterr-r8)rcontextr}rzr{r;rrrrhs" zExpatParser.external_entity_refcCs|r d|}|j|dS)N%)r7Z skippedEntity)rrBZis_perrrrisz"ExpatParser.skipped_entity_handlerN)rr,)r)"rrrr r8r<r=rCrFrKrNrUr9rVr>rLr6r#r'r)r*rbrcr`rarwrxrfrgr]rdrerhrirrrrr+Ws>    '" r+cOs t||Sr)r+)argskwargsrrr create_parsersr__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml),versionZxml.sax._exceptionsZxml.sax.handlerrrrrrrr r sysplatformZSAXReaderNotAvailableZ xml.parsersr ImportErrorrJZxml.saxrrrrkrs_weakrefrweakrefproxyrZLocatorrr-r+rrZxml.sax.saxutilsZxmlpr=ZsaxZ XMLGeneratorZsetErrorHandlerZ ErrorHandlerr8rrrrsL      $_ PK]s`  ,__pycache__/_exceptions.cpython-38.opt-2.pycnu[U e5d@s|ddlZejdddkr&ddlmZ[GdddeZGdddeZGd d d eZGd d d eZGd ddeZdS)Njava) Exceptionc@s6eZdZd ddZddZddZdd Zd d ZdS) SAXExceptionNcCs||_||_t||dSN)_msg _exceptionr__init__)selfmsg exceptionr +/usr/lib64/python3.8/xml/sax/_exceptions.pyr szSAXException.__init__cCs|jSrrr r r r getMessageszSAXException.getMessagecCs|jSr)rrr r r getExceptionszSAXException.getExceptioncCs|jSrrrr r r__str__"szSAXException.__str__cCs tddS)N __getitem__)AttributeError)r Zixr r rr&szSAXException.__getitem__)N)__name__ __module__ __qualname__r rrrrr r r rr s  rc@s<eZdZddZddZddZddZd d Zd d Zd S)SAXParseExceptioncCs<t|||||_|j|_|j|_|j|_dSr) rr _locator getSystemId _systemIdgetColumnNumber_colnum getLineNumber_linenum)r r r Zlocatorr r rr ;s   zSAXParseException.__init__cCs|jSr)rrr r rrHsz!SAXParseException.getColumnNumbercCs|jSr)r rr r rrMszSAXParseException.getLineNumbercCs |jSr)r getPublicIdrr r rr!QszSAXParseException.getPublicIdcCs|jSr)rrr r rrUszSAXParseException.getSystemIdcCsN|}|dkrd}|}|dkr(d}|}|dkr?z %s:%s:%s: %s)rrrr)r ZsysidZlinenumZcolnumr r rrYszSAXParseException.__str__N) rrrr rrr!rrr r r rr.s   rc@s eZdZdS)SAXNotRecognizedExceptionNrrrr r r rr#isr#c@s eZdZdS)SAXNotSupportedExceptionNr$r r r rr%ssr%c@s eZdZdS)SAXReaderNotAvailableNr$r r r rr&}sr&) sysplatformZ java.langrrrr#r%r&r r r rs %;  PK]dTۈ00(__pycache__/handler.cpython-38.opt-1.pycnu[U e5db6@sdZdZGdddZGdddZGdddZGdd d Zd Zd Zd Zd Z dZ dZ eeee e e gZ dZ dZdZdZdZdZe eeeeegZdS)a0 This module contains the core classes of version 2.0 of SAX for Python. This file provides only default classes with absolutely minimum functionality, from which drivers and applications can be subclassed. Many of these classes are empty and are included only as documentation of the interfaces. $Id$ z2.0betac@s(eZdZdZddZddZddZdS) ErrorHandleraBasic interface for SAX error handlers. If you create an object that implements this interface, then register the object with your XMLReader, the parser will call the methods in your object to report all warnings and errors. There are three levels of errors available: warnings, (possibly) recoverable errors, and unrecoverable errors. All methods take a SAXParseException as the only parameter.cCs|dS)zHandle a recoverable error.NselfZ exceptionrr'/usr/lib64/python3.8/xml/sax/handler.pyerror szErrorHandler.errorcCs|dS)zHandle a non-recoverable error.Nrrrrr fatalError$szErrorHandler.fatalErrorcCs t|dS)zHandle a warning.N)printrrrrwarning(szErrorHandler.warningN)__name__ __module__ __qualname____doc__rrr rrrrrs rc@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZdS)ContentHandlerzInterface for receiving logical document content events. This is the main callback interface in SAX, and the one most important to applications. The order of events in this interface mirrors the order of the information in the document.cCs d|_dS)NZ_locatorrrrr__init__6szContentHandler.__init__cCs ||_dS)a#Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface. The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine. Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.Nr)rZlocatorrrrsetDocumentLocator9sz!ContentHandler.setDocumentLocatorcCsdS)zReceive notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).Nrrrrr startDocumentPszContentHandler.startDocumentcCsdS)aQReceive notification of the end of a document. The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.Nrrrrr endDocumentWszContentHandler.endDocumentcCsdS)aBegin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default). There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary. Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.Nr)rprefixZurirrrstartPrefixMapping`sz!ContentHandler.startPrefixMappingcCsdS)zEnd the scope of a prefix-URI mapping. See startPrefixMapping for details. This event will always occur after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.Nr)rrrrrendPrefixMappingwszContentHandler.endPrefixMappingcCsdS)aSignals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an instance of the Attributes class containing the attributes of the element.Nr)rnameattrsrrr startElement~szContentHandler.startElementcCsdS)zSignals the end of an element in non-namespace mode. The name parameter contains the name of the element type, just as with the startElement event.Nrrrrrr endElementszContentHandler.endElementcCsdS)aSignals the start of an element in namespace mode. The name parameter contains the name of the element type as a (uri, localname) tuple, the qname parameter the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the Attributes class containing the attributes of the element. The uri part of the name tuple is None for elements which have no namespace.Nr)rrqnamerrrrstartElementNSszContentHandler.startElementNScCsdS)zSignals the end of an element in namespace mode. The name parameter contains the name of the element type, just as with the startElementNS event.Nr)rrrrrr endElementNSszContentHandler.endElementNScCsdS)aReceive notification of character data. The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.Nr)rZcontentrrr charactersszContentHandler.characterscCsdS)awReceive notification of ignorable whitespace in element content. Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.Nr)rZ whitespacerrrignorableWhitespacesz"ContentHandler.ignorableWhitespacecCsdS)aReceive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.Nr)rtargetdatarrrprocessingInstructionsz$ContentHandler.processingInstructioncCsdS)aReceive notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.Nrrrrr skippedEntityszContentHandler.skippedEntityN)r r r r rrrrrrrrrrr r!r$r%rrrrr/s    rc@s eZdZdZddZddZdS) DTDHandlerzHandle DTD events. This interface specifies only those DTD events required for basic parsing (unparsed entities and attributes).cCsdS)z$Handle a notation declaration event.Nr)rrpublicIdsystemIdrrr notationDeclszDTDHandler.notationDeclcCsdS)z,Handle an unparsed entity declaration event.Nr)rrr'r(ZndatarrrunparsedEntityDeclszDTDHandler.unparsedEntityDeclN)r r r r r)r*rrrrr&sr&c@seZdZdZddZdS)EntityResolvera7Basic interface for resolving entities. If you create an object implementing this interface, then register the object with your Parser, the parser will call the method in your object to resolve all external entities. Note that DefaultHandler implements this interface with the default behaviour.cCs|S)zResolve the system identifier of an entity and return either the system identifier to read from as a string, or an InputSource to read from.r)rr'r(rrr resolveEntityszEntityResolver.resolveEntityN)r r r r r,rrrrr+sr+z&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictN)r versionrrr&r+Zfeature_namespacesZfeature_namespace_prefixesZfeature_string_interningZfeature_validationZfeature_external_gesZfeature_external_pesZ all_featuresZproperty_lexical_handlerZproperty_declaration_handlerZproperty_dom_nodeZproperty_xml_stringZproperty_encodingZproperty_interning_dictZall_propertiesrrrrs@  " PK] FF,__pycache__/_exceptions.cpython-38.opt-1.pycnu[U e5d@sdZddlZejdddkr*ddlmZ[GdddeZGdd d eZGd d d eZGd d d eZGdddeZ dS)z!Different kinds of SAX ExceptionsNjava) Exceptionc@s:eZdZdZd ddZddZddZd d Zd d ZdS) SAXExceptionaEncapsulate an XML error or warning. This class can contain basic error or warning information from either the XML parser or the application: you can subclass it to provide additional functionality, or to add localization. Note that although you will receive a SAXException as the argument to the handlers in the ErrorHandler interface, you are not actually required to raise the exception; instead, you can simply read the information in it.NcCs||_||_t||dS)zUCreates an exception. The message is required, but the exception is optional.N)_msg _exceptionr__init__)selfmsg exceptionr +/usr/lib64/python3.8/xml/sax/_exceptions.pyrszSAXException.__init__cCs|jS)z$Return a message for this exception.rr r r r getMessageszSAXException.getMessagecCs|jS)z9Return the embedded exception, or None if there was none.)rrr r r getExceptionszSAXException.getExceptioncCs|jS)0Create a string representation of the exception.rrr r r __str__"szSAXException.__str__cCs tddS)zvAvoids weird error messages if someone does exception[ix] by mistake, since Exception has __getitem__ defined. __getitem__N)AttributeError)r Zixr r r r&szSAXException.__getitem__)N) __name__ __module__ __qualname____doc__rrrrrr r r r r s  rc@s@eZdZdZddZddZddZdd Zd d Zd d Z dS)SAXParseExceptiona#Encapsulate an XML parse error or warning. This exception will include information for locating the error in the original XML document. Note that although the application will receive a SAXParseException as the argument to the handlers in the ErrorHandler interface, the application is not actually required to raise the exception; instead, it can simply read the information in it and take a different action. Since this exception is a subclass of SAXException, it inherits the ability to wrap another exception.cCs<t|||||_|j|_|j|_|j|_dS)zECreates the exception. The exception parameter is allowed to be None.N) rr_locator getSystemId _systemIdgetColumnNumber_colnum getLineNumber_linenum)r r r Zlocatorr r r r;s   zSAXParseException.__init__cCs|jS)zNThe column number of the end of the text where the exception occurred.)rrr r r rHsz!SAXParseException.getColumnNumbercCs|jS)zDThe line number of the end of the text where the exception occurred.)r!rr r r r MszSAXParseException.getLineNumbercCs |jS)zEGet the public identifier of the entity where the exception occurred.)r getPublicIdrr r r r"QszSAXParseException.getPublicIdcCs|jS)zEGet the system identifier of the entity where the exception occurred.)rrr r r rUszSAXParseException.getSystemIdcCsN|}|dkrd}|}|dkr(d}|}|dkr?z %s:%s:%s: %s)rr rr)r ZsysidZlinenumZcolnumr r r rYszSAXParseException.__str__N) rrrrrrr r"rrr r r r r.s  rc@seZdZdZdS)SAXNotRecognizedExceptionzException class for an unrecognized identifier. An XMLReader will raise this exception when it is confronted with an unrecognized feature or property. SAX applications and extensions may use this class for similar purposes.Nrrrrr r r r r$isr$c@seZdZdZdS)SAXNotSupportedExceptionaException class for an unsupported operation. An XMLReader will raise this exception when a service it cannot perform is requested (specifically setting a state or value). SAX applications and extensions may use this class for similar purposes.Nr%r r r r r&ssr&c@seZdZdZdS)SAXReaderNotAvailableaException class for a missing driver. An XMLReader module (driver) should raise this exception when it is first imported, e.g. when a support module cannot be imported. It also may be raised during parsing, e.g. if executing an external program is not permitted.Nr%r r r r r'}sr') rsysplatformZ java.langrrrr$r&r'r r r r s %;  PK]e=--(__pycache__/handler.cpython-38.opt-2.pycnu[U e5db6@sdZGdddZGdddZGdddZGdddZd Zd Zd Zd Zd Z dZ eeeee e gZ dZ dZ dZdZdZdZe ee eeegZdS)z2.0betac@s$eZdZddZddZddZdS) ErrorHandlercCs|dSNselfZ exceptionrr'/usr/lib64/python3.8/xml/sax/handler.pyerror szErrorHandler.errorcCs|dSrrrrrr fatalError$szErrorHandler.fatalErrorcCs t|dSr)printrrrrwarning(szErrorHandler.warningN)__name__ __module__ __qualname__rrr rrrrrs rc@s|eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZdS)ContentHandlercCs d|_dSrZ_locatorrrrr__init__6szContentHandler.__init__cCs ||_dSrr)rZlocatorrrrsetDocumentLocator9sz!ContentHandler.setDocumentLocatorcCsdSrrrrrr startDocumentPszContentHandler.startDocumentcCsdSrrrrrr endDocumentWszContentHandler.endDocumentcCsdSrr)rprefixZurirrrstartPrefixMapping`sz!ContentHandler.startPrefixMappingcCsdSrr)rrrrrendPrefixMappingwszContentHandler.endPrefixMappingcCsdSrr)rnameattrsrrr startElement~szContentHandler.startElementcCsdSrrrrrrr endElementszContentHandler.endElementcCsdSrr)rrqnamerrrrstartElementNSszContentHandler.startElementNScCsdSrr)rrrrrr endElementNSszContentHandler.endElementNScCsdSrr)rZcontentrrr charactersszContentHandler.characterscCsdSrr)rZ whitespacerrrignorableWhitespacesz"ContentHandler.ignorableWhitespacecCsdSrr)rtargetdatarrrprocessingInstructionsz$ContentHandler.processingInstructioncCsdSrrrrrr skippedEntityszContentHandler.skippedEntityN)r r r rrrrrrrrrrr r!r$r%rrrrr/s    rc@seZdZddZddZdS) DTDHandlercCsdSrr)rrpublicIdsystemIdrrr notationDeclszDTDHandler.notationDeclcCsdSrr)rrr'r(ZndatarrrunparsedEntityDeclszDTDHandler.unparsedEntityDeclN)r r r r)r*rrrrr&sr&c@seZdZddZdS)EntityResolvercCs|Srr)rr'r(rrr resolveEntityszEntityResolver.resolveEntityN)r r r r,rrrrr+sr+z&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictN)versionrrr&r+Zfeature_namespacesZfeature_namespace_prefixesZfeature_string_interningZfeature_validationZfeature_external_gesZfeature_external_pesZ all_featuresZproperty_lexical_handlerZproperty_declaration_handlerZproperty_dom_nodeZproperty_xml_stringZproperty_encodingZproperty_interning_dictZall_propertiesrrrr s> " PK](00,__pycache__/expatreader.cpython-38.opt-1.pycnu[U e5dX=@sdZdZddlTddlmZmZddlmZddlmZmZddlm Z ddlm Z m Z dd l Z e j d d d kr|ed d [ zdd lmZWnek redd YnXeedsedd ddlmZmZmZejZejZz dd lZWnek r ddZYnXdd lZejZ[[GdddZGdddejZGdddej ejZ!ddZ"e#dkrdd l$Z%e"Z&e&'e%j(j)e&*e%j(+e&,dd S)z] SAX driver for the pyexpat C module. This driver works with pyexpat.__version__ == '2.22'. z0.20)*)feature_validationfeature_namespaces)feature_namespace_prefixes)feature_external_gesfeature_external_pes)feature_string_interning)property_xml_stringproperty_interning_dictNjavazexpat not available in Java)expatzexpat not supported ParserCreate) xmlreadersaxutilshandlercCs|SN)orr+/usr/lib64/python3.8/xml/sax/expatreader.py_mkproxy'src@s eZdZdS) _ClosedParserN)__name__ __module__ __qualname__rrrrr.src@s8eZdZdZddZddZddZdd Zd d Zd S) ExpatLocatorzLocator for use with the ExpatParser class. This uses a weak reference to the parser object to avoid creating a circular reference between the parser and the content handler. cCst||_dSr)r_refselfparserrrr__init__9szExpatLocator.__init__cCs|j}|jdkrdS|jjSr)r_parserErrorColumnNumberrrrrgetColumnNumber<s zExpatLocator.getColumnNumbercCs|j}|jdkrdS|jjSN)rr!ErrorLineNumberrrrr getLineNumberBs zExpatLocator.getLineNumbercCs|j}|dkrdS|jSr)r_source getPublicIdrrrrr)HszExpatLocator.getPublicIdcCs|j}|dkrdS|jSr)rr( getSystemIdrrrrr*NszExpatLocator.getSystemIdN) rrr__doc__r r#r'r)r*rrrrr3s rc@s eZdZdZdCddZddZdd Zd d Zd d ZddZ ddZ ddZ dDddZ ddZ ddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Zdd?Z!d@dAZ"dBS)E ExpatParserz$SAX driver for the pyexpat C module.rcCsFtj||t|_d|_||_d|_d|_g|_ d|_ d|_ dS)Nr) rIncrementalParserr Z InputSourcer(r! _namespaces_lex_handler_prop_parsing _entity_stack _external_ges _interning)rZnamespaceHandlingbufsizerrrr Zs zExpatParser.__init__cCsVt|}||_z*||jt|tj ||Wn| YnXdS)z3Parse an XML document from a URL or an InputSource.N) rprepare_input_sourcer(reset _cont_handlerZsetDocumentLocatorrrr.parse _close_sourcersourcerrrr9gs zExpatParser.parsecCs |dk r|j|dSr)r*r!ZSetBaser;rrr prepareParserws zExpatParser.prepareParsercCs tj|||jr|dSr)rr.setContentHandlerr1_reset_cont_handler)rrrrrr>}szExpatParser.setContentHandlercCsP|tkr|jS|tkr |jdk S|tttfkr2dS|tkr@|jSt d|dS)NrFeature '%s' not recognized) rr/rr4rrrrr3SAXNotRecognizedExceptionrnamerrr getFeatures zExpatParser.getFeaturecCs|jrtd|tkr||_n|tkr.||_nt|tkrT|rL|jdkrRi|_qd|_nN|tkrj|rtdn8|t kr|rtdn"|t kr|rtdn t d|dS)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixesr@) r1SAXNotSupportedExceptionrr/rr3rr4rrrrA)rrCstaterrr setFeatures: zExpatParser.setFeaturecCsd|tjkr|jS|tkr|jS|tkrT|jrLt|jdrB|jSt dnt dt d|dS)NGetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsingProperty '%s' not recognized) rproperty_lexical_handlerr0r r4r r!hasattrrHrArErBrrr getPropertys   zExpatParser.getPropertycCsV|tjkr ||_|jrR|n2|tkr0||_n"|tkrFtd|n t d|dS)NzProperty '%s' cannot be setrI) rrJr0r1_reset_lex_handler_propr r4r rErA)rrCvaluerrr setPropertys  zExpatParser.setPropertyc Csz|js|d|_|jz|j||WnDtjk rt}z$tt |j ||}|j |W5d}~XYnXdSr$) r1r7r8Z startDocumentr!ZParser errorZSAXParseExceptionZ ErrorStringcodeZ _err_handlerZ fatalError)rdataisFinaleexcrrrfeeds zExpatParser.feedcCsB|j}z|}|dk r |W5|}|dk r<|XdSr)r(Z getByteStreamcloseZgetCharacterStream)rr<filerrrr:s zExpatParser._close_sourcecCs|js|jdkst|jtr dSz(|jddd|j d|_d|_W5d|_|jdk rzt}|jj|_|jj|_||_|XdS)Nrr%)rS) r2r! isinstancerr1r"r&r:rVr8Z endDocumentrrrrrWs       zExpatParser.closecCs|jj|j_|jj|j_dSr)r8processingInstructionr!ZProcessingInstructionHandler charactersZCharacterDataHandlerrrrrr?szExpatParser._reset_cont_handlercCs`|j}|j}|dkr4d|_d|_d|_d|_d|_n(|j|_|j|_|j |_|j |_|j |_dSr) r0r!ZCommentHandlerZStartCdataSectionHandlerZEndCdataSectionHandlerZStartDoctypeDeclHandlerZEndDoctypeDeclHandlerZcommentZ startCDATAZendCDATAstart_doctype_declZendDTD)rZlexrrrrrMsz#ExpatParser._reset_lex_handler_propcCs|jr>tj|jd|jd|_d|j_|j|j_ |j |j_ n,tj|j|jd|_|j |j_ |j |j_ ||j|j_|j|j_|j|j_|j|j_d|_|jr||j|j_z|j|j_Wntk rYnX|jtj d|_!g|_"dS)N )internr%r)#r/r rr(Z getEncodingr4r!Znamespace_prefixesstart_element_nsZStartElementHandlerend_element_nsZEndElementHandler start_element end_elementr?unparsed_entity_declZUnparsedEntityDeclHandler notation_declZNotationDeclHandlerstart_namespace_declZStartNamespaceDeclHandlerend_namespace_declZEndNamespaceDeclHandlerZ_decl_handler_propr0rMexternal_entity_refZExternalEntityRefHandlerskipped_entity_handlerZSkippedEntityHandlerAttributeErrorZSetParamEntityParsingZ*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr1r2r]rrrr7s<          zExpatParser.resetcCs|jdkrdS|jjSr)r!r"r]rrrr#;s zExpatParser.getColumnNumbercCs|jdkrdS|jjSr$)r!r&r]rrrr'@s zExpatParser.getLineNumbercCs |jSr)r(r)r]rrrr)EszExpatParser.getPublicIdcCs |jSr)r(r*r]rrrr*HszExpatParser.getSystemIdcCs|j|t|dSr)r8Z startElementAttributesImpl)rrCattrsrrrrcLszExpatParser.start_elementcCs|j|dSr)r8Z endElementrBrrrrdOszExpatParser.end_elementc Cs|}t|dkrd|f}n&t|dkr<|d|df}nt|}i}i}|D]|\}}|}t|} | dkr|} d|f} n>| dkrd|d|df} |d|df} n|d} t|} ||| <| || <qT|j|dt||dS)Nr%rz%s:%s)splitlentupleitemsr8ZstartElementNSAttributesNSImpl) rrCrmpairZnewattrsZqnamesZanamerNpartsZlengthZqnameZapairrrrraRs0      zExpatParser.start_element_nscCsV|}t|dkrd|f}n&t|dkr<|d|df}nt|}|j|ddS)Nr%rnr)rprqrrr8Z endElementNS)rrCrurrrrbts   zExpatParser.end_element_nscCs|j||dSr)r8r[)rtargetrRrrrprocessing_instructionsz"ExpatParser.processing_instructioncCs|j|dSr)r8r\)rrRrrrcharacter_dataszExpatParser.character_datacCs|j||dSr)r8ZstartPrefixMapping)rprefixZurirrrrgsz ExpatParser.start_namespace_declcCs|j|dSr)r8ZendPrefixMapping)rrzrrrrhszExpatParser.end_namespace_declcCs|j|||dSr)r0ZstartDTD)rrCsysidpubidZhas_internal_subsetrrrr^szExpatParser.start_doctype_declcCs|j||||dSr) _dtd_handlerZunparsedEntityDecl)rrCbaser{r|Z notation_namerrrresz ExpatParser.unparsed_entity_declcCs|j|||dSr)r}Z notationDecl)rrCr~r{r|rrrrfszExpatParser.notation_declcCs|js dS|j||}t||jp*d}|j|j |jf|j ||_ ||_zt j ||WnYdSX|jd\|_ |_|jd=dS)Nr%rYr)r3Z _ent_handlerZ resolveEntityrr6r(r*r2appendr!ZExternalEntityParserCreaterr.r9)rcontextr~r{r|r<rrrris" zExpatParser.external_entity_refcCs|r d|}|j|dS)N%)r8Z skippedEntity)rrCZis_perrrrjsz"ExpatParser.skipped_entity_handlerN)rr-)r)#rrrr+r r9r=r>rDrGrLrOrVr:rWr?rMr7r#r'r)r*rcrdrarbrxryrgrhr^rerfrirjrrrrr,Ws@    '" r,cOs t||Sr)r,)argskwargsrrr create_parsersr__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml)-r+versionZxml.sax._exceptionsZxml.sax.handlerrrrrrrr r sysplatformZSAXReaderNotAvailableZ xml.parsersr ImportErrorrKZxml.saxrrrrlrt_weakrefrweakrefproxyrZLocatorrr.r,rrZxml.sax.saxutilsZxmlpr>ZsaxZ XMLGeneratorZsetErrorHandlerZ ErrorHandlerr9rrrrsN      $_ PK]|Ik-,,)__pycache__/saxutils.cpython-38.opt-2.pycnu[U e5d/@sddlZddlZddlZddlZddlZddlmZddlmZddZ ifddZ ifd d Z ifd d Z d dZ GdddejZGdddejZdddZdS)N)handler) xmlreadercCs"|D]\}}|||}q|SN)itemsreplace)sdkeyvaluer (/usr/lib64/python3.8/xml/sax/saxutils.py__dict_replace srcCs6|dd}|dd}|dd}|r2t||}|S)N&&>><<rrdataZentitiesr r r escapes    rcCs2|dd}|dd}|r&t||}|ddS)Nrrrrrrrrr r r unescape"s    rcCsR|dddd}t||}d|krFd|kr._wrappercs t|Sr)getattrselfnameoutr r __getattr__Zsz,_gettextwriter.._wrapper.__getattr__N)__name__ __module__ __qualname__ __class__r&r r$r r _wrapperXsr+cSsdSrr r r r r ]z _gettextwriter..cSsdS)NTr r r r r r,br-xmlcharrefreplacerT)encodingerrorsnewline write_through)sysstdout isinstanceio TextIOBasecodecs StreamWriterStreamReaderWriter RawIOBasecloseBufferedIOBasewritablewriteseekabletellAttributeError TextIOWrapper)r%r/r3r+bufferr r$r _gettextwriterGs0     rEc@seZdZd ddZddZd!dd Zd d Zd d ZddZddZ ddZ ddZ ddZ ddZ ddZddZddZdS)" XMLGeneratorN iso-8859-1FcCsVtj|t||}|j|_|j|_ig|_|jd|_ g|_ ||_ ||_ d|_ dS)NF)rContentHandler__init__rEr?_writeflush_flush _ns_contexts_current_context_undeclared_ns_maps _encoding_short_empty_elements_pending_start_element)r"r%r/Zshort_empty_elementsr r r rJrs   zXMLGenerator.__init__cCsJ|drBd|dkr d|dS|j|d}|rB|d|dS|dS)Nrz$http://www.w3.org/XML/1998/namespacezxml:r:)rO)r"r#prefixr r r _qname~s  zXMLGenerator._qnamecCs|jr|dd|_dS)NrFrSrK)r" endElementr r r _finish_pending_start_elements z*XMLGenerator._finish_pending_start_elementcCs|d|jdS)Nz$ )rKrQr"r r r startDocumentszXMLGenerator.startDocumentcCs |dSr)rMrZr r r endDocumentszXMLGenerator.endDocumentcCs0|j|j||j|<|j||fdSr)rNappendrOcopyrPr"rUurir r r startPrefixMappings zXMLGenerator.startPrefixMappingcCs|jd|_|jd=dS)NrH)rNrOr"rUr r r endPrefixMappings zXMLGenerator.endPrefixMappingcCsZ||d||D]\}}|d|t|fq|jrLd|_n |ddS)Nr %s=%sTr)rYrKrrrRrS)r"r#attrsr r r r startElementszXMLGenerator.startElementcCs*|jr|dd|_n|d|dSNz/>FzrWr!r r r rXs zXMLGenerator.endElementcCs||d|||jD].\}}|rB|d||fq"|d|q"g|_|D]$\}}|d||t|fq`|jrd|_n |ddS)Nrz xmlns:%s="%s"z xmlns="%s"rdTr)rYrKrVrPrrrRrS)r"r#qnamererUr`r r r r startElementNSszXMLGenerator.startElementNScCs0|jr|dd|_n|d||dSrg)rSrKrVr"r#rhr r r endElementNSs zXMLGenerator.endElementNScCs4|r0|t|ts"t||j}|t|dSr)rYr5strrQrKrr"Zcontentr r r characterss   zXMLGenerator.characterscCs0|r,|t|ts"t||j}||dSr)rYr5rlrQrKrmr r r ignorableWhitespaces   z XMLGenerator.ignorableWhitespacecCs||d||fdS)Nz )rYrKr"targetrr r r processingInstructionsz"XMLGenerator.processingInstruction)NrGF)F)r'r(r)rJrVrYr[r\rarcrfrXrirkrnrorrr r r r rFps   rFc@seZdZd:ddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9ZdS); XMLFilterBaseNcCstj|||_dSr)r XMLReaderrJ_parentr"parentr r r rJs zXMLFilterBase.__init__cCs|j|dSr) _err_handlererrorr"Z exceptionr r r ryszXMLFilterBase.errorcCs|j|dSr)rx fatalErrorrzr r r r{szXMLFilterBase.fatalErrorcCs|j|dSr)rxwarningrzr r r r|szXMLFilterBase.warningcCs|j|dSr) _cont_handlersetDocumentLocator)r"Zlocatorr r r r~sz XMLFilterBase.setDocumentLocatorcCs|jdSr)r}r[rZr r r r[szXMLFilterBase.startDocumentcCs|jdSr)r}r\rZr r r r\szXMLFilterBase.endDocumentcCs|j||dSr)r}rar_r r r rasz XMLFilterBase.startPrefixMappingcCs|j|dSr)r}rcrbr r r rcszXMLFilterBase.endPrefixMappingcCs|j||dSr)r}rf)r"r#rer r r rf szXMLFilterBase.startElementcCs|j|dSr)r}rXr!r r r rXszXMLFilterBase.endElementcCs|j|||dSr)r}ri)r"r#rhrer r r riszXMLFilterBase.startElementNScCs|j||dSr)r}rkrjr r r rkszXMLFilterBase.endElementNScCs|j|dSr)r}rnrmr r r rnszXMLFilterBase.characterscCs|j|dSr)r}ro)r"charsr r r rosz!XMLFilterBase.ignorableWhitespacecCs|j||dSr)r}rrrpr r r rrsz#XMLFilterBase.processingInstructioncCs|j|dSr)r} skippedEntityr!r r r r szXMLFilterBase.skippedEntitycCs|j|||dSr) _dtd_handler notationDecl)r"r#publicIdsystemIdr r r r%szXMLFilterBase.notationDeclcCs|j||||dSr)runparsedEntityDecl)r"r#rrZndatar r r r(sz XMLFilterBase.unparsedEntityDeclcCs|j||Sr)Z _ent_handler resolveEntity)r"rrr r r r-szXMLFilterBase.resolveEntitycCs@|j||j||j||j||j|dSr)ruZsetContentHandlerZsetErrorHandlerZsetEntityResolverZ setDTDHandlerparse)r"sourcer r r r2s     zXMLFilterBase.parsecCs|j|dSr)ru setLocale)r"Zlocaler r r r9szXMLFilterBase.setLocalecCs |j|Sr)ru getFeaturer!r r r r<szXMLFilterBase.getFeaturecCs|j||dSr)ru setFeature)r"r#stater r r r?szXMLFilterBase.setFeaturecCs |j|Sr)ru getPropertyr!r r r rBszXMLFilterBase.getPropertycCs|j||dSr)ru setProperty)r"r#r r r r rEszXMLFilterBase.setPropertycCs|jSrrurZr r r getParentJszXMLFilterBase.getParentcCs ||_dSrrrvr r r setParentMszXMLFilterBase.setParent)N)r'r(r)rJryr{r|r~r[r\rarcrfrXrirkrnrorrrrrrrrrrrrrrr r r r rss8 rscCs$t|tjrt|}t|tr,t|}n^t|dr|}t}t|dtr^| |n | |t|drt|j tr| |j | dkr |dkr |}tjtj|}tj||}tj|r| |t|d}n$| tj||tj|}| ||S)Nreadrr#rb)r5osPathLikefspathrlrZ InputSourcehasattrrZsetCharacterStreamZ setByteStreamr#Z setSystemIdZgetCharacterStreamZ getByteStreamZ getSystemIdpathdirnamenormpathjoinisfileopenurllibrZurljoinZrequestZurlopen)rbasefZsysidZbaseheadZ sysidfilenamer r r prepare_input_sourceRs.            r)r)rZ urllib.parserZurllib.requestr6r8rrrrrrrrErIrFrtrsrr r r r s     )soPK]Z;AA$__pycache__/xmlreader.cpython-38.pycnu[U e5d1@sdZddlmZddlmZmZGdddZGdddeZGdd d ZGd d d Z Gd d d Z Gddde Z ddZ e dkre dS)z]An XML Reader is the SAX 2 name for an XML parser. XML Parsers should be based on this code. )handler)SAXNotSupportedExceptionSAXNotRecognizedExceptionc@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZddZd S)! XMLReadera%Interface for reading an XML document using callbacks. XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse. All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.cCs,t|_t|_t|_t|_dSN) rZContentHandler _cont_handlerZ DTDHandler _dtd_handlerZEntityResolver _ent_handlerZ ErrorHandler _err_handlerselfr )/usr/lib64/python3.8/xml/sax/xmlreader.py__init__s   zXMLReader.__init__cCs tddS)zAParse an XML document from a system identifier or an InputSource. This method must be implemented!NNotImplementedErrorr sourcer r rparseszXMLReader.parsecCs|jS)z#Returns the current ContentHandler.rr r r rgetContentHandler"szXMLReader.getContentHandlercCs ||_dS)z:Registers a new object to receive document content events.Nrr rr r rsetContentHandler&szXMLReader.setContentHandlercCs|jS)z Returns the current DTD handler.rr r r r getDTDHandler*szXMLReader.getDTDHandlercCs ||_dS)z7Register an object to receive basic DTD-related events.Nrrr r r setDTDHandler.szXMLReader.setDTDHandlercCs|jS)z#Returns the current EntityResolver.r r r r rgetEntityResolver2szXMLReader.getEntityResolvercCs ||_dS)z0Register an object to resolve external entities.Nr)r Zresolverr r rsetEntityResolver6szXMLReader.setEntityResolvercCs|jS)z!Returns the current ErrorHandler.r r r r rgetErrorHandler:szXMLReader.getErrorHandlercCs ||_dS)z3Register an object to receive error-message events.Nr rr r rsetErrorHandler>szXMLReader.setErrorHandlercCs tddS)aHAllow an application to set the locale for errors and warnings. SAX parsers are not required to provide localization for errors and warnings; if they cannot support the requested locale, however, they must raise a SAX exception. Applications may request a locale change in the middle of a parse.zLocale support not implementedN)r)r Zlocaler r r setLocaleBszXMLReader.setLocalecCstd|dS)z1Looks up and returns the state of a SAX2 feature.Feature '%s' not recognizedNrr namer r r getFeatureKszXMLReader.getFeaturecCstd|dS)z!Sets the state of a SAX2 feature.r$Nr%)r r'stater r r setFeatureOszXMLReader.setFeaturecCstd|dS)z2Looks up and returns the value of a SAX2 property.Property '%s' not recognizedNr%r&r r r getPropertySszXMLReader.getPropertycCstd|dS)z"Sets the value of a SAX2 property.r+Nr%)r r'valuer r r setPropertyWszXMLReader.setPropertyN)__name__ __module__ __qualname____doc__rrrrrrrrr!r"r#r(r*r,r.r r r rr s   rc@sBeZdZdZdddZddZddZd d Zd d Zd dZ dS)IncrementalParserasThis interface adds three extra methods to the XMLReader interface that allow XML parsers to support incremental parsing. Support for this interface is optional, since not all underlying XML parsers support this functionality. When the parser is instantiated it is ready to begin accepting data from the feed method immediately. After parsing has been finished with a call to close the reset method must be called to make the parser ready to accept new data, either from feed or using the parse method. Note that these methods must _not_ be called during parsing, that is, after parse has been called and before it returns. By default, the class also implements the parse method of the XMLReader interface using the feed, close and reset methods of the IncrementalParser interface as a convenience to SAX 2.0 driver writers.cCs||_t|dSr)_bufsizerr)r bufsizer r rroszIncrementalParser.__init__cCslddlm}||}|||}|dkr8|}||j}|r`||||j}qD| dS)Nr)saxutils) r7Zprepare_input_source prepareParsergetCharacterStream getByteStreamreadr5feedclose)r rr7filebufferr r rrss     zIncrementalParser.parsecCs tddS)aThis method gives the raw XML data in the data parameter to the parser and makes it parse the data, emitting the corresponding events. It is allowed for XML constructs to be split across several calls to feed. feed may raise SAXException.rNr)r datar r rr=szIncrementalParser.feedcCs tddS)ztThis method is called by the parse implementation to allow the SAX 2.0 driver to prepare itself for parsing.z!prepareParser must be overridden!Nrrr r rr9szIncrementalParser.prepareParsercCs tddS)aThis method is called when the entire XML document has been passed to the parser through the feed method, to notify the parser that there are no more data. This allows the parser to do the final checks on the document and empty the internal data buffer. The parser will not be ready to parse another document until the reset method has been called. close may raise SAXException.rNrr r r rr>s zIncrementalParser.closecCs tddS)zThis method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.rNrr r r rresetszIncrementalParser.resetN)r4) r/r0r1r2rrr=r9r>rBr r r rr3[s   r3c@s0eZdZdZddZddZddZdd Zd S) LocatorzInterface for associating a SAX event with a document location. A locator object will return valid results only during calls to DocumentHandler methods; at any other time, the results are unpredictable.cCsdS)z6Return the column number where the current event ends.r r r r rgetColumnNumberszLocator.getColumnNumbercCsdS)z4Return the line number where the current event ends.rDr r r r r getLineNumberszLocator.getLineNumbercCsdS)z3Return the public identifier for the current event.Nr r r r r getPublicIdszLocator.getPublicIdcCsdS)z3Return the system identifier for the current event.Nr r r r r getSystemIdszLocator.getSystemIdN)r/r0r1r2rErFrGrHr r r rrCs rCc@sjeZdZdZdddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZdS) InputSourceanEncapsulation of the information needed by the XMLReader to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will create objects of this class for use in the XMLReader.parse method and for returning from EntityResolver.resolveEntity. An InputSource belongs to the application, the XMLReader is not allowed to modify InputSource objects passed to it from the application, although it may make copies and modify those.NcCs"||_d|_d|_d|_d|_dSr)_InputSource__system_id_InputSource__public_id_InputSource__encoding_InputSource__bytefile_InputSource__charfiler Z system_idr r rrs zInputSource.__init__cCs ||_dS)z/Sets the public identifier of this InputSource.NrK)r Z public_idr r r setPublicIdszInputSource.setPublicIdcCs|jS)z2Returns the public identifier of this InputSource.rPr r r rrGszInputSource.getPublicIdcCs ||_dS)z/Sets the system identifier of this InputSource.NrJrOr r r setSystemIdszInputSource.setSystemIdcCs|jS)z2Returns the system identifier of this InputSource.rRr r r rrHszInputSource.getSystemIdcCs ||_dS)a4Sets the character encoding of this InputSource. The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML recommendation). The encoding attribute of the InputSource is ignored if the InputSource also contains a character stream.NrL)r encodingr r r setEncodingszInputSource.setEncodingcCs|jS)z/Get the character encoding of this InputSource.rTr r r r getEncodingszInputSource.getEncodingcCs ||_dS)aSet the byte stream (a Python file-like object which does not perform byte-to-character conversion) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself. If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.NrM)r Zbytefiler r r setByteStreams zInputSource.setByteStreamcCs|jS)zGet the byte stream for this input source. The getEncoding method will return the character encoding for this byte stream, or None if unknown.rXr r r rr;szInputSource.getByteStreamcCs ||_dS)a^Set the character stream for this input source. (The stream must be a Python 2.0 Unicode-wrapped file-like that performs conversion to Unicode strings.) If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.NrN)r Zcharfiler r rsetCharacterStreamszInputSource.setCharacterStreamcCs|jS)z/Get the character stream for this input source.rZr r r rr:szInputSource.getCharacterStream)N)r/r0r1r2rrQrGrSrHrVrWrYr;r[r:r r r rrIs    rIc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZd$ddZddZd d!Zd"d#ZdS)%AttributesImplcCs ||_dS)zQNon-NS-aware implementation. attrs should be of the form {name : value}.N_attrs)r attrsr r rrszAttributesImpl.__init__cCs t|jSrlenr^r r r r getLengthszAttributesImpl.getLengthcCsdS)NZCDATAr r&r r rgetType!szAttributesImpl.getTypecCs |j|Srr]r&r r rgetValue$szAttributesImpl.getValuecCs |j|Srr]r&r r rgetValueByQName'szAttributesImpl.getValueByQNamecCs||jkrt||Srr^KeyErrorr&r r rgetNameByQName*s zAttributesImpl.getNameByQNamecCs||jkrt||Srrfr&r r rgetQNameByName/s zAttributesImpl.getQNameByNamecCst|jSrlistr^keysr r r rgetNames4szAttributesImpl.getNamescCst|jSrrjr r r r getQNames7szAttributesImpl.getQNamescCs t|jSrr`r r r r__len__:szAttributesImpl.__len__cCs |j|Srr]r&r r r __getitem__=szAttributesImpl.__getitem__cCst|jSrrjr r r rrl@szAttributesImpl.keyscCs ||jkSrr]r&r r r __contains__CszAttributesImpl.__contains__NcCs|j||Sr)r^get)r r' alternativer r rrrFszAttributesImpl.getcCs ||jSr) __class__r^r r r rcopyIszAttributesImpl.copycCst|jSr)rkr^itemsr r r rrvLszAttributesImpl.itemscCst|jSr)rkr^valuesr r r rrwOszAttributesImpl.values)N)r/r0r1rrbrcrdrerhrirmrnrorprlrqrrrurvrwr r r rr\s" r\c@s<eZdZddZddZddZddZd d Zd d Zd S)AttributesNSImplcCs||_||_dS)zNS-aware implementation. attrs should be of the form {(ns_uri, lname): value, ...}. qnames of the form {(ns_uri, lname): qname, ...}.N)r^_qnames)r r_Zqnamesr r rrVszAttributesNSImpl.__init__cCs6|jD]\}}||kr |j|Sq t|dSr)ryrvr^rgr r'ZnsnameZqnamer r rre^sz AttributesNSImpl.getValueByQNamecCs0|jD]\}}||kr |Sq t|dSr)ryrvrgrzr r rrhes zAttributesNSImpl.getNameByQNamecCs |j|Sr)ryr&r r rrilszAttributesNSImpl.getQNameByNamecCst|jSr)rkryrwr r r rrnoszAttributesNSImpl.getQNamescCs||j|jSr)rtr^ryr r r rrurszAttributesNSImpl.copyN) r/r0r1rrerhrirnrur r r rrxTs rxcCstttdSr)rr3rCr r r r_testvsr{__main__N)r2r8r _exceptionsrrrr3rCrIr\rxr{r/r r r rs PJY>"PK]G2& )__pycache__/__init__.cpython-38.opt-1.pycnu[U e5d?@s dZddlmZddlmZmZddlmZmZm Z m Z m Z efddZ efddZ d gZd Zernd d lZd d lZd d lZejjsd ejkrejd d Z[dZejd ddkrejerejed ZdddZejd ddkrddZnddZ[d S)aSimple API for XML (SAX) implementation for Python. This module provides an implementation of the SAX 2 interface; information about the Java version of the interface can be found at http://www.megginson.com/SAX/. The Python version of the interface is documented at <...>. This package contains the following modules: handler -- Base classes and constants which define the SAX 2 API for the 'client-side' of SAX for Python. saxutils -- Implementation of the convenience classes commonly used to work with SAX. xmlreader -- Base classes and constants which define the SAX 2 API for the parsers used with SAX for Python. expatreader -- Driver that allows use of the Expat parser with SAX. ) InputSource)ContentHandler ErrorHandler) SAXExceptionSAXNotRecognizedExceptionSAXParseExceptionSAXNotSupportedExceptionSAXReaderNotAvailablecCs(t}||||||dS)N) make_parsersetContentHandlersetErrorHandlerparse)sourcehandler errorHandlerparserr(/usr/lib64/python3.8/xml/sax/__init__.pyr s  r cCspddl}|dkrt}t}||||t}t|trR|| |n| | || |dS)N) iorr r r r isinstancestrZsetCharacterStreamStringIOZ setByteStreamBytesIOr )stringrrrrZinpsrcrrr parseString#s   rzxml.sax.expatreaderrNZ PY_SAX_PARSER,zpython.xml.sax.parserjavarc Csxt|tD]\}zt|WStk rT}zddl}||jkrDW5d}~XYq tk rfYq Xq tdddS)a3Creates and returns a SAX parser. Creates the first parser it is able to instantiate of the ones given in the iterable created by chaining parser_list and default_parser_list. The iterables must contain the names of Python modules containing both a SAX parser and a create_parser function.rNzNo parsers found)listdefault_parser_list_create_parser ImportErrorsysmodulesr )Z parser_list parser_nameer#rrrr Fs r cCs$ddlm}||dt}|S)Nr)imp)Zorg.python.corer'Z importNameglobals create_parser)r%r' drv_modulerrrr!as r!cCst|iidg}|S)Nr)) __import__r))r%r*rrrr!gs)r)__doc__Z xmlreaderrrrr _exceptionsrrrrr r rr _falseZxml.sax.expatreaderZxmlosr#flagsignore_environmentenvironsplitZ_keyplatformregistryZ containsKeyZ getPropertyr r!rrrrs*   PK]dTۈ00"__pycache__/handler.cpython-38.pycnu[U e5db6@sdZdZGdddZGdddZGdddZGdd d Zd Zd Zd Zd Z dZ dZ eeee e e gZ dZ dZdZdZdZdZe eeeeegZdS)a0 This module contains the core classes of version 2.0 of SAX for Python. This file provides only default classes with absolutely minimum functionality, from which drivers and applications can be subclassed. Many of these classes are empty and are included only as documentation of the interfaces. $Id$ z2.0betac@s(eZdZdZddZddZddZdS) ErrorHandleraBasic interface for SAX error handlers. If you create an object that implements this interface, then register the object with your XMLReader, the parser will call the methods in your object to report all warnings and errors. There are three levels of errors available: warnings, (possibly) recoverable errors, and unrecoverable errors. All methods take a SAXParseException as the only parameter.cCs|dS)zHandle a recoverable error.NselfZ exceptionrr'/usr/lib64/python3.8/xml/sax/handler.pyerror szErrorHandler.errorcCs|dS)zHandle a non-recoverable error.Nrrrrr fatalError$szErrorHandler.fatalErrorcCs t|dS)zHandle a warning.N)printrrrrwarning(szErrorHandler.warningN)__name__ __module__ __qualname____doc__rrr rrrrrs rc@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZdS)ContentHandlerzInterface for receiving logical document content events. This is the main callback interface in SAX, and the one most important to applications. The order of events in this interface mirrors the order of the information in the document.cCs d|_dS)NZ_locatorrrrr__init__6szContentHandler.__init__cCs ||_dS)a#Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface. The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine. Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.Nr)rZlocatorrrrsetDocumentLocator9sz!ContentHandler.setDocumentLocatorcCsdS)zReceive notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).Nrrrrr startDocumentPszContentHandler.startDocumentcCsdS)aQReceive notification of the end of a document. The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.Nrrrrr endDocumentWszContentHandler.endDocumentcCsdS)aBegin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default). There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary. Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.Nr)rprefixZurirrrstartPrefixMapping`sz!ContentHandler.startPrefixMappingcCsdS)zEnd the scope of a prefix-URI mapping. See startPrefixMapping for details. This event will always occur after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.Nr)rrrrrendPrefixMappingwszContentHandler.endPrefixMappingcCsdS)aSignals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an instance of the Attributes class containing the attributes of the element.Nr)rnameattrsrrr startElement~szContentHandler.startElementcCsdS)zSignals the end of an element in non-namespace mode. The name parameter contains the name of the element type, just as with the startElement event.Nrrrrrr endElementszContentHandler.endElementcCsdS)aSignals the start of an element in namespace mode. The name parameter contains the name of the element type as a (uri, localname) tuple, the qname parameter the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the Attributes class containing the attributes of the element. The uri part of the name tuple is None for elements which have no namespace.Nr)rrqnamerrrrstartElementNSszContentHandler.startElementNScCsdS)zSignals the end of an element in namespace mode. The name parameter contains the name of the element type, just as with the startElementNS event.Nr)rrrrrr endElementNSszContentHandler.endElementNScCsdS)aReceive notification of character data. The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.Nr)rZcontentrrr charactersszContentHandler.characterscCsdS)awReceive notification of ignorable whitespace in element content. Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.Nr)rZ whitespacerrrignorableWhitespacesz"ContentHandler.ignorableWhitespacecCsdS)aReceive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.Nr)rtargetdatarrrprocessingInstructionsz$ContentHandler.processingInstructioncCsdS)aReceive notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.Nrrrrr skippedEntityszContentHandler.skippedEntityN)r r r r rrrrrrrrrrr r!r$r%rrrrr/s    rc@s eZdZdZddZddZdS) DTDHandlerzHandle DTD events. This interface specifies only those DTD events required for basic parsing (unparsed entities and attributes).cCsdS)z$Handle a notation declaration event.Nr)rrpublicIdsystemIdrrr notationDeclszDTDHandler.notationDeclcCsdS)z,Handle an unparsed entity declaration event.Nr)rrr'r(ZndatarrrunparsedEntityDeclszDTDHandler.unparsedEntityDeclN)r r r r r)r*rrrrr&sr&c@seZdZdZddZdS)EntityResolvera7Basic interface for resolving entities. If you create an object implementing this interface, then register the object with your Parser, the parser will call the method in your object to resolve all external entities. Note that DefaultHandler implements this interface with the default behaviour.cCs|S)zResolve the system identifier of an entity and return either the system identifier to read from as a string, or an InputSource to read from.r)rr'r(rrr resolveEntityszEntityResolver.resolveEntityN)r r r r r,rrrrr+sr+z&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictN)r versionrrr&r+Zfeature_namespacesZfeature_namespace_prefixesZfeature_string_interningZfeature_validationZfeature_external_gesZfeature_external_pesZ all_featuresZproperty_lexical_handlerZproperty_declaration_handlerZproperty_dom_nodeZproperty_xml_stringZproperty_encodingZproperty_interning_dictZall_propertiesrrrrs@  " PK] FF&__pycache__/_exceptions.cpython-38.pycnu[U e5d@sdZddlZejdddkr*ddlmZ[GdddeZGdd d eZGd d d eZGd d d eZGdddeZ dS)z!Different kinds of SAX ExceptionsNjava) Exceptionc@s:eZdZdZd ddZddZddZd d Zd d ZdS) SAXExceptionaEncapsulate an XML error or warning. This class can contain basic error or warning information from either the XML parser or the application: you can subclass it to provide additional functionality, or to add localization. Note that although you will receive a SAXException as the argument to the handlers in the ErrorHandler interface, you are not actually required to raise the exception; instead, you can simply read the information in it.NcCs||_||_t||dS)zUCreates an exception. The message is required, but the exception is optional.N)_msg _exceptionr__init__)selfmsg exceptionr +/usr/lib64/python3.8/xml/sax/_exceptions.pyrszSAXException.__init__cCs|jS)z$Return a message for this exception.rr r r r getMessageszSAXException.getMessagecCs|jS)z9Return the embedded exception, or None if there was none.)rrr r r getExceptionszSAXException.getExceptioncCs|jS)0Create a string representation of the exception.rrr r r __str__"szSAXException.__str__cCs tddS)zvAvoids weird error messages if someone does exception[ix] by mistake, since Exception has __getitem__ defined. __getitem__N)AttributeError)r Zixr r r r&szSAXException.__getitem__)N) __name__ __module__ __qualname____doc__rrrrrr r r r r s  rc@s@eZdZdZddZddZddZdd Zd d Zd d Z dS)SAXParseExceptiona#Encapsulate an XML parse error or warning. This exception will include information for locating the error in the original XML document. Note that although the application will receive a SAXParseException as the argument to the handlers in the ErrorHandler interface, the application is not actually required to raise the exception; instead, it can simply read the information in it and take a different action. Since this exception is a subclass of SAXException, it inherits the ability to wrap another exception.cCs<t|||||_|j|_|j|_|j|_dS)zECreates the exception. The exception parameter is allowed to be None.N) rr_locator getSystemId _systemIdgetColumnNumber_colnum getLineNumber_linenum)r r r Zlocatorr r r r;s   zSAXParseException.__init__cCs|jS)zNThe column number of the end of the text where the exception occurred.)rrr r r rHsz!SAXParseException.getColumnNumbercCs|jS)zDThe line number of the end of the text where the exception occurred.)r!rr r r r MszSAXParseException.getLineNumbercCs |jS)zEGet the public identifier of the entity where the exception occurred.)r getPublicIdrr r r r"QszSAXParseException.getPublicIdcCs|jS)zEGet the system identifier of the entity where the exception occurred.)rrr r r rUszSAXParseException.getSystemIdcCsN|}|dkrd}|}|dkr(d}|}|dkr?z %s:%s:%s: %s)rr rr)r ZsysidZlinenumZcolnumr r r rYszSAXParseException.__str__N) rrrrrrr r"rrr r r r r.s  rc@seZdZdZdS)SAXNotRecognizedExceptionzException class for an unrecognized identifier. An XMLReader will raise this exception when it is confronted with an unrecognized feature or property. SAX applications and extensions may use this class for similar purposes.Nrrrrr r r r r$isr$c@seZdZdZdS)SAXNotSupportedExceptionaException class for an unsupported operation. An XMLReader will raise this exception when a service it cannot perform is requested (specifically setting a state or value). SAX applications and extensions may use this class for similar purposes.Nr%r r r r r&ssr&c@seZdZdZdS)SAXReaderNotAvailableaException class for a missing driver. An XMLReader module (driver) should raise this exception when it is first imported, e.g. when a support module cannot be imported. It also may be raised during parsing, e.g. if executing an external program is not permitted.Nr%r r r r r'}sr') rsysplatformZ java.langrrrr$r&r'r r r r s %;  PK!]1*__pycache__/__init__.cpython-312.opt-1.pycnu[ ֦i $dZddlmZddlmZmZddlmZmZm Z m Z m Z efdZ efdZ dgZdZerdd lZdd lZdd lZej(j*s,d ej,vrej,d j/d Z[[dd Zd Zy )aSimple API for XML (SAX) implementation for Python. This module provides an implementation of the SAX 2 interface; information about the Java version of the interface can be found at http://www.megginson.com/SAX/. The Python version of the interface is documented at <...>. This package contains the following modules: handler -- Base classes and constants which define the SAX 2 API for the 'client-side' of SAX for Python. saxutils -- Implementation of the convenience classes commonly used to work with SAX. xmlreader -- Base classes and constants which define the SAX 2 API for the parsers used with SAX for Python. expatreader -- Driver that allows use of the Expat parser with SAX. ) InputSource)ContentHandler ErrorHandler) SAXExceptionSAXNotRecognizedExceptionSAXParseExceptionSAXNotSupportedExceptionSAXReaderNotAvailablec~t}|j||j||j|y)N) make_parsersetContentHandlersetErrorHandlerparse)sourcehandler errorHandlerparsers )/usr/lib64/python3.12/xml/sax/__init__.pyrrs1 ]F W% <( LLcTddl}| t}t}|j||j |t }t |tr!|j|j|n |j|j||j|y)N) iorr r rr isinstancestrsetCharacterStreamStringIO setByteStreamBytesIOr)stringrrrrinpsrcs r parseStringr!#s #~ ]F W% <( ]F&#!!"++f"56RZZ/0 LLrzxml.sax.expatreaderrN PY_SAX_PARSER,ct|tzD]} t|cSt dd#t$rddl}||j vrY>  !+. .? 2D 99  ckk)*%   s 1AAAc@t|iidg}|jS)N create_parser) __import__r.)r, drv_modules rr'r'\s$K2.?@J  # # %%r))__doc__ xmlreaderrrrr _exceptionsrrrr r rr!r&_falsexml.sax.expatreaderxmlosr)flagsignore_environmentenvironsplitr r'r1rrr=s*#1.. )5 /;n $--   yy##2::(E**_5;;C@:4&rPK!]jM\!c4c4+__pycache__/xmlreader.cpython-312.opt-2.pycnu[ ֦iP1 ddlmZddlmZmZGddZGddeZGddZGd d ZGd d Z Gd de Z dZ e dk(re yy))handler)SAXNotSupportedExceptionSAXNotRecognizedExceptioncheZdZ dZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZy) XMLReaderctj|_tj|_tj |_tj|_yN) rContentHandler _cont_handler DTDHandler _dtd_handlerEntityResolver _ent_handler ErrorHandler _err_handlerselfs */usr/lib64/python3.12/xml/sax/xmlreader.py__init__zXMLReader.__init__sF$335#..0#224#002c tdNz This method must be implemented!NotImplementedErrorrsources rparsezXMLReader.parsesK!"DEErc |jSr r rs rgetContentHandlerzXMLReader.getContentHandler"s-!!!rc ||_yr rrrs rsetContentHandlerzXMLReader.setContentHandler&s D$rc |jSr r rs r getDTDHandlerzXMLReader.getDTDHandler*s*   rc ||_yr r%r"s r setDTDHandlerzXMLReader.setDTDHandler.s A#rc |jSr rrs rgetEntityResolverzXMLReader.getEntityResolver2s-   rc ||_yr r*)rresolvers rsetEntityResolverzXMLReader.setEntityResolver6s :$rc |jSr rrs rgetErrorHandlerzXMLReader.getErrorHandler:s+   rc ||_yr r0r"s rsetErrorHandlerzXMLReader.setErrorHandler>s =#rc td)NzLocale support not implemented)r)rlocales r setLocalezXMLReader.setLocaleBs = ''GHHrc td|zNzFeature '%s' not recognizedrrnames r getFeaturezXMLReader.getFeatureKs;'(E(LMMrc td|zr8r9)rr;states r setFeaturezXMLReader.setFeatureOs+'(E(LMMrc td|zNzProperty '%s' not recognizedr9r:s r getPropertyzXMLReader.getPropertySs<'(F(MNNrc td|zrAr9)rr;values r setPropertyzXMLReader.setPropertyWs,'(F(MNNrN)__name__ __module__ __qualname__rrr r#r&r(r+r.r1r3r6r<r?rBrErrrr sX 3 F"%!$!%!$INNOOrrc4eZdZ ddZdZdZdZdZdZy) IncrementalParserc<||_tj|yr )_bufsizerr)rbufsizes rrzIncrementalParser.__init__os 4 rcPddlm}|j|}|j||j }||j }|j |jx}r/|j||j |jx}r/|jy)Nr)saxutils) rPprepare_input_source prepareParsergetCharacterStream getByteStreamreadrMfeedclose)rrrPfilebuffers rrzIncrementalParser.parsess..v6 6"((* <'')D $--00f0 IIf  $--00f0 rc tdrr)rdatas rrWzIncrementalParser.feeds ( ""DEErc td)Nz!prepareParser must be overridden!rrs rrSzIncrementalParser.prepareParsers =!"EFFrc tdrrrs rrXzIncrementalParser.closes )""DEErc tdrrrs rresetzIncrementalParser.resets ""DEErN)i) rFrGrHrrrWrSrXr`rIrrrKrK[s)&! FG FFrrKc&eZdZ dZdZdZdZy)Locatorc yNrIrs rgetColumnNumberzLocator.getColumnNumbers@rc yrdrIrs r getLineNumberzLocator.getLineNumbers>rc yr rIrs r getPublicIdzLocator.getPublicId=rc yr rIrs r getSystemIdzLocator.getSystemIdrkrN)rFrGrHrfrhrjrmrIrrrbrbs" rrbcReZdZ d dZdZdZdZdZdZdZ d Z d Z d Z d Z y) InputSourceNcJ||_d|_d|_d|_d|_yr )_InputSource__system_id_InputSource__public_id_InputSource__encoding_InputSource__bytefile_InputSource__charfiler system_ids rrzInputSource.__init__s'$rc ||_yr rr)r public_ids r setPublicIdzInputSource.setPublicId 9$rc |jSr ryrs rrjzInputSource.getPublicId<rc ||_yr rqrvs r setSystemIdzInputSource.setSystemIdr|rc |jSr rrs rrmzInputSource.getSystemIdr~rc ||_yr rs)rencodings r setEncodingzInputSource.setEncodings 9#rc |jSr rrs r getEncodingzInputSource.getEncoding9rc ||_yr rt)rbytefiles r setByteStreamzInputSource.setByteStreams A#rc |jSr rrs rrUzInputSource.getByteStreams 1rc ||_yr ru)rcharfiles rsetCharacterStreamzInputSource.setCharacterStreams 0#rc |jSr rrs rrTzInputSource.getCharacterStreamrrr )rFrGrHrr{rjrrmrrrrUrrTrIrrroros? B % % # ##rrocteZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZddZdZdZdZy)AttributesImplc ||_yr _attrs)rattrss rrzAttributesImpl.__init__s 7 rc,t|jSr lenrrs r getLengthzAttributesImpl.getLength4;;rcy)NCDATArIr:s rgetTypezAttributesImpl.getTypesrc |j|Sr rr:s rgetValuezAttributesImpl.getValue"{{4  rc |j|Sr rr:s rgetValueByQNamezAttributesImpl.getValueByQName%rrc8||jvr t||Sr rKeyErrorr:s rgetNameByQNamezAttributesImpl.getNameByQName( t{{ "4.  rc8||jvr t||Sr rr:s rgetQNameByNamezAttributesImpl.getQNameByName-rrcHt|jjSr listrkeysrs rgetNameszAttributesImpl.getNames2DKK$$&''rcHt|jjSr rrs r getQNameszAttributesImpl.getQNames5rrc,t|jSr rrs r__len__zAttributesImpl.__len__8rrc |j|Sr rr:s r __getitem__zAttributesImpl.__getitem__;rrcHt|jjSr rrs rrzAttributesImpl.keys>rrc||jvSr rr:s r __contains__zAttributesImpl.__contains__Ast{{""rNc:|jj||Sr )rget)rr; alternatives rrzAttributesImpl.getDs{{t[11rc8|j|jSr ) __class__rrs rcopyzAttributesImpl.copyGs~~dkk**rcHt|jjSr )rritemsrs rrzAttributesImpl.itemsJsDKK%%'((rcHt|jjSr )rrvaluesrs rrzAttributesImpl.valuesMsDKK&&())rr )rFrGrHrrrrrrrrrrrrrrrrrrIrrrrsW  !!  (( !(#2+)*rrc0eZdZdZdZdZdZdZdZy)AttributesNSImplc" ||_||_yr )r_qnames)rrqnamess rrzAttributesNSImpl.__init__Ts =  rc|jjD]\}}||k(s |j|cSt|r )rrrrrr;nsnameqnames rrz AttributesNSImpl.getValueByQName\s?#||113OVU}{{6** 4tnrcn|jjD]\}}||k(s |cSt|r )rrrrs rrzAttributesNSImpl.getNameByQNamecs5#||113OVU}  4tnrc |j|Sr )rr:s rrzAttributesNSImpl.getQNameByNamejs||D!!rcHt|jjSr )rrrrs rrzAttributesNSImpl.getQNamesmsDLL'')**rcN|j|j|jSr )rrrrs rrzAttributesNSImpl.copyps~~dkk4<<88rN) rFrGrHrrrrrrrIrrrrRs "+9rrc@tttyr )rrKrbrIrr_testrts K Ir__main__N) rQr _exceptionsrrrrKrbrorrrrFrIrrrsz"L NONO`DF DFP0UUr:*:*|9~9D  z GrPK!]7[I[L[L+__pycache__/xmlreader.cpython-312.opt-1.pycnu[ ֦iP1dZddlmZddlmZmZGddZGddeZGdd ZGd d Z Gd d Z Gdde Z dZ e dk(re yy)z]An XML Reader is the SAX 2 name for an XML parser. XML Parsers should be based on this code. )handler)SAXNotSupportedExceptionSAXNotRecognizedExceptioncjeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZy) XMLReadera%Interface for reading an XML document using callbacks. XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse. All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.ctj|_tj|_tj |_tj|_yN) rContentHandler _cont_handler DTDHandler _dtd_handlerEntityResolver _ent_handler ErrorHandler _err_handlerselfs */usr/lib64/python3.12/xml/sax/xmlreader.py__init__zXMLReader.__init__sF$335#..0#224#002ctd)zAParse an XML document from a system identifier or an InputSource. This method must be implemented!NotImplementedErrorrsources rparsezXMLReader.parses!"DEErc|jS)z#Returns the current ContentHandler.r rs rgetContentHandlerzXMLReader.getContentHandler"s!!!rc||_y)z:Registers a new object to receive document content events.Nrrrs rsetContentHandlerzXMLReader.setContentHandler&s $rc|jS)z Returns the current DTD handler.r rs r getDTDHandlerzXMLReader.getDTDHandler*   rc||_y)z7Register an object to receive basic DTD-related events.Nr%r"s r setDTDHandlerzXMLReader.setDTDHandler. #rc|jS)z#Returns the current EntityResolver.rrs rgetEntityResolverzXMLReader.getEntityResolver2r'rc||_y)z0Register an object to resolve external entities.Nr,)rresolvers rsetEntityResolverzXMLReader.setEntityResolver6s $rc|jS)z!Returns the current ErrorHandler.rrs rgetErrorHandlerzXMLReader.getErrorHandler:r'rc||_y)z3Register an object to receive error-message events.Nr2r"s rsetErrorHandlerzXMLReader.setErrorHandler>r*rctd)aHAllow an application to set the locale for errors and warnings. SAX parsers are not required to provide localization for errors and warnings; if they cannot support the requested locale, however, they must raise a SAX exception. Applications may request a locale change in the middle of a parse.zLocale support not implemented)r)rlocales r setLocalezXMLReader.setLocaleBs''GHHrctd|z)z1Looks up and returns the state of a SAX2 feature.Feature '%s' not recognizedrrnames r getFeaturezXMLReader.getFeatureK'(E(LMMrctd|z)z!Sets the state of a SAX2 feature.r:r;)rr=states r setFeaturezXMLReader.setFeatureOr?rctd|z)z2Looks up and returns the value of a SAX2 property.Property '%s' not recognizedr;r<s r getPropertyzXMLReader.getPropertyS'(F(MNNrctd|z)z"Sets the value of a SAX2 property.rDr;)rr=values r setPropertyzXMLReader.setPropertyWrFrN)__name__ __module__ __qualname____doc__rrr r#r&r)r-r0r3r5r8r>rBrErIrrrr sX 3 F"%!$!%!$INNOOrrc6eZdZdZd dZdZdZdZdZdZ y) IncrementalParserasThis interface adds three extra methods to the XMLReader interface that allow XML parsers to support incremental parsing. Support for this interface is optional, since not all underlying XML parsers support this functionality. When the parser is instantiated it is ready to begin accepting data from the feed method immediately. After parsing has been finished with a call to close the reset method must be called to make the parser ready to accept new data, either from feed or using the parse method. Note that these methods must _not_ be called during parsing, that is, after parse has been called and before it returns. By default, the class also implements the parse method of the XMLReader interface using the feed, close and reset methods of the IncrementalParser interface as a convenience to SAX 2.0 driver writers.c<||_tj|yr )_bufsizerr)rbufsizes rrzIncrementalParser.__init__os 4 rcPddlm}|j|}|j||j }||j }|j |jx}r/|j||j |jx}r/|jy)Nr)saxutils) rUprepare_input_source prepareParsergetCharacterStream getByteStreamreadrRfeedclose)rrrUfilebuffers rrzIncrementalParser.parsess..v6 6"((* <'')D $--00f0 IIf  $--00f0 rctd)aThis method gives the raw XML data in the data parameter to the parser and makes it parse the data, emitting the corresponding events. It is allowed for XML constructs to be split across several calls to feed. feed may raise SAXException.rr)rdatas rr\zIncrementalParser.feeds""DEErctd)ztThis method is called by the parse implementation to allow the SAX 2.0 driver to prepare itself for parsing.z!prepareParser must be overridden!rrs rrXzIncrementalParser.prepareParsers""EFFrctd)aThis method is called when the entire XML document has been passed to the parser through the feed method, to notify the parser that there are no more data. This allows the parser to do the final checks on the document and empty the internal data buffer. The parser will not be ready to parse another document until the reset method has been called. close may raise SAXException.rrrs rr]zIncrementalParser.closes""DEErctd)zThis method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.rrrs rresetzIncrementalParser.resets ""DEErN)i) rJrKrLrMrrr\rXr]rerNrrrPrP[s)&! FG FFrrPc(eZdZdZdZdZdZdZy)LocatorzInterface for associating a SAX event with a document location. A locator object will return valid results only during calls to DocumentHandler methods; at any other time, the results are unpredictable.cy)z6Return the column number where the current event ends.rNrs rgetColumnNumberzLocator.getColumnNumberrcy)z4Return the line number where the current event ends.rirNrs r getLineNumberzLocator.getLineNumberrkrcy)z3Return the public identifier for the current event.NrNrs r getPublicIdzLocator.getPublicIdrcy)z3Return the system identifier for the current event.NrNrs r getSystemIdzLocator.getSystemIdrprN)rJrKrLrMrjrmrorrrNrrrgrgs" rrgcTeZdZdZddZdZdZdZdZdZ d Z d Z d Z d Z d Zy) InputSourceanEncapsulation of the information needed by the XMLReader to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will create objects of this class for use in the XMLReader.parse method and for returning from EntityResolver.resolveEntity. An InputSource belongs to the application, the XMLReader is not allowed to modify InputSource objects passed to it from the application, although it may make copies and modify those.NcJ||_d|_d|_d|_d|_yr )_InputSource__system_id_InputSource__public_id_InputSource__encoding_InputSource__bytefile_InputSource__charfiler system_ids rrzInputSource.__init__s'$rc||_y)z/Sets the public identifier of this InputSource.Nrw)r public_ids r setPublicIdzInputSource.setPublicId $rc|jS)z2Returns the public identifier of this InputSource.r~rs rrozInputSource.getPublicIdrc||_y)z/Sets the system identifier of this InputSource.Nrvr{s r setSystemIdzInputSource.setSystemIdrrc|jS)z2Returns the system identifier of this InputSource.rrs rrrzInputSource.getSystemIdrrc||_y)a4Sets the character encoding of this InputSource. The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML recommendation). The encoding attribute of the InputSource is ignored if the InputSource also contains a character stream.Nrx)rencodings r setEncodingzInputSource.setEncoding #rc|jS)z/Get the character encoding of this InputSource.rrs r getEncodingzInputSource.getEncoding rc||_y)aSet the byte stream (a Python file-like object which does not perform byte-to-character conversion) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself. If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.Nry)rbytefiles r setByteStreamzInputSource.setByteStreams #rc|jS)zGet the byte stream for this input source. The getEncoding method will return the character encoding for this byte stream, or None if unknown.rrs rrZzInputSource.getByteStreams rc||_y)a^Set the character stream for this input source. (The stream must be a Python 2.0 Unicode-wrapped file-like that performs conversion to Unicode strings.) If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.Nrz)rcharfiles rsetCharacterStreamzInputSource.setCharacterStreamrrc|jS)z/Get the character stream for this input source.rrs rrYzInputSource.getCharacterStreamrrr )rJrKrLrMrrrorrrrrrrZrrYrNrrrtrts? B % % # ##rrtcteZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZddZdZdZdZy)AttributesImplc||_y)zQNon-NS-aware implementation. attrs should be of the form {name : value}.N_attrs)rattrss rrzAttributesImpl.__init__s  rc,t|jSr lenrrs r getLengthzAttributesImpl.getLength4;;rcy)NCDATArNr<s rgetTypezAttributesImpl.getTypesrc |j|Sr rr<s rgetValuezAttributesImpl.getValue"{{4  rc |j|Sr rr<s rgetValueByQNamezAttributesImpl.getValueByQName%rrc8||jvr t||Sr rKeyErrorr<s rgetNameByQNamezAttributesImpl.getNameByQName( t{{ "4.  rc8||jvr t||Sr rr<s rgetQNameByNamezAttributesImpl.getQNameByName-rrcHt|jjSr listrkeysrs rgetNameszAttributesImpl.getNames2DKK$$&''rcHt|jjSr rrs r getQNameszAttributesImpl.getQNames5rrc,t|jSr rrs r__len__zAttributesImpl.__len__8rrc |j|Sr rr<s r __getitem__zAttributesImpl.__getitem__;rrcHt|jjSr rrs rrzAttributesImpl.keys>rrc||jvSr rr<s r __contains__zAttributesImpl.__contains__Ast{{""rNc:|jj||Sr )rget)rr= alternatives rrzAttributesImpl.getDs{{t[11rc8|j|jSr ) __class__rrs rcopyzAttributesImpl.copyGs~~dkk**rcHt|jjSr )rritemsrs rrzAttributesImpl.itemsJsDKK%%'((rcHt|jjSr )rrvaluesrs rrzAttributesImpl.valuesMsDKK&&())rr )rJrKrLrrrrrrrrrrrrrrrrrrNrrrrsW  !!  (( !(#2+)*rrc0eZdZdZdZdZdZdZdZy)AttributesNSImplc ||_||_y)zNS-aware implementation. attrs should be of the form {(ns_uri, lname): value, ...}. qnames of the form {(ns_uri, lname): qname, ...}.N)r_qnames)rrqnamess rrzAttributesNSImpl.__init__Ts   rc|jjD]\}}||k(s |j|cSt|r )rrrrrr=nsnameqnames rrz AttributesNSImpl.getValueByQName\s?#||113OVU}{{6** 4tnrcn|jjD]\}}||k(s |cSt|r )rrrrs rrzAttributesNSImpl.getNameByQNamecs5#||113OVU}  4tnrc |j|Sr )rr<s rrzAttributesNSImpl.getQNameByNamejs||D!!rcHt|jjSr )rrrrs rrzAttributesNSImpl.getQNamesmsDLL'')**rcN|j|j|jSr )rrrrs rrzAttributesNSImpl.copyps~~dkk4<<88rN) rJrKrLrrrrrrrNrrrrRs "+9rrc@tttyr )rrPrgrNrr_testrts K Ir__main__N)rMrVr _exceptionsrrrrPrgrtrrrrJrNrrrsz"L NONO`DF DFP0UUr:*:*|9~9D  z GrPK!]ޏOTOT-__pycache__/expatreader.cpython-312.opt-1.pycnu[ ֦i>dZdZddlddlmZmZddlmZddlmZmZddlm Z ddlm Z m Z  dd l m Z ee d s ed d dd lmZmZmZej*Zej,Z dd lZdd lZej2Z[[GddZGddej8ZGddej<ej8ZdZ e!dk(rydd l"Z#e Z$e$jKe#jLj&jOe$jQe#jLjSe$jUdy y #e$r ed d wxYw#e$rdZYwxYw)z] SAX driver for the pyexpat C module. This driver works with pyexpat.__version__ == '2.22'. z0.20)*)feature_validationfeature_namespaces)feature_namespace_prefixes)feature_external_gesfeature_external_pes)feature_string_interning)property_xml_stringproperty_interning_dict)expat ParserCreatezexpat not supportedN) xmlreadersaxutilshandlerc|SN)os ,/usr/lib64/python3.12/xml/sax/expatreader.py_mkproxyr!sc eZdZy) _ClosedParserN)__name__ __module__ __qualname__rrrrr(srrc.eZdZdZdZdZdZdZdZy) ExpatLocatorzLocator for use with the ExpatParser class. This uses a weak reference to the parser object to avoid creating a circular reference between the parser and the content handler. c$t||_yr)r_refselfparsers r__init__zExpatLocator.__init__3sV$ rc`|j}|jy|jjSr)r _parserErrorColumnNumberr!s rgetColumnNumberzExpatLocator.getColumnNumber6s( >> !~~///rc`|j}|jy|jjSN)r r&ErrorLineNumberr!s r getLineNumberzExpatLocator.getLineNumber<s( >> !~~---rcT|j}|y|jjSr)r _source getPublicIdr!s rr0zExpatLocator.getPublicIdB& >~~))++rcT|j}|y|jjSr)r r/ getSystemIdr!s rr3zExpatLocator.getSystemIdHr1rN) rrr__doc__r$r(r-r0r3rrrrr-s  %0 . , ,rrceZdZdZd#dZdZdZdZdZdZ dZ d Z d$d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#y")% ExpatParserz$SAX driver for the pyexpat C module.ctjj||tj|_d|_||_d|_d|_g|_ d|_ d|_ y)NFr) rIncrementalParserr$ InputSourcer/r& _namespaces_lex_handler_prop_parsing _entity_stack _external_ges _interning)r"namespaceHandlingbufsizes rr$zExpatParser.__init__Ts]##,,T7; ,,.  ,!% rctj|}||_ |j|jj t |tjj||y#|jxYw)z3Parse an XML document from a URL or an InputSource.N) rprepare_input_sourcer/reset _cont_handlersetDocumentLocatorrrr8parse _close_sourcer"sources rrGzExpatParser.parseasn..v6   JJL    1 1,t2D E  ' ' - -dF ;     s AA33Bcx|j*|jj|jyyr)r3r&SetBaserIs r prepareParserzExpatParser.prepareParserqs1     + LL !3!3!5 6 ,rc~tjj|||jr|j yyr)rr8setContentHandlerr<_reset_cont_handler)r"rs rrOzExpatParser.setContentHandlerws0##55dGD ==  $ $ & rc|tk(r |jS|tk(r|jduS|tt t fvry|tk(r |jStd|z)NrFeature '%s' not recognized) rr:r r?rrrrr>SAXNotRecognizedExceptionr"names r getFeaturezExpatParser.getFeature|sn % %## # - -??$. . (*>022 ) )%% %'(E(LMMrcj|jr td|tk(r||_y|tk(r||_y|t k(r|r|ji|_yd|_yy|tk(r|r tdy|tk(r|r tdy|tk(r|r tdytd|z)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixesrR) r<SAXNotSupportedExceptionrr:rr>r r?rrrrS)r"rUstates r setFeaturezExpatParser.setFeatures ==*+NO O % %$D  ) )!&D  - -??*&(DO"&+' '.799) ).EGG/ /.>@@,-46 6rc<|tjk(r |jS|tk(r |jS|t k(rR|j r;t|j dr|j jStdtdtd|z)NGetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsingProperty '%s' not recognized) rproperty_lexical_handlerr;r r?r r&hasattrr\rSrXrTs r getPropertyzExpatParser.getPropertys 733 3)) ) , ,?? " ( (||4<<):;<<77993*++/DFF'(F(MNNrc|tjk(r%||_|jr|j yy|t k(r||_y|tk(rtd|ztd|z)NzProperty '%s' cannot be setr]) rr^r;r<_reset_lex_handler_propr r?r rXrS)r"rUvalues r setPropertyzExpatParser.setPropertys{ 733 3%*D "}},,. , ,#DO ( (*+H+/,01 1,,J,0-12 2rc|js1|jd|_|jj |jj ||y#t j$rO}tt j|j||}|jj|Yd}~yd}~wwxYw)NT) r<rDrE startDocumentr&Parser errorSAXParseException ErrorStringcode _err_handler fatalError)r"dataisFinaleexcs rfeedzExpatParser.feeds}} JJL DM    , , . . LL  tW -{{ .#E$5$5aff$=q$GC    ( ( - - .sAB>/AB99B>c|jy|jj} |jjd|jjdd|jj|y#tj $rO}t t j|j||}|jj|Yd}~yd}~wwxYw#|jj|wxYw)NFr) r&GetReparseDeferralEnabledSetReparseDeferralEnabledrgr rhrirjrkrlrm)r" was_enabledrprqs rflushzExpatParser.flushs <<  ll<<>  @ LL 2 25 9 LL  sE * LL 2 2; ? {{ .#E$5$5aff$=q$GC    ( ( - - . LL 2 2; ?s*7A<<CACC!CC!!C>c|j} |j}||j|j}||jyy#|j}||jwwxYwr)r/getCharacterStreamclose getByteStream)r"rJfiles rrHzExpatParser._close_sourcesu ,,.D '')D  '')D  s "A%A9c|js&|jt|jtry |j dd|j j d|_d|_d|_|jGt}|jj|_|jj|_ ||_|jy#d|_|jGt}|jj|_|jj|_ ||_|jwxYw)NrT)roF) r=r& isinstancerrrrE endDocumentr<r'r,rHr!s rrzzExpatParser.closes   $,,"6 t||] 3  ! IIc4I (    * * ,!DMDL!DM||'&+/<<+I+I()-)E)E&%    "DM||'&+/<<+I+I()-)E)E&%    s ;CA,Ec|jj|j_|jj|j_yr)rEprocessingInstructionr&ProcessingInstructionHandler charactersCharacterDataHandlerr"s rrPzExpatParser._reset_cont_handlers5$($6$6$L$L 1,0,>,>,I,I )rc*|j}|j}|$d|_d|_d|_d|_d|_y|j|_|j|_|j|_|j|_|j|_yr) r;r&CommentHandlerStartCdataSectionHandlerEndCdataSectionHandlerStartDoctypeDeclHandlerEndDoctypeDeclHandlercomment startCDATAendCDATAstart_doctype_declendDTD)r"lexr#s rrbz#ExpatParser._reset_lex_handler_prop s$$ ;$(F !.2F +,0F )-1F *+/F ($'KKF !.1nnF +,/LLF )-1-D-DF *+.::F (rcJ|jrtj|jj d|j |_d|j _|j|j _ |j|j _ nttj|jj |j |_|j|j _ |j|j _ |j|j|j _|j"|j _|j&|j _|j*|j _d|_|j0r|j3|j4|j _ |j8|j _|j j?tj@d|_!g|_"y#t<$rYCwxYw)N )internr+F)#r:r r r/ getEncodingr?r&namespace_prefixesstart_element_nsStartElementHandlerend_element_nsEndElementHandler start_element end_elementrPunparsed_entity_declUnparsedEntityDeclHandler notation_declNotationDeclHandlerstart_namespace_declStartNamespaceDeclHandlerend_namespace_declEndNamespaceDeclHandler_decl_handler_propr;rbexternal_entity_refExternalEntityRefHandlerskipped_entity_handlerSkippedEntityHandlerAttributeErrorSetParamEntityParsing*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr<r=rs rrDzExpatParser.resets    --dll.F.F.H#59__FDL./DLL +/3/D/DDLL ,-1-@-@DLL * --dll.F.F.H7;HDL/3/A/ADLL ,-1-=-=DLL *   "151J1J .+/+=+= (151J1J ./3/F/F ,"&  ! !  ( ( *150H0H - 040K0KDLL - **  < < >    sH H"!H"cH|jy|jjSr)r&r'rs rr(zExpatParser.getColumnNumberCs << ||---rcH|jy|jjSr*)r&r,rs rr-zExpatParser.getLineNumberHs << ||+++rc6|jjSr)r/r0rs rr0zExpatParser.getPublicIdM||''))rc6|jjSr)r/r3rs rr3zExpatParser.getSystemIdPrrcN|jj|t|yr)rE startElementAttributesImpl)r"rUattrss rrzExpatParser.start_elementTs ''nU.CDrc:|jj|yr)rE endElementrTs rrzExpatParser.end_elementW %%d+rc|j}t|dk(rd|f}n$t|dk(r |d|df}n t|}i}i}|jD]c\}}|j}t|} | dk(r|} d|f} n-| dk(r|dd|d} |d|df} n|d} t|} ||| <| || <e|jj |dt ||y)Nr+r:)splitlentupleitemsrEstartElementNSAttributesNSImpl) r"rUrpairnewattrsqnamesanamercpartslengthqnameapairs rrzExpatParser.start_element_nsZszz| t9>$$rc:|jj|yr)rEr)r"rns rcharacter_datazExpatParser.character_datarrc<|jj||yr)rEstartPrefixMapping)r"prefixuris rrz ExpatParser.start_namespace_decls --fc:rc:|jj|yr)rEendPrefixMapping)r"rs rrzExpatParser.end_namespace_decls ++F3rc>|jj|||yr)r;startDTD)r"rUsysidpubidhas_internal_subsets rrzExpatParser.start_doctype_decls ''eU;rc@|jj||||yr) _dtd_handlerunparsedEntityDecl)r"rUbaserr notation_names rrz ExpatParser.unparsed_entity_decls ,,T5%Orc>|jj|||yr)r notationDecl)r"rUrrrs rrzExpatParser.notation_decls &&tUE:rc |jsy|jj||}tj||j j xsd}|jj|j|j f|jj||_ ||_ tjj|||jd\|_ |_|jd=y#YyxYw)Nr+r)r> _ent_handler resolveEntityrrCr/r3r=appendr&ExternalEntityParserCreaterr8rG)r"contextrrrrJs rrzExpatParser.external_entity_refs!!""00>..v/3||/G/G/I02/13 !!4<<">?||>>wG     ' ' - -dF ;(,'9'9"'=$t|   r "  s 5 C??DcH|rd|z}|jj|y)N%)rE skippedEntity)r"rUis_pes rrz"ExpatParser.skipped_entity_handlers" t8D ((.rN)ri)F)$rrrr4r$rGrMrOrVrZr`rdrrrwrHrzrPrbrDr(r-r0r3rrrrrrrrrrrrrrrrr6r6Qs.  7 ' N6<O$ 2 ." @ !*J 6 # N. , **E, ND 4?,;4<P;,/rr6ct|i|Sr)r6)argskwargss r create_parserrs  ' ''r__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml)+r4versionxml.sax._exceptionsxml.sax.handlerrrrrrr r r xml.parsersr r_SAXReaderNotAvailable ImportErrorxml.saxrrrrr_weakrefweakrefproxyrrLocatorrr8r6rrxml.sax.saxutilsxmlprOsax XMLGeneratorsetErrorHandler ErrorHandlerrGrrrrsT !B6F4HA! 5. )#$94@@00))--  }}H  ,9$$,Hg/)--y/@/@g/V (  zA((5578cgg**,-GG HI a =  5t <<=sE*EEEEPK!]RR-__pycache__/expatreader.cpython-312.opt-2.pycnu[ ֦i> dZddlddlmZmZddlmZddlmZmZddlmZddlm Z m Z  ddl m Z e e d s ed d dd lmZmZmZej(Zej*Z dd lZdd lZej0Z[[GddZGddej6ZGddej:ej6ZdZe dk(rydd l!Z"eZ#e#jIe"jJj$jMe#jOe"jJjQe#jSdy y #e$r ed d wxYw#e$rd ZYwxYw)z0.20)*)feature_validationfeature_namespaces)feature_namespace_prefixes)feature_external_gesfeature_external_pes)feature_string_interning)property_xml_stringproperty_interning_dict)expat ParserCreatezexpat not supportedN) xmlreadersaxutilshandlerc|SN)os ,/usr/lib64/python3.12/xml/sax/expatreader.py_mkproxyr!sc eZdZy) _ClosedParserN)__name__ __module__ __qualname__rrrrr(srrc,eZdZ dZdZdZdZdZy) ExpatLocatorc$t||_yr)r_refselfparsers r__init__zExpatLocator.__init__3sV$ rc`|j}|jy|jjSr)r _parserErrorColumnNumberr!s rgetColumnNumberzExpatLocator.getColumnNumber6s( >> !~~///rc`|j}|jy|jjSN)r r&ErrorLineNumberr!s r getLineNumberzExpatLocator.getLineNumber<s( >> !~~---rcT|j}|y|jjSr)r _source getPublicIdr!s rr0zExpatLocator.getPublicIdB& >~~))++rcT|j}|y|jjSr)r r/ getSystemIdr!s rr3zExpatLocator.getSystemIdHr1rN)rrrr$r(r-r0r3rrrrr-s  %0 . , ,rrceZdZ d"dZdZdZdZdZdZdZ dZ d#d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"y!)$ ExpatParserctjj||tj|_d|_||_d|_d|_g|_ d|_ d|_ y)NFr) rIncrementalParserr$ InputSourcer/r& _namespaces_lex_handler_prop_parsing _entity_stack _external_ges _interning)r"namespaceHandlingbufsizes rr$zExpatParser.__init__Ts]##,,T7; ,,.  ,!% rc tj|}||_ |j|jj t |tjj||y#|jxYwr) rprepare_input_sourcer/reset _cont_handlersetDocumentLocatorrrr7parse _close_sourcer"sources rrFzExpatParser.parseasq=..v6   JJL    1 1,t2D E  ' ' - -dF ;     s AA44Bcx|j*|jj|jyyr)r3r&SetBaserHs r prepareParserzExpatParser.prepareParserqs1     + LL !3!3!5 6 ,rc~tjj|||jr|j yyr)rr7setContentHandlerr;_reset_cont_handler)r"rs rrNzExpatParser.setContentHandlerws0##55dGD ==  $ $ & rc|tk(r |jS|tk(r|jduS|tt t fvry|tk(r |jStd|z)NrFeature '%s' not recognized) rr9r r>rrrrr=SAXNotRecognizedExceptionr"names r getFeaturezExpatParser.getFeature|sn % %## # - -??$. . (*>022 ) )%% %'(E(LMMrcj|jr td|tk(r||_y|tk(r||_y|t k(r|r|ji|_yd|_yy|tk(r|r tdy|tk(r|r tdy|tk(r|r tdytd|z)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixesrQ) r;SAXNotSupportedExceptionrr9rr=r r>rrrrR)r"rTstates r setFeaturezExpatParser.setFeatures ==*+NO O % %$D  ) )!&D  - -??*&(DO"&+' '.799) ).EGG/ /.>@@,-46 6rc<|tjk(r |jS|tk(r |jS|t k(rR|j r;t|j dr|j jStdtdtd|z)NGetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsingProperty '%s' not recognized) rproperty_lexical_handlerr:r r>r r&hasattrr[rRrWrSs r getPropertyzExpatParser.getPropertys 733 3)) ) , ,?? " ( (||4<<):;<<77993*++/DFF'(F(MNNrc|tjk(r%||_|jr|j yy|t k(r||_y|tk(rtd|ztd|z)NzProperty '%s' cannot be setr\) rr]r:r;_reset_lex_handler_propr r>r rWrR)r"rTvalues r setPropertyzExpatParser.setPropertys{ 733 3%*D "}},,. , ,#DO ( (*+H+/,01 1,,J,0-12 2rc|js1|jd|_|jj |jj ||y#t j$rO}tt j|j||}|jj|Yd}~yd}~wwxYw)NT) r;rCrD startDocumentr&Parser errorSAXParseException ErrorStringcode _err_handler fatalError)r"dataisFinaleexcs rfeedzExpatParser.feeds}} JJL DM    , , . . LL  tW -{{ .#E$5$5aff$=q$GC    ( ( - - .sAB>/AB99B>c|jy|jj} |jjd|jjdd|jj|y#tj $rO}t t j|j||}|jj|Yd}~yd}~wwxYw#|jj|wxYw)NFr) r&GetReparseDeferralEnabledSetReparseDeferralEnabledrfr rgrhrirjrkrl)r" was_enabledrorps rflushzExpatParser.flushs <<  ll<<>  @ LL 2 25 9 LL  sE * LL 2 2; ? {{ .#E$5$5aff$=q$GC    ( ( - - . LL 2 2; ?s*7A<<CACC!CC!!C>c|j} |j}||j|j}||jyy#|j}||jwwxYwr)r/getCharacterStreamclose getByteStream)r"rIfiles rrGzExpatParser._close_sourcesu ,,.D '')D  '')D  s "A%A9c|js&|jt|jtry |j dd|j j d|_d|_d|_|jGt}|jj|_|jj|_ ||_|jy#d|_|jGt}|jj|_|jj|_ ||_|jwxYw)NrT)rnF) r<r& isinstancerrqrD endDocumentr;r'r,rGr!s rryzExpatParser.closes   $,,"6 t||] 3  ! IIc4I (    * * ,!DMDL!DM||'&+/<<+I+I()-)E)E&%    "DM||'&+/<<+I+I()-)E)E&%    s ;CA,Ec|jj|j_|jj|j_yr)rDprocessingInstructionr&ProcessingInstructionHandler charactersCharacterDataHandlerr"s rrOzExpatParser._reset_cont_handlers5$($6$6$L$L 1,0,>,>,I,I )rc*|j}|j}|$d|_d|_d|_d|_d|_y|j|_|j|_|j|_|j|_|j|_yr) r:r&CommentHandlerStartCdataSectionHandlerEndCdataSectionHandlerStartDoctypeDeclHandlerEndDoctypeDeclHandlercomment startCDATAendCDATAstart_doctype_declendDTD)r"lexr#s rraz#ExpatParser._reset_lex_handler_prop s$$ ;$(F !.2F +,0F )-1F *+/F ($'KKF !.1nnF +,/LLF )-1-D-DF *+.::F (rcJ|jrtj|jj d|j |_d|j _|j|j _ |j|j _ nttj|jj |j |_|j|j _ |j|j _ |j|j|j _|j"|j _|j&|j _|j*|j _d|_|j0r|j3|j4|j _ |j8|j _|j j?tj@d|_!g|_"y#t<$rYCwxYw)N )internr+F)#r9r r r/ getEncodingr>r&namespace_prefixesstart_element_nsStartElementHandlerend_element_nsEndElementHandler start_element end_elementrOunparsed_entity_declUnparsedEntityDeclHandler notation_declNotationDeclHandlerstart_namespace_declStartNamespaceDeclHandlerend_namespace_declEndNamespaceDeclHandler_decl_handler_propr:raexternal_entity_refExternalEntityRefHandlerskipped_entity_handlerSkippedEntityHandlerAttributeErrorSetParamEntityParsing*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr;r<rs rrCzExpatParser.resets    --dll.F.F.H#59__FDL./DLL +/3/D/DDLL ,-1-@-@DLL * --dll.F.F.H7;HDL/3/A/ADLL ,-1-=-=DLL *   "151J1J .+/+=+= (151J1J ./3/F/F ,"&  ! !  ( ( *150H0H - 040K0KDLL - **  < < >    sH H"!H"cH|jy|jjSr)r&r'rs rr(zExpatParser.getColumnNumberCs << ||---rcH|jy|jjSr*)r&r,rs rr-zExpatParser.getLineNumberHs << ||+++rc6|jjSr)r/r0rs rr0zExpatParser.getPublicIdM||''))rc6|jjSr)r/r3rs rr3zExpatParser.getSystemIdPrrcN|jj|t|yr)rD startElementAttributesImpl)r"rTattrss rrzExpatParser.start_elementTs ''nU.CDrc:|jj|yr)rD endElementrSs rrzExpatParser.end_elementW %%d+rc|j}t|dk(rd|f}n$t|dk(r |d|df}n t|}i}i}|jD]c\}}|j}t|} | dk(r|} d|f} n-| dk(r|dd|d} |d|df} n|d} t|} ||| <| || <e|jj |dt ||y)Nr+r:)splitlentupleitemsrDstartElementNSAttributesNSImpl) r"rTrpairnewattrsqnamesanamerbpartslengthqnameapairs rrzExpatParser.start_element_nsZszz| t9>$$rc:|jj|yr)rDr)r"rms rcharacter_datazExpatParser.character_datarrc<|jj||yr)rDstartPrefixMapping)r"prefixuris rrz ExpatParser.start_namespace_decls --fc:rc:|jj|yr)rDendPrefixMapping)r"rs rrzExpatParser.end_namespace_decls ++F3rc>|jj|||yr)r:startDTD)r"rTsysidpubidhas_internal_subsets rrzExpatParser.start_doctype_decls ''eU;rc@|jj||||yr) _dtd_handlerunparsedEntityDecl)r"rTbaserr notation_names rrz ExpatParser.unparsed_entity_decls ,,T5%Orc>|jj|||yr)r notationDecl)r"rTrrrs rrzExpatParser.notation_decls &&tUE:rc |jsy|jj||}tj||j j xsd}|jj|j|j f|jj||_ ||_ tjj|||jd\|_ |_|jd=y#YyxYw)Nr+r)r= _ent_handler resolveEntityrrBr/r3r<appendr&ExternalEntityParserCreaterr7rF)r"contextrrrrIs rrzExpatParser.external_entity_refs!!""00>..v/3||/G/G/I02/13 !!4<<">?||>>wG     ' ' - -dF ;(,'9'9"'=$t|   r "  s 5 C??DcH|rd|z}|jj|y)N%)rD skippedEntity)r"rTis_pes rrz"ExpatParser.skipped_entity_handlers" t8D ((.rN)ri)F)#rrrr$rFrLrNrUrYr_rcrqrvrGryrOrarCr(r-r0r3rrrrrrrrrrrrrrrrr5r5Qs.  7 ' N6<O$ 2 ." @ !*J 6 # N. , **E, ND 4?,;4<P;,/rr5ct|i|Sr)r5)argskwargss r create_parserrs  ' ''r__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml)*versionxml.sax._exceptionsxml.sax.handlerrrrrrr r r xml.parsersr r^SAXReaderNotAvailable ImportErrorxml.saxrrrrr_weakrefweakrefproxyrrLocatorrr7r5rrxml.sax.saxutilsxmlprNsax XMLGeneratorsetErrorHandler ErrorHandlerrFrrrrsT !B6F4HA! 5. )#$94@@00))--  }}H  ,9$$,Hg/)--y/@/@g/V (  zA((5578cgg**,-GG HI a =  5t <<=sE)EEEEPK!])Ӝu+:+:)__pycache__/handler.cpython-312.opt-1.pycnu[ ֦i=dZdZGddZGddZGddZGdd Zd Zd Zd Zd Z dZ dZ eeee e e gZ dZ dZdZdZdZdZe eeeeegZGddZy)a0 This module contains the core classes of version 2.0 of SAX for Python. This file provides only default classes with absolutely minimum functionality, from which drivers and applications can be subclassed. Many of these classes are empty and are included only as documentation of the interfaces. $Id$ z2.0betac"eZdZdZdZdZdZy) ErrorHandleraBasic interface for SAX error handlers. If you create an object that implements this interface, then register the object with your XMLReader, the parser will call the methods in your object to report all warnings and errors. There are three levels of errors available: warnings, (possibly) recoverable errors, and unrecoverable errors. All methods take a SAXParseException as the only parameter.c|)zHandle a recoverable error.self exceptions (/usr/lib64/python3.12/xml/sax/handler.pyerrorzErrorHandler.error c|)zHandle a non-recoverable error.rrs r fatalErrorzErrorHandler.fatalError$r r ct|y)zHandle a warning.N)printrs r warningzErrorHandler.warning(s  ir N)__name__ __module__ __qualname____doc__r rrrr r rrs0r rcdeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZy)ContentHandlerzInterface for receiving logical document content events. This is the main callback interface in SAX, and the one most important to applications. The order of events in this interface mirrors the order of the information in the document.cd|_y)N_locatorrs r __init__zContentHandler.__init__6s  r c||_y)a#Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface. The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine. Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.Nr)rlocators r setDocumentLocatorz!ContentHandler.setDocumentLocator9s *  r cy)zReceive notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).Nrrs r startDocumentzContentHandler.startDocumentPr cy)aQReceive notification of the end of a document. The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.Nrrs r endDocumentzContentHandler.endDocumentWr"r cy)aBegin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default). There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary. Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.Nr)rprefixuris r startPrefixMappingz!ContentHandler.startPrefixMapping`r"r cy)zEnd the scope of a prefix-URI mapping. See startPrefixMapping for details. This event will always occur after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.Nr)rr&s r endPrefixMappingzContentHandler.endPrefixMappingwr"r cy)aSignals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an instance of the Attributes class containing the attributes of the element.Nr)rnameattrss r startElementzContentHandler.startElement~r"r cy)zSignals the end of an element in non-namespace mode. The name parameter contains the name of the element type, just as with the startElement event.Nrrr,s r endElementzContentHandler.endElementr"r cy)aSignals the start of an element in namespace mode. The name parameter contains the name of the element type as a (uri, localname) tuple, the qname parameter the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the Attributes class containing the attributes of the element. The uri part of the name tuple is None for elements which have no namespace.Nr)rr,qnamer-s r startElementNSzContentHandler.startElementNSr"r cy)zSignals the end of an element in namespace mode. The name parameter contains the name of the element type, just as with the startElementNS event.Nr)rr,r3s r endElementNSzContentHandler.endElementNSr"r cy)aReceive notification of character data. The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.Nrrcontents r characterszContentHandler.charactersr"r cy)awReceive notification of ignorable whitespace in element content. Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.Nr)r whitespaces r ignorableWhitespacez"ContentHandler.ignorableWhitespacer"r cy)aReceive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.Nr)rtargetdatas r processingInstructionz$ContentHandler.processingInstructionr"r cy)aReceive notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.Nrr0s r skippedEntityzContentHandler.skippedEntityr"r N)rrrrrrr!r$r(r*r.r1r4r6r:r=rArCrr r rr/sN=  . .C+ - 0   r rceZdZdZdZdZy) DTDHandlerzHandle DTD events. This interface specifies only those DTD events required for basic parsing (unparsed entities and attributes).cy)z$Handle a notation declaration event.Nr)rr,publicIdsystemIds r notationDeclzDTDHandler.notationDeclr"r cy)z,Handle an unparsed entity declaration event.Nr)rr,rGrHndatas r unparsedEntityDeclzDTDHandler.unparsedEntityDeclr"r N)rrrrrIrLrr r rErEs3 /7r rEceZdZdZdZy)EntityResolvera7Basic interface for resolving entities. If you create an object implementing this interface, then register the object with your Parser, the parser will call the method in your object to resolve all external entities. Note that DefaultHandler implements this interface with the default behaviour.c|S)zResolve the system identifier of an entity and return either the system identifier to read from as a string, or an InputSource to read from.r)rrGrHs r resolveEntityzEntityResolver.resolveEntitys r N)rrrrrPrr r rNrNs 2 r rNz&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictc.eZdZdZdZdZdZdZdZy)LexicalHandleraOptional SAX2 handler for lexical events. This handler is used to obtain lexical information about an XML document, that is, information about how the document was encoded (as opposed to what it contains, which is reported to the ContentHandler), such as comments and CDATA marked section boundaries. To set the LexicalHandler of an XMLReader, use the setProperty method with the property identifier 'http://xml.org/sax/properties/lexical-handler'.cy)zReports a comment anywhere in the document (including the DTD and outside the document element). content is a string that holds the contents of the comment.Nrr8s r commentzLexicalHandler.commentfr"r cy)aReport the start of the DTD declarations, if the document has an associated DTD. A startEntity event will be reported before declaration events from the external DTD subset are reported, and this can be used to infer from which subset DTD declarations derive. name is the name of the document element type, public_id the public identifier of the DTD (or None if none were supplied) and system_id the system identfier of the external subset (or None if none were supplied).Nr)rr, public_id system_ids r startDTDzLexicalHandler.startDTDlr"r cy)z$Signals the end of DTD declarations.Nrrs r endDTDzLexicalHandler.endDTDyr"r cy)zReports the beginning of a CDATA marked section. The contents of the CDATA marked section will be reported through the characters event.Nrrs r startCDATAzLexicalHandler.startCDATA|r"r cy)z*Reports the end of a CDATA marked section.Nrrs r endCDATAzLexicalHandler.endCDATAr"r N) rrrrrTrXrZr\r^rr r rRrRYs! 8G (3) 9r rRN)rversionrrrErNfeature_namespacesfeature_namespace_prefixesfeature_string_interningfeature_validationfeature_external_gesfeature_external_pes all_featuresproperty_lexical_handlerproperty_declaration_handlerproperty_dom_nodeproperty_xml_stringproperty_encodingproperty_interning_dictall_propertiesrRrr r rns  2\\B 7 7  (> NJ > O Q#*("$$ & K S =A DP+#.%#) +*9*9r PK!]ٵKK'__pycache__/_exceptions.cpython-312.pycnu[ ֦i[vdZGddeZGddeZGddeZGddeZGd d eZy ) z!Different kinds of SAX Exceptionsc0eZdZdZddZdZdZdZdZy) SAXExceptionaEncapsulate an XML error or warning. This class can contain basic error or warning information from either the XML parser or the application: you can subclass it to provide additional functionality, or to add localization. Note that although you will receive a SAXException as the argument to the handlers in the ErrorHandler interface, you are not actually required to raise the exception; instead, you can simply read the information in it.NcL||_||_tj||y)zUCreates an exception. The message is required, but the exception is optional.N)_msg _exception Exception__init__)selfmsg exceptions ,/usr/lib64/python3.12/xml/sax/_exceptions.pyrzSAXException.__init__s" #4%c|jS)z$Return a message for this exception.rr s r getMessagezSAXException.getMessage yyr c|jS)z9Return the embedded exception, or None if there was none.)rrs r getExceptionzSAXException.getExceptions r c|jS)0Create a string representation of the exception.rrs r __str__zSAXException.__str__rr ctd)zvAvoids weird error messages if someone does exception[ix] by mistake, since Exception has __getitem__ defined. __getitem__)AttributeError)r ixs r rzSAXException.__getitem__"s]++r )N) __name__ __module__ __qualname____doc__rrrrrr r rrs  &,r rc4eZdZdZdZdZdZdZdZdZ y) SAXParseExceptiona#Encapsulate an XML parse error or warning. This exception will include information for locating the error in the original XML document. Note that although the application will receive a SAXParseException as the argument to the handlers in the ErrorHandler interface, the application is not actually required to raise the exception; instead, it can simply read the information in it and take a different action. Since this exception is a subclass of SAXException, it inherits the ability to wrap another exception.ctj|||||_|jj|_|jj |_|jj|_y)zECreates the exception. The exception parameter is allowed to be None.N) rr_locator getSystemId _systemIdgetColumnNumber_colnum getLineNumber_linenum)r r r locators r rzSAXParseException.__init__7sYdC3 224}}446  335 r c|jS)zNThe column number of the end of the text where the exception occurred.)r(rs r r'z!SAXParseException.getColumnNumberDs||r c|jS)zDThe line number of the end of the text where the exception occurred.)r*rs r r)zSAXParseException.getLineNumberIs }}r c6|jjS)zEGet the public identifier of the entity where the exception occurred.)r$ getPublicIdrs r r/zSAXParseException.getPublicIdMs}}((**r c|jS)zEGet the system identifier of the entity where the exception occurred.)r&rs r r%zSAXParseException.getSystemIdQs ~~r c|j}|d}|j}|d}|j}|d}|d|d|d|jS)rz ?:z: )r%r)r'r)r sysidlinenumcolnums r rzSAXParseException.__str__Us]  " =E$$& ?G%%' >F!&CCr N) rrrrrr'r)r/r%rr r r r"r"*s& . 6 + Dr r"ceZdZdZy)SAXNotRecognizedExceptionzException class for an unrecognized identifier. An XMLReader will raise this exception when it is confronted with an unrecognized feature or property. SAX applications and extensions may use this class for similar purposes.Nrrrrr r r r8r8es,r r8ceZdZdZy)SAXNotSupportedExceptionaException class for an unsupported operation. An XMLReader will raise this exception when a service it cannot perform is requested (specifically setting a state or value). SAX applications and extensions may use this class for similar purposes.Nr9r r r r;r;osr r;ceZdZdZy)SAXReaderNotAvailableaException class for a missing driver. An XMLReader module (driver) should raise this exception when it is first imported, e.g. when a support module cannot be imported. It also may be raised during parsing, e.g. if executing an external program is not permitted.Nr9r r r r=r=ys!r r=N)rrrr"r8r;r=r r r r>sI' ,9 ,J6D 6Dv, ,|!4!r PK!]ٵKK-__pycache__/_exceptions.cpython-312.opt-1.pycnu[ ֦i[vdZGddeZGddeZGddeZGddeZGd d eZy ) z!Different kinds of SAX Exceptionsc0eZdZdZddZdZdZdZdZy) SAXExceptionaEncapsulate an XML error or warning. This class can contain basic error or warning information from either the XML parser or the application: you can subclass it to provide additional functionality, or to add localization. Note that although you will receive a SAXException as the argument to the handlers in the ErrorHandler interface, you are not actually required to raise the exception; instead, you can simply read the information in it.NcL||_||_tj||y)zUCreates an exception. The message is required, but the exception is optional.N)_msg _exception Exception__init__)selfmsg exceptions ,/usr/lib64/python3.12/xml/sax/_exceptions.pyrzSAXException.__init__s" #4%c|jS)z$Return a message for this exception.rr s r getMessagezSAXException.getMessage yyr c|jS)z9Return the embedded exception, or None if there was none.)rrs r getExceptionzSAXException.getExceptions r c|jS)0Create a string representation of the exception.rrs r __str__zSAXException.__str__rr ctd)zvAvoids weird error messages if someone does exception[ix] by mistake, since Exception has __getitem__ defined. __getitem__)AttributeError)r ixs r rzSAXException.__getitem__"s]++r )N) __name__ __module__ __qualname____doc__rrrrrr r rrs  &,r rc4eZdZdZdZdZdZdZdZdZ y) SAXParseExceptiona#Encapsulate an XML parse error or warning. This exception will include information for locating the error in the original XML document. Note that although the application will receive a SAXParseException as the argument to the handlers in the ErrorHandler interface, the application is not actually required to raise the exception; instead, it can simply read the information in it and take a different action. Since this exception is a subclass of SAXException, it inherits the ability to wrap another exception.ctj|||||_|jj|_|jj |_|jj|_y)zECreates the exception. The exception parameter is allowed to be None.N) rr_locator getSystemId _systemIdgetColumnNumber_colnum getLineNumber_linenum)r r r locators r rzSAXParseException.__init__7sYdC3 224}}446  335 r c|jS)zNThe column number of the end of the text where the exception occurred.)r(rs r r'z!SAXParseException.getColumnNumberDs||r c|jS)zDThe line number of the end of the text where the exception occurred.)r*rs r r)zSAXParseException.getLineNumberIs }}r c6|jjS)zEGet the public identifier of the entity where the exception occurred.)r$ getPublicIdrs r r/zSAXParseException.getPublicIdMs}}((**r c|jS)zEGet the system identifier of the entity where the exception occurred.)r&rs r r%zSAXParseException.getSystemIdQs ~~r c|j}|d}|j}|d}|j}|d}|d|d|d|jS)rz ?:z: )r%r)r'r)r sysidlinenumcolnums r rzSAXParseException.__str__Us]  " =E$$& ?G%%' >F!&CCr N) rrrrrr'r)r/r%rr r r r"r"*s& . 6 + Dr r"ceZdZdZy)SAXNotRecognizedExceptionzException class for an unrecognized identifier. An XMLReader will raise this exception when it is confronted with an unrecognized feature or property. SAX applications and extensions may use this class for similar purposes.Nrrrrr r r r8r8es,r r8ceZdZdZy)SAXNotSupportedExceptionaException class for an unsupported operation. An XMLReader will raise this exception when a service it cannot perform is requested (specifically setting a state or value). SAX applications and extensions may use this class for similar purposes.Nr9r r r r;r;osr r;ceZdZdZy)SAXReaderNotAvailableaException class for a missing driver. An XMLReader module (driver) should raise this exception when it is first imported, e.g. when a support module cannot be imported. It also may be raised during parsing, e.g. if executing an external program is not permitted.Nr9r r r r=r=ys!r r=N)rrrr"r8r;r=r r r r>sI' ,9 ,J6D 6Dv, ,|!4!r PK!])Ӝu+:+:#__pycache__/handler.cpython-312.pycnu[ ֦i=dZdZGddZGddZGddZGdd Zd Zd Zd Zd Z dZ dZ eeee e e gZ dZ dZdZdZdZdZe eeeeegZGddZy)a0 This module contains the core classes of version 2.0 of SAX for Python. This file provides only default classes with absolutely minimum functionality, from which drivers and applications can be subclassed. Many of these classes are empty and are included only as documentation of the interfaces. $Id$ z2.0betac"eZdZdZdZdZdZy) ErrorHandleraBasic interface for SAX error handlers. If you create an object that implements this interface, then register the object with your XMLReader, the parser will call the methods in your object to report all warnings and errors. There are three levels of errors available: warnings, (possibly) recoverable errors, and unrecoverable errors. All methods take a SAXParseException as the only parameter.c|)zHandle a recoverable error.self exceptions (/usr/lib64/python3.12/xml/sax/handler.pyerrorzErrorHandler.error c|)zHandle a non-recoverable error.rrs r fatalErrorzErrorHandler.fatalError$r r ct|y)zHandle a warning.N)printrs r warningzErrorHandler.warning(s  ir N)__name__ __module__ __qualname____doc__r rrrr r rrs0r rcdeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZy)ContentHandlerzInterface for receiving logical document content events. This is the main callback interface in SAX, and the one most important to applications. The order of events in this interface mirrors the order of the information in the document.cd|_y)N_locatorrs r __init__zContentHandler.__init__6s  r c||_y)a#Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface. The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine. Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.Nr)rlocators r setDocumentLocatorz!ContentHandler.setDocumentLocator9s *  r cy)zReceive notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).Nrrs r startDocumentzContentHandler.startDocumentPr cy)aQReceive notification of the end of a document. The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.Nrrs r endDocumentzContentHandler.endDocumentWr"r cy)aBegin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default). There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary. Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.Nr)rprefixuris r startPrefixMappingz!ContentHandler.startPrefixMapping`r"r cy)zEnd the scope of a prefix-URI mapping. See startPrefixMapping for details. This event will always occur after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.Nr)rr&s r endPrefixMappingzContentHandler.endPrefixMappingwr"r cy)aSignals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an instance of the Attributes class containing the attributes of the element.Nr)rnameattrss r startElementzContentHandler.startElement~r"r cy)zSignals the end of an element in non-namespace mode. The name parameter contains the name of the element type, just as with the startElement event.Nrrr,s r endElementzContentHandler.endElementr"r cy)aSignals the start of an element in namespace mode. The name parameter contains the name of the element type as a (uri, localname) tuple, the qname parameter the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the Attributes class containing the attributes of the element. The uri part of the name tuple is None for elements which have no namespace.Nr)rr,qnamer-s r startElementNSzContentHandler.startElementNSr"r cy)zSignals the end of an element in namespace mode. The name parameter contains the name of the element type, just as with the startElementNS event.Nr)rr,r3s r endElementNSzContentHandler.endElementNSr"r cy)aReceive notification of character data. The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.Nrrcontents r characterszContentHandler.charactersr"r cy)awReceive notification of ignorable whitespace in element content. Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.Nr)r whitespaces r ignorableWhitespacez"ContentHandler.ignorableWhitespacer"r cy)aReceive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.Nr)rtargetdatas r processingInstructionz$ContentHandler.processingInstructionr"r cy)aReceive notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.Nrr0s r skippedEntityzContentHandler.skippedEntityr"r N)rrrrrrr!r$r(r*r.r1r4r6r:r=rArCrr r rr/sN=  . .C+ - 0   r rceZdZdZdZdZy) DTDHandlerzHandle DTD events. This interface specifies only those DTD events required for basic parsing (unparsed entities and attributes).cy)z$Handle a notation declaration event.Nr)rr,publicIdsystemIds r notationDeclzDTDHandler.notationDeclr"r cy)z,Handle an unparsed entity declaration event.Nr)rr,rGrHndatas r unparsedEntityDeclzDTDHandler.unparsedEntityDeclr"r N)rrrrrIrLrr r rErEs3 /7r rEceZdZdZdZy)EntityResolvera7Basic interface for resolving entities. If you create an object implementing this interface, then register the object with your Parser, the parser will call the method in your object to resolve all external entities. Note that DefaultHandler implements this interface with the default behaviour.c|S)zResolve the system identifier of an entity and return either the system identifier to read from as a string, or an InputSource to read from.r)rrGrHs r resolveEntityzEntityResolver.resolveEntitys r N)rrrrrPrr r rNrNs 2 r rNz&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictc.eZdZdZdZdZdZdZdZy)LexicalHandleraOptional SAX2 handler for lexical events. This handler is used to obtain lexical information about an XML document, that is, information about how the document was encoded (as opposed to what it contains, which is reported to the ContentHandler), such as comments and CDATA marked section boundaries. To set the LexicalHandler of an XMLReader, use the setProperty method with the property identifier 'http://xml.org/sax/properties/lexical-handler'.cy)zReports a comment anywhere in the document (including the DTD and outside the document element). content is a string that holds the contents of the comment.Nrr8s r commentzLexicalHandler.commentfr"r cy)aReport the start of the DTD declarations, if the document has an associated DTD. A startEntity event will be reported before declaration events from the external DTD subset are reported, and this can be used to infer from which subset DTD declarations derive. name is the name of the document element type, public_id the public identifier of the DTD (or None if none were supplied) and system_id the system identfier of the external subset (or None if none were supplied).Nr)rr, public_id system_ids r startDTDzLexicalHandler.startDTDlr"r cy)z$Signals the end of DTD declarations.Nrrs r endDTDzLexicalHandler.endDTDyr"r cy)zReports the beginning of a CDATA marked section. The contents of the CDATA marked section will be reported through the characters event.Nrrs r startCDATAzLexicalHandler.startCDATA|r"r cy)z*Reports the end of a CDATA marked section.Nrrs r endCDATAzLexicalHandler.endCDATAr"r N) rrrrrTrXrZr\r^rr r rRrRYs! 8G (3) 9r rRN)rversionrrrErNfeature_namespacesfeature_namespace_prefixesfeature_string_interningfeature_validationfeature_external_gesfeature_external_pes all_featuresproperty_lexical_handlerproperty_declaration_handlerproperty_dom_nodeproperty_xml_stringproperty_encodingproperty_interning_dictall_propertiesrRrr r rns  2\\B 7 7  (> NJ > O Q#*("$$ & K S =A DP+#.%#) +*9*9r PK!]}hLL*__pycache__/saxutils.cpython-312.opt-1.pycnu[ ֦i/dZddlZddlZddlZddlZddlZddlmZddlm Z dZ ifdZ ifdZ ifd Z d ZGd d ejZGd de j"ZddZy)znA library of useful helper classes to the SAX classes, for the convenience of application and driver writers. N)handler) xmlreadercZ|jD]\}}|j||}|S)z2Replace substrings of a string using a dictionary.)itemsreplace)sdkeyvalues )/usr/lib64/python3.12/xml/sax/saxutils.py__dict_replacer s+ggi U IIc5 ! Hc|jdd}|jdd}|jdd}|r t||}|S)zEscape &, <, and > in a string of data. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. &&>><<rrdataentitiess r escapersH <<W %D <<V $D <<V $DdH- Krc|jdd}|jdd}|r t||}|jddS)a Unescape &, <, and > in a string of data. You can unescape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. rrrrrrrrs r unescaper"sD << $D << $DdH- << %%rci|dddd}t||}d|vr"d|vrd|jddz}|Sd |z}|Sd|z}|S) aEscape and quote an attribute value. Escape &, <, and > in a string of data, then quote it for use as an attribute value. The " character will be escaped as well, if necessary. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. z z z )   "'z"%s"z"z'%s')rrrs r quoteattrr$0spG(F'vFH $ !D d{ $;DLLh77D KD=D K} Krcddl}|jSttjrStt j t jfrSttjrGfdd}|}d|_ nPtj}d|_ j|_ j|_ j|_tj ||ddd S#t$rY%wxYw) Nrc2eZdZWjZfdZy) _gettextwriter.._wrapperct|SN)getattr)selfnameouts r __getattr__z,_gettextwriter.._wrapper.__getattr__ZssD))rN)__name__ __module__ __qualname__ __class__r.)r-sr _wrapperr'Xs I *rr3cyr)r5rr z _gettextwriter..]strcy)NTr5r5rr r6z _gettextwriter..bs$rxmlcharrefreplacerT)encodingerrorsnewline write_through)sysstdout isinstanceio TextIOBasecodecs StreamWriterStreamReaderWriter RawIOBasecloseBufferedIOBasewritablewriteseekabletellAttributeError TextIOWrapper)r-r9r=r3buffers` r _gettextwriterrOGs {zz#r}}% #++V-F-FGH #r||$ * *# ""$&yy  "llFO((FK   FX#6$(*. 00   s"C<< DDcdeZdZddZdZddZdZdZdZdZ d Z d Z d Z d Z d ZdZdZy) XMLGeneratorNctjj|t||}|j|_|j |_ig|_|jd|_ g|_ ||_ ||_ d|_ y)NF)rContentHandler__init__rOrI_writeflush_flush _ns_contexts_current_context_undeclared_ns_maps _encoding_short_empty_elements_pending_start_element)r+r-r9short_empty_elementss r rUzXMLGenerator.__init__rst''-S(+ii ii D $ 1 1" 5#% !%9"&+#rct|dr/d|dk(rd|dzS|j|d}|r |dz|dzS|dS)z7Builds a qualified name from a (ns_url, localname) pairrz$http://www.w3.org/XML/1998/namespacezxml:r:)rZ)r+r,prefixs r _qnamezXMLGenerator._qname~sY 7 6a@Q''**473F|d1g--AwrcN|jr|jdd|_yy)NrFr^rV)r+ endElements r _finish_pending_start_elementz*XMLGenerator._finish_pending_start_elements$  & & KK */D ' 'rc@|jd|jzy)Nz$ )rVr\r+s r startDocumentzXMLGenerator.startDocuments ;' (rc$|jyr))rXris r endDocumentzXMLGenerator.endDocuments  rc|jj|jj||j|<|jj||fyr))rYappendrZcopyr[r+rburis r startPrefixMappingzXMLGenerator.startPrefixMappingsM   !6!6!;!;!=>%+c"   '' 6rcF|jd|_|jd=y)NrS)rYrZr+rbs r endPrefixMappingzXMLGenerator.endPrefixMappings# $ 1 1" 5   b !rc |j|jd|z|jD]%\}}|jd|dt|'|jrd|_y|jdy)Nr =Tr)rgrVrr$r]r^)r+r,attrsr s r startElementzXMLGenerator.startElementse **, C$J"[[]MT5 KKD)E*:; <+  % %*.D ' KK rcv|jr|jdd|_y|jd|zyNz/>Fzrer+r,s r rfzXMLGenerator.endElements/  & & KK */D ' KK$ 'rc |j|jd|j|z|jD]4\}}|r|jd|d|d!|jd|z6g|_|j D]4\}}|jd|j|dt |6|j rd|_y|jd y) Nrz xmlns:z="r"z xmlns="%s"rwrxTr)rgrVrcr[rr$r]r^)r+r,qnameryrbrqr s r startElementNSzXMLGenerator.startElementNSs **, C$++d++,33KFC <= MC/0 4 $& "[[]MT5 KKDKK$5y7GH I+  % %*.D ' KK rc|jr|jdd|_y|jd|j|zyr|)r^rVrcr+r,rs r endElementNSzXMLGenerator.endElementNSs9  & & KK */D ' KK$++d"33 4rc|rQ|jt|tst||j}|j t |yyr))rgr?strr\rVrr+contents r characterszXMLGenerator.characterss@   . . 0gs+gt~~6 KKw ( rc|rH|jt|tst||j}|j |yyr))rgr?rr\rVrs r ignorableWhitespacez XMLGenerator.ignorableWhitespaces<   . . 0gs+gt~~6 KK rcT|j|jd|d|dy)Nz)rgrVr+targetrs r processingInstructionz"XMLGenerator.processingInstructions **, 6401r)Nz iso-8859-1F)F)r/r0r1rUrcrgrjrlrrrurzrfrrrrrr5rr rQrQpsH ,"0(7 "($5)!2rrQceZdZdZddZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZy) XMLFilterBaseaYThis class is designed to sit between an XMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.NcPtjj|||_yr))r XMLReaderrU_parentr+parents r rUzXMLFilterBase.__init__s$$T* rc:|jj|yr)) _err_handlererrorr+ exceptions r rzXMLFilterBase.errors  *rc:|jj|yr))r fatalErrorrs r rzXMLFilterBase.fatalErrors $$Y/rc:|jj|yr))rwarningrs r rzXMLFilterBase.warnings !!),rc:|jj|yr)) _cont_handlersetDocumentLocator)r+locators r rz XMLFilterBase.setDocumentLocators --g6rc8|jjyr))rrjris r rjzXMLFilterBase.startDocuments ((*rc8|jjyr))rrlris r rlzXMLFilterBase.endDocuments &&(rc<|jj||yr))rrrrps r rrz XMLFilterBase.startPrefixMappings --fc:rc:|jj|yr))rrurts r ruzXMLFilterBase.endPrefixMappings ++F3rc<|jj||yr))rrz)r+r,rys r rzzXMLFilterBase.startElement  ''e4rc:|jj|yr))rrfr}s r rfzXMLFilterBase.endElements %%d+rc>|jj|||yr))rr)r+r,rrys r rzXMLFilterBase.startElementNSs ))$u=rc<|jj||yr))rrrs r rzXMLFilterBase.endElementNSrrc:|jj|yr))rrrs r rzXMLFilterBase.characterss %%g.rc:|jj|yr))rr)r+charss r rz!XMLFilterBase.ignorableWhitespaces ..u5rc<|jj||yr))rrrs r rz#XMLFilterBase.processingInstructions 00>rc:|jj|yr))r skippedEntityr}s r rzXMLFilterBase.skippedEntity s ((.rc>|jj|||yr)) _dtd_handler notationDecl)r+r,publicIdsystemIds r rzXMLFilterBase.notationDecl%s &&tXx@rc@|jj||||yr))runparsedEntityDecl)r+r,rrndatas r rz XMLFilterBase.unparsedEntityDecl(s ,,T8XuMrc:|jj||Sr)) _ent_handler resolveEntity)r+rrs r rzXMLFilterBase.resolveEntity-s  ..xBBrc|jj||jj||jj||jj ||jj |yr))rsetContentHandlersetErrorHandlersetEntityResolver setDTDHandlerparse)r+sources r rzXMLFilterBase.parse2s\ &&t, $$T* &&t, ""4( 6"rc:|jj|yr))r setLocale)r+locales r rzXMLFilterBase.setLocale9s v&rc8|jj|Sr))r getFeaturer}s r rzXMLFilterBase.getFeature<s||&&t,,rc<|jj||yr))r setFeature)r+r,states r rzXMLFilterBase.setFeature?s e,rc8|jj|Sr))r getPropertyr}s r rzXMLFilterBase.getPropertyBs||''--rc<|jj||yr))r setProperty)r+r,r s r rzXMLFilterBase.setPropertyEs   u-rc|jSr)rris r getParentzXMLFilterBase.getParentJs ||rc||_yr)rrs r setParentzXMLFilterBase.setParentMs  rr)) r/r0r1__doc__rUrrrrrjrlrrrurzrfrrrrrrrrrrrrrrrrrr5rr rrs +0- 7+);45,>5/6?/ AN C #'--.. rrcjt|tjrtj|}t|trt j |}nt|dr|}t j }t|jdtr|j|n|j|t|dr5t|jtr|j|j|j'|j|j}tj j#tj j%|}tj j'||}tj j)|r|j|t+|d}n\|jt,j.j1||t,j2j5|j}|j||S)zThis function takes an InputSource and an optional base URL and returns a fully resolved InputSource object ready for reading.readrr,rb)r?osPathLikefspathrr InputSourcehasattrrsetCharacterStream setByteStreamr, setSystemIdgetCharacterStream getByteStream getSystemIdpathdirnamenormpathjoinisfileopenurllibrurljoinrequesturlopen)rbasefsysidbasehead sysidfilenames r prepare_input_sourcerRs&"++&6"&#&&v.  &&( affQi %  % %a (   # 1f *QVVS"9   qvv &   "*v/C/C/E/M""$77??277#3#3D#9: Xu5 77>>- (   } -]D)A   v||33D%@ A&&v'9'9';rsv ('    & .'0Rp27))p2fkI''k^rPK!]7[I[L[L%__pycache__/xmlreader.cpython-312.pycnu[ ֦iP1dZddlmZddlmZmZGddZGddeZGdd ZGd d Z Gd d Z Gdde Z dZ e dk(re yy)z]An XML Reader is the SAX 2 name for an XML parser. XML Parsers should be based on this code. )handler)SAXNotSupportedExceptionSAXNotRecognizedExceptioncjeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZy) XMLReadera%Interface for reading an XML document using callbacks. XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse. All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.ctj|_tj|_tj |_tj|_yN) rContentHandler _cont_handler DTDHandler _dtd_handlerEntityResolver _ent_handler ErrorHandler _err_handlerselfs */usr/lib64/python3.12/xml/sax/xmlreader.py__init__zXMLReader.__init__sF$335#..0#224#002ctd)zAParse an XML document from a system identifier or an InputSource. This method must be implemented!NotImplementedErrorrsources rparsezXMLReader.parses!"DEErc|jS)z#Returns the current ContentHandler.r rs rgetContentHandlerzXMLReader.getContentHandler"s!!!rc||_y)z:Registers a new object to receive document content events.Nrrrs rsetContentHandlerzXMLReader.setContentHandler&s $rc|jS)z Returns the current DTD handler.r rs r getDTDHandlerzXMLReader.getDTDHandler*   rc||_y)z7Register an object to receive basic DTD-related events.Nr%r"s r setDTDHandlerzXMLReader.setDTDHandler. #rc|jS)z#Returns the current EntityResolver.rrs rgetEntityResolverzXMLReader.getEntityResolver2r'rc||_y)z0Register an object to resolve external entities.Nr,)rresolvers rsetEntityResolverzXMLReader.setEntityResolver6s $rc|jS)z!Returns the current ErrorHandler.rrs rgetErrorHandlerzXMLReader.getErrorHandler:r'rc||_y)z3Register an object to receive error-message events.Nr2r"s rsetErrorHandlerzXMLReader.setErrorHandler>r*rctd)aHAllow an application to set the locale for errors and warnings. SAX parsers are not required to provide localization for errors and warnings; if they cannot support the requested locale, however, they must raise a SAX exception. Applications may request a locale change in the middle of a parse.zLocale support not implemented)r)rlocales r setLocalezXMLReader.setLocaleBs''GHHrctd|z)z1Looks up and returns the state of a SAX2 feature.Feature '%s' not recognizedrrnames r getFeaturezXMLReader.getFeatureK'(E(LMMrctd|z)z!Sets the state of a SAX2 feature.r:r;)rr=states r setFeaturezXMLReader.setFeatureOr?rctd|z)z2Looks up and returns the value of a SAX2 property.Property '%s' not recognizedr;r<s r getPropertyzXMLReader.getPropertyS'(F(MNNrctd|z)z"Sets the value of a SAX2 property.rDr;)rr=values r setPropertyzXMLReader.setPropertyWrFrN)__name__ __module__ __qualname____doc__rrr r#r&r)r-r0r3r5r8r>rBrErIrrrr sX 3 F"%!$!%!$INNOOrrc6eZdZdZd dZdZdZdZdZdZ y) IncrementalParserasThis interface adds three extra methods to the XMLReader interface that allow XML parsers to support incremental parsing. Support for this interface is optional, since not all underlying XML parsers support this functionality. When the parser is instantiated it is ready to begin accepting data from the feed method immediately. After parsing has been finished with a call to close the reset method must be called to make the parser ready to accept new data, either from feed or using the parse method. Note that these methods must _not_ be called during parsing, that is, after parse has been called and before it returns. By default, the class also implements the parse method of the XMLReader interface using the feed, close and reset methods of the IncrementalParser interface as a convenience to SAX 2.0 driver writers.c<||_tj|yr )_bufsizerr)rbufsizes rrzIncrementalParser.__init__os 4 rcPddlm}|j|}|j||j }||j }|j |jx}r/|j||j |jx}r/|jy)Nr)saxutils) rUprepare_input_source prepareParsergetCharacterStream getByteStreamreadrRfeedclose)rrrUfilebuffers rrzIncrementalParser.parsess..v6 6"((* <'')D $--00f0 IIf  $--00f0 rctd)aThis method gives the raw XML data in the data parameter to the parser and makes it parse the data, emitting the corresponding events. It is allowed for XML constructs to be split across several calls to feed. feed may raise SAXException.rr)rdatas rr\zIncrementalParser.feeds""DEErctd)ztThis method is called by the parse implementation to allow the SAX 2.0 driver to prepare itself for parsing.z!prepareParser must be overridden!rrs rrXzIncrementalParser.prepareParsers""EFFrctd)aThis method is called when the entire XML document has been passed to the parser through the feed method, to notify the parser that there are no more data. This allows the parser to do the final checks on the document and empty the internal data buffer. The parser will not be ready to parse another document until the reset method has been called. close may raise SAXException.rrrs rr]zIncrementalParser.closes""DEErctd)zThis method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.rrrs rresetzIncrementalParser.resets ""DEErN)i) rJrKrLrMrrr\rXr]rerNrrrPrP[s)&! FG FFrrPc(eZdZdZdZdZdZdZy)LocatorzInterface for associating a SAX event with a document location. A locator object will return valid results only during calls to DocumentHandler methods; at any other time, the results are unpredictable.cy)z6Return the column number where the current event ends.rNrs rgetColumnNumberzLocator.getColumnNumberrcy)z4Return the line number where the current event ends.rirNrs r getLineNumberzLocator.getLineNumberrkrcy)z3Return the public identifier for the current event.NrNrs r getPublicIdzLocator.getPublicIdrcy)z3Return the system identifier for the current event.NrNrs r getSystemIdzLocator.getSystemIdrprN)rJrKrLrMrjrmrorrrNrrrgrgs" rrgcTeZdZdZddZdZdZdZdZdZ d Z d Z d Z d Z d Zy) InputSourceanEncapsulation of the information needed by the XMLReader to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will create objects of this class for use in the XMLReader.parse method and for returning from EntityResolver.resolveEntity. An InputSource belongs to the application, the XMLReader is not allowed to modify InputSource objects passed to it from the application, although it may make copies and modify those.NcJ||_d|_d|_d|_d|_yr )_InputSource__system_id_InputSource__public_id_InputSource__encoding_InputSource__bytefile_InputSource__charfiler system_ids rrzInputSource.__init__s'$rc||_y)z/Sets the public identifier of this InputSource.Nrw)r public_ids r setPublicIdzInputSource.setPublicId $rc|jS)z2Returns the public identifier of this InputSource.r~rs rrozInputSource.getPublicIdrc||_y)z/Sets the system identifier of this InputSource.Nrvr{s r setSystemIdzInputSource.setSystemIdrrc|jS)z2Returns the system identifier of this InputSource.rrs rrrzInputSource.getSystemIdrrc||_y)a4Sets the character encoding of this InputSource. The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML recommendation). The encoding attribute of the InputSource is ignored if the InputSource also contains a character stream.Nrx)rencodings r setEncodingzInputSource.setEncoding #rc|jS)z/Get the character encoding of this InputSource.rrs r getEncodingzInputSource.getEncoding rc||_y)aSet the byte stream (a Python file-like object which does not perform byte-to-character conversion) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself. If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.Nry)rbytefiles r setByteStreamzInputSource.setByteStreams #rc|jS)zGet the byte stream for this input source. The getEncoding method will return the character encoding for this byte stream, or None if unknown.rrs rrZzInputSource.getByteStreams rc||_y)a^Set the character stream for this input source. (The stream must be a Python 2.0 Unicode-wrapped file-like that performs conversion to Unicode strings.) If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.Nrz)rcharfiles rsetCharacterStreamzInputSource.setCharacterStreamrrc|jS)z/Get the character stream for this input source.rrs rrYzInputSource.getCharacterStreamrrr )rJrKrLrMrrrorrrrrrrZrrYrNrrrtrts? B % % # ##rrtcteZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZddZdZdZdZy)AttributesImplc||_y)zQNon-NS-aware implementation. attrs should be of the form {name : value}.N_attrs)rattrss rrzAttributesImpl.__init__s  rc,t|jSr lenrrs r getLengthzAttributesImpl.getLength4;;rcy)NCDATArNr<s rgetTypezAttributesImpl.getTypesrc |j|Sr rr<s rgetValuezAttributesImpl.getValue"{{4  rc |j|Sr rr<s rgetValueByQNamezAttributesImpl.getValueByQName%rrc8||jvr t||Sr rKeyErrorr<s rgetNameByQNamezAttributesImpl.getNameByQName( t{{ "4.  rc8||jvr t||Sr rr<s rgetQNameByNamezAttributesImpl.getQNameByName-rrcHt|jjSr listrkeysrs rgetNameszAttributesImpl.getNames2DKK$$&''rcHt|jjSr rrs r getQNameszAttributesImpl.getQNames5rrc,t|jSr rrs r__len__zAttributesImpl.__len__8rrc |j|Sr rr<s r __getitem__zAttributesImpl.__getitem__;rrcHt|jjSr rrs rrzAttributesImpl.keys>rrc||jvSr rr<s r __contains__zAttributesImpl.__contains__Ast{{""rNc:|jj||Sr )rget)rr= alternatives rrzAttributesImpl.getDs{{t[11rc8|j|jSr ) __class__rrs rcopyzAttributesImpl.copyGs~~dkk**rcHt|jjSr )rritemsrs rrzAttributesImpl.itemsJsDKK%%'((rcHt|jjSr )rrvaluesrs rrzAttributesImpl.valuesMsDKK&&())rr )rJrKrLrrrrrrrrrrrrrrrrrrNrrrrsW  !!  (( !(#2+)*rrc0eZdZdZdZdZdZdZdZy)AttributesNSImplc ||_||_y)zNS-aware implementation. attrs should be of the form {(ns_uri, lname): value, ...}. qnames of the form {(ns_uri, lname): qname, ...}.N)r_qnames)rrqnamess rrzAttributesNSImpl.__init__Ts   rc|jjD]\}}||k(s |j|cSt|r )rrrrrr=nsnameqnames rrz AttributesNSImpl.getValueByQName\s?#||113OVU}{{6** 4tnrcn|jjD]\}}||k(s |cSt|r )rrrrs rrzAttributesNSImpl.getNameByQNamecs5#||113OVU}  4tnrc |j|Sr )rr<s rrzAttributesNSImpl.getQNameByNamejs||D!!rcHt|jjSr )rrrrs rrzAttributesNSImpl.getQNamesmsDLL'')**rcN|j|j|jSr )rrrrs rrzAttributesNSImpl.copyps~~dkk4<<88rN) rJrKrLrrrrrrrNrrrrRs "+9rrc@tttyr )rrPrgrNrr_testrts K Ir__main__N)rMrVr _exceptionsrrrrPrgrtrrrrJrNrrrsz"L NONO`DF DFP0UUr:*:*|9~9D  z GrPK!];cDFDF*__pycache__/saxutils.cpython-312.opt-2.pycnu[ ֦i/ ddlZddlZddlZddlZddlZddlmZddlmZdZ ifdZ ifdZ ifdZ d Z Gd d ejZGd d ej ZddZy)N)handler) xmlreaderc\ |jD]\}}|j||}|SN)itemsreplace)sdkeyvalues )/usr/lib64/python3.12/xml/sax/saxutils.py__dict_replacer s.<ggi U IIc5 ! Hc |jdd}|jdd}|jdd}|r t||}|S)N&&>><<r rdataentitiess rescapersM <<W %D <<V $D <<V $DdH- Krc |jdd}|jdd}|r t||}|jddS)Nrrrrrrrrs runescaper"sI << $D << $DdH- << %%rc i|dddd}t||}d|vr"d|vrd|jddz}|Sd |z}|Sd|z}|S) Nz z z )   "'z"%s"z"z'%s')rr rs r quoteattrr%0su G(F'vFH $ !D d{ $;DLLh77D KD=D K} Krcddl}|jSttjrStt j t jfrSttjrGfdd}|}d|_ nPtj}d|_ j|_ j|_ j|_tj ||ddd S#t$rY%wxYw) Nrc2eZdZWjZfdZy) _gettextwriter.._wrapperct|Sr)getattr)selfnameouts r __getattr__z,_gettextwriter.._wrapper.__getattr__ZssD))rN)__name__ __module__ __qualname__ __class__r.)r-sr_wrapperr(Xs I *rr3cyrr5rrz _gettextwriter..]strcy)NTr5r5rrr6z _gettextwriter..bs$rxmlcharrefreplacer T)encodingerrorsnewline write_through)sysstdout isinstanceio TextIOBasecodecs StreamWriterStreamReaderWriter RawIOBasecloseBufferedIOBasewritablewriteseekabletellAttributeError TextIOWrapper)r-r9r=r3buffers` r_gettextwriterrOGs {zz#r}}% #++V-F-FGH #r||$ * *# ""$&yy  "llFO((FK   FX#6$(*. 00   s"C<< DDcdeZdZddZdZddZdZdZdZdZ d Z d Z d Z d Z d ZdZdZy) XMLGeneratorNctjj|t||}|j|_|j |_ig|_|jd|_ g|_ ||_ ||_ d|_ y)NF)rContentHandler__init__rOrI_writeflush_flush _ns_contexts_current_context_undeclared_ns_maps _encoding_short_empty_elements_pending_start_element)r+r-r9short_empty_elementss rrUzXMLGenerator.__init__rst''-S(+ii ii D $ 1 1" 5#% !%9"&+#rcv |dr/d|dk(rd|dzS|j|d}|r |dz|dzS|dS)Nrz$http://www.w3.org/XML/1998/namespacezxml:r:)rZ)r+r,prefixs r_qnamezXMLGenerator._qname~s\E 7 6a@Q''**473F|d1g--AwrcN|jr|jdd|_yy)NrFr^rV)r+ endElements r_finish_pending_start_elementz*XMLGenerator._finish_pending_start_elements$  & & KK */D ' 'rc@|jd|jzy)Nz$ )rVr\r+s r startDocumentzXMLGenerator.startDocuments ;' (rc$|jyr)rXris r endDocumentzXMLGenerator.endDocuments  rc|jj|jj||j|<|jj||fyr)rYappendrZcopyr[r+rburis rstartPrefixMappingzXMLGenerator.startPrefixMappingsM   !6!6!;!;!=>%+c"   '' 6rcF|jd|_|jd=y)NrS)rYrZr+rbs rendPrefixMappingzXMLGenerator.endPrefixMappings# $ 1 1" 5   b !rc |j|jd|z|jD]%\}}|jd|dt|'|jrd|_y|jdy)Nr =Tr)rgrVrr%r]r^)r+r,attrsr s r startElementzXMLGenerator.startElementse **, C$J"[[]MT5 KKD)E*:; <+  % %*.D ' KK rcv|jr|jdd|_y|jd|zyNz/>Fzrer+r,s rrfzXMLGenerator.endElements/  & & KK */D ' KK$ 'rc |j|jd|j|z|jD]4\}}|r|jd|d|d!|jd|z6g|_|j D]4\}}|jd|j|dt |6|j rd|_y|jd y) Nrz xmlns:z="r#z xmlns="%s"rwrxTr)rgrVrcr[rr%r]r^)r+r,qnameryrbrqr s rstartElementNSzXMLGenerator.startElementNSs **, C$++d++,33KFC <= MC/0 4 $& "[[]MT5 KKDKK$5y7GH I+  % %*.D ' KK rc|jr|jdd|_y|jd|j|zyr|)r^rVrcr+r,rs r endElementNSzXMLGenerator.endElementNSs9  & & KK */D ' KK$++d"33 4rc|rQ|jt|tst||j}|j t |yyr)rgr?strr\rVrr+contents r characterszXMLGenerator.characterss@   . . 0gs+gt~~6 KKw ( rc|rH|jt|tst||j}|j |yyr)rgr?rr\rVrs rignorableWhitespacez XMLGenerator.ignorableWhitespaces<   . . 0gs+gt~~6 KK rcT|j|jd|d|dy)Nz)rgrVr+targetrs rprocessingInstructionz"XMLGenerator.processingInstructions **, 6401r)Nz iso-8859-1F)F)r/r0r1rUrcrgrjrlrrrurzrfrrrrrr5rrrQrQpsH ,"0(7 "($5)!2rrQceZdZ ddZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZy) XMLFilterBaseNcPtjj|||_yr)r XMLReaderrU_parentr+parents rrUzXMLFilterBase.__init__s$$T* rc:|jj|yr) _err_handlererrorr+ exceptions rrzXMLFilterBase.errors  *rc:|jj|yr)r fatalErrorrs rrzXMLFilterBase.fatalErrors $$Y/rc:|jj|yr)rwarningrs rrzXMLFilterBase.warnings !!),rc:|jj|yr) _cont_handlersetDocumentLocator)r+locators rrz XMLFilterBase.setDocumentLocators --g6rc8|jjyr)rrjris rrjzXMLFilterBase.startDocuments ((*rc8|jjyr)rrlris rrlzXMLFilterBase.endDocuments &&(rc<|jj||yr)rrrrps rrrz XMLFilterBase.startPrefixMappings --fc:rc:|jj|yr)rrurts rruzXMLFilterBase.endPrefixMappings ++F3rc<|jj||yr)rrz)r+r,rys rrzzXMLFilterBase.startElement  ''e4rc:|jj|yr)rrfr}s rrfzXMLFilterBase.endElements %%d+rc>|jj|||yr)rr)r+r,rrys rrzXMLFilterBase.startElementNSs ))$u=rc<|jj||yr)rrrs rrzXMLFilterBase.endElementNSrrc:|jj|yr)rrrs rrzXMLFilterBase.characterss %%g.rc:|jj|yr)rr)r+charss rrz!XMLFilterBase.ignorableWhitespaces ..u5rc<|jj||yr)rrrs rrz#XMLFilterBase.processingInstructions 00>rc:|jj|yr)r skippedEntityr}s rrzXMLFilterBase.skippedEntity s ((.rc>|jj|||yr) _dtd_handler notationDecl)r+r,publicIdsystemIds rrzXMLFilterBase.notationDecl%s &&tXx@rc@|jj||||yr)runparsedEntityDecl)r+r,rrndatas rrz XMLFilterBase.unparsedEntityDecl(s ,,T8XuMrc:|jj||Sr) _ent_handler resolveEntity)r+rrs rrzXMLFilterBase.resolveEntity-s  ..xBBrc|jj||jj||jj||jj ||jj |yr)rsetContentHandlersetErrorHandlersetEntityResolver setDTDHandlerparse)r+sources rrzXMLFilterBase.parse2s\ &&t, $$T* &&t, ""4( 6"rc:|jj|yr)r setLocale)r+locales rrzXMLFilterBase.setLocale9s v&rc8|jj|Sr)r getFeaturer}s rrzXMLFilterBase.getFeature<s||&&t,,rc<|jj||yr)r setFeature)r+r,states rrzXMLFilterBase.setFeature?s e,rc8|jj|Sr)r getPropertyr}s rrzXMLFilterBase.getPropertyBs||''--rc<|jj||yr)r setProperty)r+r,r s rrzXMLFilterBase.setPropertyEs   u-rc|jSrrris r getParentzXMLFilterBase.getParentJs ||rc||_yrrrs r setParentzXMLFilterBase.setParentMs  rr)r/r0r1rUrrrrrjrlrrrurzrfrrrrrrrrrrrrrrrrrr5rrrrs +0- 7+);45,>5/6?/ AN C #'--.. rrcl t|tjrtj|}t|trt j |}nt|dr|}t j }t|jdtr|j|n|j|t|dr5t|jtr|j|j|j'|j|j}tj j#tj j%|}tj j'||}tj j)|r|j|t+|d}n\|jt,j.j1||t,j2j5|j}|j||S)Nreadrr,rb)r?osPathLikefspathrr InputSourcehasattrrsetCharacterStream setByteStreamr, setSystemIdgetCharacterStream getByteStream getSystemIdpathdirnamenormpathjoinisfileopenurllibrurljoinrequesturlopen)rbasefsysidbasehead sysidfilenames rprepare_input_sourcerRsF&"++&6"&#&&v.  &&( affQi %  % %a (   # 1f *QVVS"9   qvv &   "*v/C/C/E/M""$77??277#3#3D#9: Xu5 77>>- (   } -]D)A   v||33D%@ A&&v'9'9';rsv ('    & .'0Rp27))p2fkI''k^rPK!]})__pycache__/handler.cpython-312.opt-2.pycnu[ ֦i= dZGddZGddZGddZGddZd Zd Zd Zd Zd Z dZ eeeee e gZ dZ dZ dZdZdZdZe ee eeegZGddZy)z2.0betac eZdZ dZdZdZy) ErrorHandlerc |Nself exceptions (/usr/lib64/python3.12/xml/sax/handler.pyerrorzErrorHandler.error s %c |rrrs r fatalErrorzErrorHandler.fatalError$s )r c t|yr)printrs r warningzErrorHandler.warning(s  ir N)__name__ __module__ __qualname__r rrrr r rrs0r rcbeZdZ dZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZy)ContentHandlercd|_yr_locatorrs r __init__zContentHandler.__init__6s  r c ||_yrr)rlocators r setDocumentLocatorz!ContentHandler.setDocumentLocator9s G(  r cyrrrs r startDocumentzContentHandler.startDocumentPs r cyrrrs r endDocumentzContentHandler.endDocumentWs r cyrr)rprefixuris r startPrefixMappingz!ContentHandler.startPrefixMapping`s r cyrr)rr$s r endPrefixMappingzContentHandler.endPrefixMappingws Cr cyrr)rnameattrss r startElementzContentHandler.startElement~s r cyrrrr*s r endElementzContentHandler.endElements +r cyrr)rr*qnamer+s r startElementNSzContentHandler.startElementNSs r cyrr)rr*r1s r endElementNSzContentHandler.endElementNSs -r cyrrrcontents r characterszContentHandler.characterss 0r cyrr)r whitespaces r ignorableWhitespacez"ContentHandler.ignorableWhitespaces r cyrr)rtargetdatas r processingInstructionz$ContentHandler.processingInstructions r cyrrr.s r skippedEntityzContentHandler.skippedEntitys r N)rrrrrr r"r&r(r,r/r2r4r8r;r?rArr r rr/sN=  . .C+ - 0   r rceZdZ dZdZy) DTDHandlercyrr)rr*publicIdsystemIds r notationDeclzDTDHandler.notationDecls.r cyrr)rr*rErFndatas r unparsedEntityDeclzDTDHandler.unparsedEntityDecls6r N)rrrrGrJrr r rCrCs3 /7r rCceZdZ dZy)EntityResolverc |Srr)rrErFs r resolveEntityzEntityResolver.resolveEntitys r N)rrrrNrr r rLrLs 2 r rLz&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictc,eZdZ dZdZdZdZdZy)LexicalHandlercyrrr6s r commentzLexicalHandler.commentfs Gr cyrr)rr* public_id system_ids r startDTDzLexicalHandler.startDTDls (r cyrrrs r endDTDzLexicalHandler.endDTDys2r cyrrrs r startCDATAzLexicalHandler.startCDATA|s )r cyrrrs r endCDATAzLexicalHandler.endCDATAs8r N)rrrrRrVrXrZr\rr r rPrPYs! 8G (3) 9r rPN)versionrrrCrLfeature_namespacesfeature_namespace_prefixesfeature_string_interningfeature_validationfeature_external_gesfeature_external_pes all_featuresproperty_lexical_handlerproperty_declaration_handlerproperty_dom_nodeproperty_xml_stringproperty_encodingproperty_interning_dictall_propertiesrPrr r rls  2\\B 7 7  (> NJ > O Q#*("$$ & K S =A DP+#.%#) +*9*9r PK!]uJ>ss-__pycache__/_exceptions.cpython-312.opt-2.pycnu[ ֦i[t GddeZGddeZGddeZGddeZGdd eZy ) c.eZdZ ddZdZdZdZdZy) SAXExceptionNcN ||_||_tj||yN)_msg _exception Exception__init__)selfmsg exceptions ,/usr/lib64/python3.12/xml/sax/_exceptions.pyr zSAXException.__init__s%  #4%c |jSrrr s r getMessagezSAXException.getMessages.yyrc |jSr)rrs r getExceptionzSAXException.getExceptionsCrc |jSrrrs r __str__zSAXException.__str__s:yyrc td)N __getitem__)AttributeError)r ixs r rzSAXException.__getitem__"s =]++rr)__name__ __module__ __qualname__r rrrrrr rrs  &,rrc2eZdZ dZdZdZdZdZdZy)SAXParseExceptionc tj|||||_|jj|_|jj |_|jj|_yr) rr _locator getSystemId _systemIdgetColumnNumber_colnum getLineNumber_linenum)r r r locators r r zSAXParseException.__init__7s\OdC3 224}}446  335 rc |jSr)r&rs r r%z!SAXParseException.getColumnNumberDs ||rc |jSr)r(rs r r'zSAXParseException.getLineNumberIsN}}rc8 |jjSr)r" getPublicIdrs r r-zSAXParseException.getPublicIdMsO}}((**rc |jSr)r$rs r r#zSAXParseException.getSystemIdQsO~~rc |j}|d}|j}|d}|j}|d}|d|d|d|jS)Nz ?:z: )r#r'r%r)r sysidlinenumcolnums r rzSAXParseException.__str__Us`:  " =E$$& ?G%%' >F!&CCrN) rrrr r%r'r-r#rrrr r r *s& . 6 + Drr c eZdZy)SAXNotRecognizedExceptionNrrrrrr r6r6es,rr6c eZdZy)SAXNotSupportedExceptionNr7rrr r9r9osrr9c eZdZy)SAXReaderNotAvailableNr7rrr r;r;ys!rr;N)rrr r6r9r;rrr r<sI' ,9 ,J6D 6Dv, ,|!4!rPK!]}hLL$__pycache__/saxutils.cpython-312.pycnu[ ֦i/dZddlZddlZddlZddlZddlZddlmZddlm Z dZ ifdZ ifdZ ifd Z d ZGd d ejZGd de j"ZddZy)znA library of useful helper classes to the SAX classes, for the convenience of application and driver writers. N)handler) xmlreadercZ|jD]\}}|j||}|S)z2Replace substrings of a string using a dictionary.)itemsreplace)sdkeyvalues )/usr/lib64/python3.12/xml/sax/saxutils.py__dict_replacer s+ggi U IIc5 ! Hc|jdd}|jdd}|jdd}|r t||}|S)zEscape &, <, and > in a string of data. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. &&>><<rrdataentitiess r escapersH <<W %D <<V $D <<V $DdH- Krc|jdd}|jdd}|r t||}|jddS)a Unescape &, <, and > in a string of data. You can unescape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. rrrrrrrrs r unescaper"sD << $D << $DdH- << %%rci|dddd}t||}d|vr"d|vrd|jddz}|Sd |z}|Sd|z}|S) aEscape and quote an attribute value. Escape &, <, and > in a string of data, then quote it for use as an attribute value. The " character will be escaped as well, if necessary. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. z z z )   "'z"%s"z"z'%s')rrrs r quoteattrr$0spG(F'vFH $ !D d{ $;DLLh77D KD=D K} Krcddl}|jSttjrStt j t jfrSttjrGfdd}|}d|_ nPtj}d|_ j|_ j|_ j|_tj ||ddd S#t$rY%wxYw) Nrc2eZdZWjZfdZy) _gettextwriter.._wrapperct|SN)getattr)selfnameouts r __getattr__z,_gettextwriter.._wrapper.__getattr__ZssD))rN)__name__ __module__ __qualname__ __class__r.)r-sr _wrapperr'Xs I *rr3cyr)r5rr z _gettextwriter..]strcy)NTr5r5rr r6z _gettextwriter..bs$rxmlcharrefreplacerT)encodingerrorsnewline write_through)sysstdout isinstanceio TextIOBasecodecs StreamWriterStreamReaderWriter RawIOBasecloseBufferedIOBasewritablewriteseekabletellAttributeError TextIOWrapper)r-r9r=r3buffers` r _gettextwriterrOGs {zz#r}}% #++V-F-FGH #r||$ * *# ""$&yy  "llFO((FK   FX#6$(*. 00   s"C<< DDcdeZdZddZdZddZdZdZdZdZ d Z d Z d Z d Z d ZdZdZy) XMLGeneratorNctjj|t||}|j|_|j |_ig|_|jd|_ g|_ ||_ ||_ d|_ y)NF)rContentHandler__init__rOrI_writeflush_flush _ns_contexts_current_context_undeclared_ns_maps _encoding_short_empty_elements_pending_start_element)r+r-r9short_empty_elementss r rUzXMLGenerator.__init__rst''-S(+ii ii D $ 1 1" 5#% !%9"&+#rct|dr/d|dk(rd|dzS|j|d}|r |dz|dzS|dS)z7Builds a qualified name from a (ns_url, localname) pairrz$http://www.w3.org/XML/1998/namespacezxml:r:)rZ)r+r,prefixs r _qnamezXMLGenerator._qname~sY 7 6a@Q''**473F|d1g--AwrcN|jr|jdd|_yy)NrFr^rV)r+ endElements r _finish_pending_start_elementz*XMLGenerator._finish_pending_start_elements$  & & KK */D ' 'rc@|jd|jzy)Nz$ )rVr\r+s r startDocumentzXMLGenerator.startDocuments ;' (rc$|jyr))rXris r endDocumentzXMLGenerator.endDocuments  rc|jj|jj||j|<|jj||fyr))rYappendrZcopyr[r+rburis r startPrefixMappingzXMLGenerator.startPrefixMappingsM   !6!6!;!;!=>%+c"   '' 6rcF|jd|_|jd=y)NrS)rYrZr+rbs r endPrefixMappingzXMLGenerator.endPrefixMappings# $ 1 1" 5   b !rc |j|jd|z|jD]%\}}|jd|dt|'|jrd|_y|jdy)Nr =Tr)rgrVrr$r]r^)r+r,attrsr s r startElementzXMLGenerator.startElementse **, C$J"[[]MT5 KKD)E*:; <+  % %*.D ' KK rcv|jr|jdd|_y|jd|zyNz/>Fzrer+r,s r rfzXMLGenerator.endElements/  & & KK */D ' KK$ 'rc |j|jd|j|z|jD]4\}}|r|jd|d|d!|jd|z6g|_|j D]4\}}|jd|j|dt |6|j rd|_y|jd y) Nrz xmlns:z="r"z xmlns="%s"rwrxTr)rgrVrcr[rr$r]r^)r+r,qnameryrbrqr s r startElementNSzXMLGenerator.startElementNSs **, C$++d++,33KFC <= MC/0 4 $& "[[]MT5 KKDKK$5y7GH I+  % %*.D ' KK rc|jr|jdd|_y|jd|j|zyr|)r^rVrcr+r,rs r endElementNSzXMLGenerator.endElementNSs9  & & KK */D ' KK$++d"33 4rc|rQ|jt|tst||j}|j t |yyr))rgr?strr\rVrr+contents r characterszXMLGenerator.characterss@   . . 0gs+gt~~6 KKw ( rc|rH|jt|tst||j}|j |yyr))rgr?rr\rVrs r ignorableWhitespacez XMLGenerator.ignorableWhitespaces<   . . 0gs+gt~~6 KK rcT|j|jd|d|dy)Nz)rgrVr+targetrs r processingInstructionz"XMLGenerator.processingInstructions **, 6401r)Nz iso-8859-1F)F)r/r0r1rUrcrgrjrlrrrurzrfrrrrrr5rr rQrQpsH ,"0(7 "($5)!2rrQceZdZdZddZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZy) XMLFilterBaseaYThis class is designed to sit between an XMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.NcPtjj|||_yr))r XMLReaderrU_parentr+parents r rUzXMLFilterBase.__init__s$$T* rc:|jj|yr)) _err_handlererrorr+ exceptions r rzXMLFilterBase.errors  *rc:|jj|yr))r fatalErrorrs r rzXMLFilterBase.fatalErrors $$Y/rc:|jj|yr))rwarningrs r rzXMLFilterBase.warnings !!),rc:|jj|yr)) _cont_handlersetDocumentLocator)r+locators r rz XMLFilterBase.setDocumentLocators --g6rc8|jjyr))rrjris r rjzXMLFilterBase.startDocuments ((*rc8|jjyr))rrlris r rlzXMLFilterBase.endDocuments &&(rc<|jj||yr))rrrrps r rrz XMLFilterBase.startPrefixMappings --fc:rc:|jj|yr))rrurts r ruzXMLFilterBase.endPrefixMappings ++F3rc<|jj||yr))rrz)r+r,rys r rzzXMLFilterBase.startElement  ''e4rc:|jj|yr))rrfr}s r rfzXMLFilterBase.endElements %%d+rc>|jj|||yr))rr)r+r,rrys r rzXMLFilterBase.startElementNSs ))$u=rc<|jj||yr))rrrs r rzXMLFilterBase.endElementNSrrc:|jj|yr))rrrs r rzXMLFilterBase.characterss %%g.rc:|jj|yr))rr)r+charss r rz!XMLFilterBase.ignorableWhitespaces ..u5rc<|jj||yr))rrrs r rz#XMLFilterBase.processingInstructions 00>rc:|jj|yr))r skippedEntityr}s r rzXMLFilterBase.skippedEntity s ((.rc>|jj|||yr)) _dtd_handler notationDecl)r+r,publicIdsystemIds r rzXMLFilterBase.notationDecl%s &&tXx@rc@|jj||||yr))runparsedEntityDecl)r+r,rrndatas r rz XMLFilterBase.unparsedEntityDecl(s ,,T8XuMrc:|jj||Sr)) _ent_handler resolveEntity)r+rrs r rzXMLFilterBase.resolveEntity-s  ..xBBrc|jj||jj||jj||jj ||jj |yr))rsetContentHandlersetErrorHandlersetEntityResolver setDTDHandlerparse)r+sources r rzXMLFilterBase.parse2s\ &&t, $$T* &&t, ""4( 6"rc:|jj|yr))r setLocale)r+locales r rzXMLFilterBase.setLocale9s v&rc8|jj|Sr))r getFeaturer}s r rzXMLFilterBase.getFeature<s||&&t,,rc<|jj||yr))r setFeature)r+r,states r rzXMLFilterBase.setFeature?s e,rc8|jj|Sr))r getPropertyr}s r rzXMLFilterBase.getPropertyBs||''--rc<|jj||yr))r setProperty)r+r,r s r rzXMLFilterBase.setPropertyEs   u-rc|jSr)rris r getParentzXMLFilterBase.getParentJs ||rc||_yr)rrs r setParentzXMLFilterBase.setParentMs  rr)) r/r0r1__doc__rUrrrrrjrlrrrurzrfrrrrrrrrrrrrrrrrrr5rr rrs +0- 7+);45,>5/6?/ AN C #'--.. rrcjt|tjrtj|}t|trt j |}nt|dr|}t j }t|jdtr|j|n|j|t|dr5t|jtr|j|j|j'|j|j}tj j#tj j%|}tj j'||}tj j)|r|j|t+|d}n\|jt,j.j1||t,j2j5|j}|j||S)zThis function takes an InputSource and an optional base URL and returns a fully resolved InputSource object ready for reading.readrr,rb)r?osPathLikefspathrr InputSourcehasattrrsetCharacterStream setByteStreamr, setSystemIdgetCharacterStream getByteStream getSystemIdpathdirnamenormpathjoinisfileopenurllibrurljoinrequesturlopen)rbasefsysidbasehead sysidfilenames r prepare_input_sourcerRs&"++&6"&#&&v.  &&( affQi %  % %a (   # 1f *QVVS"9   qvv &   "*v/C/C/E/M""$77??277#3#3D#9: Xu5 77>>- (   } -]D)A   v||33D%@ A&&v'9'9';rsv ('    & .'0Rp27))p2fkI''k^rPK!]~ *__pycache__/__init__.cpython-312.opt-2.pycnu[ ֦i " ddlmZddlmZmZddlmZmZmZm Z m Z efdZ efdZ dgZ dZerddlZddlZddlZej&j(s,d ej*vrej*d j-d Z [[d d Zd Zy)) InputSource)ContentHandler ErrorHandler) SAXExceptionSAXNotRecognizedExceptionSAXParseExceptionSAXNotSupportedExceptionSAXReaderNotAvailablec~t}|j||j||j|y)N) make_parsersetContentHandlersetErrorHandlerparse)sourcehandler errorHandlerparsers )/usr/lib64/python3.12/xml/sax/__init__.pyrrs1 ]F W% <( LLcTddl}| t}t}|j||j |t }t |tr!|j|j|n |j|j||j|y)N) iorr r rr isinstancestrsetCharacterStreamStringIO setByteStreamBytesIOr)stringrrrrinpsrcs r parseStringr!#s #~ ]F W% <( ]F&#!!"++f"56RZZ/0 LLrzxml.sax.expatreaderrN PY_SAX_PARSER,c t|tzD]} t|cSt dd#t$rddl}||j vrY>  !+. .? 2D 99  ckk)*%   s 2AAAc@t|iidg}|jS)N create_parser) __import__r.)r, drv_modules rr'r'\s$K2.?@J  # # %%r)) xmlreaderrrrr _exceptionsrrrr r rr!r&_falsexml.sax.expatreaderxmlosr)flagsignore_environmentenvironsplitr r'r1rrr<s*#1.. )5 /;n $--   yy##2::(E**_5;;C@:4&rPK!]ޏOTOT'__pycache__/expatreader.cpython-312.pycnu[ ֦i>dZdZddlddlmZmZddlmZddlmZmZddlm Z ddlm Z m Z  dd l m Z ee d s ed d dd lmZmZmZej*Zej,Z dd lZdd lZej2Z[[GddZGddej8ZGddej<ej8ZdZ e!dk(rydd l"Z#e Z$e$jKe#jLj&jOe$jQe#jLjSe$jUdy y #e$r ed d wxYw#e$rdZYwxYw)z] SAX driver for the pyexpat C module. This driver works with pyexpat.__version__ == '2.22'. z0.20)*)feature_validationfeature_namespaces)feature_namespace_prefixes)feature_external_gesfeature_external_pes)feature_string_interning)property_xml_stringproperty_interning_dict)expat ParserCreatezexpat not supportedN) xmlreadersaxutilshandlerc|SN)os ,/usr/lib64/python3.12/xml/sax/expatreader.py_mkproxyr!sc eZdZy) _ClosedParserN)__name__ __module__ __qualname__rrrrr(srrc.eZdZdZdZdZdZdZdZy) ExpatLocatorzLocator for use with the ExpatParser class. This uses a weak reference to the parser object to avoid creating a circular reference between the parser and the content handler. c$t||_yr)r_refselfparsers r__init__zExpatLocator.__init__3sV$ rc`|j}|jy|jjSr)r _parserErrorColumnNumberr!s rgetColumnNumberzExpatLocator.getColumnNumber6s( >> !~~///rc`|j}|jy|jjSN)r r&ErrorLineNumberr!s r getLineNumberzExpatLocator.getLineNumber<s( >> !~~---rcT|j}|y|jjSr)r _source getPublicIdr!s rr0zExpatLocator.getPublicIdB& >~~))++rcT|j}|y|jjSr)r r/ getSystemIdr!s rr3zExpatLocator.getSystemIdHr1rN) rrr__doc__r$r(r-r0r3rrrrr-s  %0 . , ,rrceZdZdZd#dZdZdZdZdZdZ dZ d Z d$d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#y")% ExpatParserz$SAX driver for the pyexpat C module.ctjj||tj|_d|_||_d|_d|_g|_ d|_ d|_ y)NFr) rIncrementalParserr$ InputSourcer/r& _namespaces_lex_handler_prop_parsing _entity_stack _external_ges _interning)r"namespaceHandlingbufsizes rr$zExpatParser.__init__Ts]##,,T7; ,,.  ,!% rctj|}||_ |j|jj t |tjj||y#|jxYw)z3Parse an XML document from a URL or an InputSource.N) rprepare_input_sourcer/reset _cont_handlersetDocumentLocatorrrr8parse _close_sourcer"sources rrGzExpatParser.parseasn..v6   JJL    1 1,t2D E  ' ' - -dF ;     s AA33Bcx|j*|jj|jyyr)r3r&SetBaserIs r prepareParserzExpatParser.prepareParserqs1     + LL !3!3!5 6 ,rc~tjj|||jr|j yyr)rr8setContentHandlerr<_reset_cont_handler)r"rs rrOzExpatParser.setContentHandlerws0##55dGD ==  $ $ & rc|tk(r |jS|tk(r|jduS|tt t fvry|tk(r |jStd|z)NrFeature '%s' not recognized) rr:r r?rrrrr>SAXNotRecognizedExceptionr"names r getFeaturezExpatParser.getFeature|sn % %## # - -??$. . (*>022 ) )%% %'(E(LMMrcj|jr td|tk(r||_y|tk(r||_y|t k(r|r|ji|_yd|_yy|tk(r|r tdy|tk(r|r tdy|tk(r|r tdytd|z)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixesrR) r<SAXNotSupportedExceptionrr:rr>r r?rrrrS)r"rUstates r setFeaturezExpatParser.setFeatures ==*+NO O % %$D  ) )!&D  - -??*&(DO"&+' '.799) ).EGG/ /.>@@,-46 6rc<|tjk(r |jS|tk(r |jS|t k(rR|j r;t|j dr|j jStdtdtd|z)NGetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsingProperty '%s' not recognized) rproperty_lexical_handlerr;r r?r r&hasattrr\rSrXrTs r getPropertyzExpatParser.getPropertys 733 3)) ) , ,?? " ( (||4<<):;<<77993*++/DFF'(F(MNNrc|tjk(r%||_|jr|j yy|t k(r||_y|tk(rtd|ztd|z)NzProperty '%s' cannot be setr]) rr^r;r<_reset_lex_handler_propr r?r rXrS)r"rUvalues r setPropertyzExpatParser.setPropertys{ 733 3%*D "}},,. , ,#DO ( (*+H+/,01 1,,J,0-12 2rc|js1|jd|_|jj |jj ||y#t j$rO}tt j|j||}|jj|Yd}~yd}~wwxYw)NT) r<rDrE startDocumentr&Parser errorSAXParseException ErrorStringcode _err_handler fatalError)r"dataisFinaleexcs rfeedzExpatParser.feeds}} JJL DM    , , . . LL  tW -{{ .#E$5$5aff$=q$GC    ( ( - - .sAB>/AB99B>c|jy|jj} |jjd|jjdd|jj|y#tj $rO}t t j|j||}|jj|Yd}~yd}~wwxYw#|jj|wxYw)NFr) r&GetReparseDeferralEnabledSetReparseDeferralEnabledrgr rhrirjrkrlrm)r" was_enabledrprqs rflushzExpatParser.flushs <<  ll<<>  @ LL 2 25 9 LL  sE * LL 2 2; ? {{ .#E$5$5aff$=q$GC    ( ( - - . LL 2 2; ?s*7A<<CACC!CC!!C>c|j} |j}||j|j}||jyy#|j}||jwwxYwr)r/getCharacterStreamclose getByteStream)r"rJfiles rrHzExpatParser._close_sourcesu ,,.D '')D  '')D  s "A%A9c|js&|jt|jtry |j dd|j j d|_d|_d|_|jGt}|jj|_|jj|_ ||_|jy#d|_|jGt}|jj|_|jj|_ ||_|jwxYw)NrT)roF) r=r& isinstancerrrrE endDocumentr<r'r,rHr!s rrzzExpatParser.closes   $,,"6 t||] 3  ! IIc4I (    * * ,!DMDL!DM||'&+/<<+I+I()-)E)E&%    "DM||'&+/<<+I+I()-)E)E&%    s ;CA,Ec|jj|j_|jj|j_yr)rEprocessingInstructionr&ProcessingInstructionHandler charactersCharacterDataHandlerr"s rrPzExpatParser._reset_cont_handlers5$($6$6$L$L 1,0,>,>,I,I )rc*|j}|j}|$d|_d|_d|_d|_d|_y|j|_|j|_|j|_|j|_|j|_yr) r;r&CommentHandlerStartCdataSectionHandlerEndCdataSectionHandlerStartDoctypeDeclHandlerEndDoctypeDeclHandlercomment startCDATAendCDATAstart_doctype_declendDTD)r"lexr#s rrbz#ExpatParser._reset_lex_handler_prop s$$ ;$(F !.2F +,0F )-1F *+/F ($'KKF !.1nnF +,/LLF )-1-D-DF *+.::F (rcJ|jrtj|jj d|j |_d|j _|j|j _ |j|j _ nttj|jj |j |_|j|j _ |j|j _ |j|j|j _|j"|j _|j&|j _|j*|j _d|_|j0r|j3|j4|j _ |j8|j _|j j?tj@d|_!g|_"y#t<$rYCwxYw)N )internr+F)#r:r r r/ getEncodingr?r&namespace_prefixesstart_element_nsStartElementHandlerend_element_nsEndElementHandler start_element end_elementrPunparsed_entity_declUnparsedEntityDeclHandler notation_declNotationDeclHandlerstart_namespace_declStartNamespaceDeclHandlerend_namespace_declEndNamespaceDeclHandler_decl_handler_propr;rbexternal_entity_refExternalEntityRefHandlerskipped_entity_handlerSkippedEntityHandlerAttributeErrorSetParamEntityParsing*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr<r=rs rrDzExpatParser.resets    --dll.F.F.H#59__FDL./DLL +/3/D/DDLL ,-1-@-@DLL * --dll.F.F.H7;HDL/3/A/ADLL ,-1-=-=DLL *   "151J1J .+/+=+= (151J1J ./3/F/F ,"&  ! !  ( ( *150H0H - 040K0KDLL - **  < < >    sH H"!H"cH|jy|jjSr)r&r'rs rr(zExpatParser.getColumnNumberCs << ||---rcH|jy|jjSr*)r&r,rs rr-zExpatParser.getLineNumberHs << ||+++rc6|jjSr)r/r0rs rr0zExpatParser.getPublicIdM||''))rc6|jjSr)r/r3rs rr3zExpatParser.getSystemIdPrrcN|jj|t|yr)rE startElementAttributesImpl)r"rUattrss rrzExpatParser.start_elementTs ''nU.CDrc:|jj|yr)rE endElementrTs rrzExpatParser.end_elementW %%d+rc|j}t|dk(rd|f}n$t|dk(r |d|df}n t|}i}i}|jD]c\}}|j}t|} | dk(r|} d|f} n-| dk(r|dd|d} |d|df} n|d} t|} ||| <| || <e|jj |dt ||y)Nr+r:)splitlentupleitemsrEstartElementNSAttributesNSImpl) r"rUrpairnewattrsqnamesanamercpartslengthqnameapairs rrzExpatParser.start_element_nsZszz| t9>$$rc:|jj|yr)rEr)r"rns rcharacter_datazExpatParser.character_datarrc<|jj||yr)rEstartPrefixMapping)r"prefixuris rrz ExpatParser.start_namespace_decls --fc:rc:|jj|yr)rEendPrefixMapping)r"rs rrzExpatParser.end_namespace_decls ++F3rc>|jj|||yr)r;startDTD)r"rUsysidpubidhas_internal_subsets rrzExpatParser.start_doctype_decls ''eU;rc@|jj||||yr) _dtd_handlerunparsedEntityDecl)r"rUbaserr notation_names rrz ExpatParser.unparsed_entity_decls ,,T5%Orc>|jj|||yr)r notationDecl)r"rUrrrs rrzExpatParser.notation_decls &&tUE:rc |jsy|jj||}tj||j j xsd}|jj|j|j f|jj||_ ||_ tjj|||jd\|_ |_|jd=y#YyxYw)Nr+r)r> _ent_handler resolveEntityrrCr/r3r=appendr&ExternalEntityParserCreaterr8rG)r"contextrrrrJs rrzExpatParser.external_entity_refs!!""00>..v/3||/G/G/I02/13 !!4<<">?||>>wG     ' ' - -dF ;(,'9'9"'=$t|   r "  s 5 C??DcH|rd|z}|jj|y)N%)rE skippedEntity)r"rUis_pes rrz"ExpatParser.skipped_entity_handlers" t8D ((.rN)ri)F)$rrrr4r$rGrMrOrVrZr`rdrrrwrHrzrPrbrDr(r-r0r3rrrrrrrrrrrrrrrrr6r6Qs.  7 ' N6<O$ 2 ." @ !*J 6 # N. , **E, ND 4?,;4<P;,/rr6ct|i|Sr)r6)argskwargss r create_parserrs  ' ''r__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml)+r4versionxml.sax._exceptionsxml.sax.handlerrrrrrr r r xml.parsersr r_SAXReaderNotAvailable ImportErrorxml.saxrrrrr_weakrefweakrefproxyrrLocatorrr8r6rrxml.sax.saxutilsxmlprOsax XMLGeneratorsetErrorHandler ErrorHandlerrGrrrrsT !B6F4HA! 5. )#$94@@00))--  }}H  ,9$$,Hg/)--y/@/@g/V (  zA((5578cgg**,-GG HI a =  5t <<=sE*EEEEPK!]1$__pycache__/__init__.cpython-312.pycnu[ ֦i $dZddlmZddlmZmZddlmZmZm Z m Z m Z efdZ efdZ dgZdZerdd lZdd lZdd lZej(j*s,d ej,vrej,d j/d Z[[dd Zd Zy )aSimple API for XML (SAX) implementation for Python. This module provides an implementation of the SAX 2 interface; information about the Java version of the interface can be found at http://www.megginson.com/SAX/. The Python version of the interface is documented at <...>. This package contains the following modules: handler -- Base classes and constants which define the SAX 2 API for the 'client-side' of SAX for Python. saxutils -- Implementation of the convenience classes commonly used to work with SAX. xmlreader -- Base classes and constants which define the SAX 2 API for the parsers used with SAX for Python. expatreader -- Driver that allows use of the Expat parser with SAX. ) InputSource)ContentHandler ErrorHandler) SAXExceptionSAXNotRecognizedExceptionSAXParseExceptionSAXNotSupportedExceptionSAXReaderNotAvailablec~t}|j||j||j|y)N) make_parsersetContentHandlersetErrorHandlerparse)sourcehandler errorHandlerparsers )/usr/lib64/python3.12/xml/sax/__init__.pyrrs1 ]F W% <( LLcTddl}| t}t}|j||j |t }t |tr!|j|j|n |j|j||j|y)N) iorr r rr isinstancestrsetCharacterStreamStringIO setByteStreamBytesIOr)stringrrrrinpsrcs r parseStringr!#s #~ ]F W% <( ]F&#!!"++f"56RZZ/0 LLrzxml.sax.expatreaderrN PY_SAX_PARSER,ct|tzD]} t|cSt dd#t$rddl}||j vrY>  !+. .? 2D 99  ckk)*%   s 1AAAc@t|iidg}|jS)N create_parser) __import__r.)r, drv_modules rr'r'\s$K2.?@J  # # %%r))__doc__ xmlreaderrrrr _exceptionsrrrr r rr!r&_falsexml.sax.expatreaderxmlosr)flagsignore_environmentenvironsplitr r'r1rrr=s*#1.. )5 /;n $--   yy##2::(E**_5;;C@:4&rPK|]_&00(__pycache__/handler.cpython-36.opt-1.pycnu[PK|]}>>)s0__pycache__/__init__.cpython-36.opt-2.pycnu[PK|]+((* 9__pycache__/xmlreader.cpython-36.opt-2.pycnu[PK|]oڐ++)Ab__pycache__/saxutils.cpython-36.opt-2.pycnu[PK|]leBB$*__pycache__/xmlreader.cpython-36.pycnu[PK|]&y 2 2)__pycache__/saxutils.cpython-36.opt-1.pycnu[PK|]k0k0,__pycache__/expatreader.cpython-36.opt-1.pycnu[PK|])[[,3__pycache__/_exceptions.cpython-36.opt-1.pycnu[PK|]Šb..,zI__pycache__/expatreader.cpython-36.opt-2.pycnu[PK|]VZ Z #x__pycache__/__init__.cpython-36.pycnu[PK|]b=n(Q__pycache__/handler.cpython-36.opt-2.pycnu[PK|]&y 2 2#C__pycache__/saxutils.cpython-36.pycnu[PK|]VZ Z )__pycache__/__init__.cpython-36.opt-1.pycnu[PK|]_&00"R__pycache__/handler.cpython-36.pycnu[PK|]k0k0&__pycache__/expatreader.cpython-36.pycnu[PK|])[[&7__pycache__/_exceptions.cpython-36.pycnu[PK|]P' ,1M__pycache__/_exceptions.cpython-36.opt-2.pycnu[PK|]leBB*vX__pycache__/xmlreader.cpython-36.opt-1.pycnu[PK|]// saxutils.pynu[PK|]ᶨP1P1 xmlreader.pynu[PK|]R>>expatreader.pynu[PK|]9== r;handler.pynu[PK|]|.x x__init__.pynu[PK|]C[[_exceptions.pynu[PKA ]'ZE;E;'expatreader.pycnu[PKB ]hj __init__.pycnu[PKB ]'ZE;E;expatreader.pyonu[PKB ]/ _exceptions.pycnu[PKB ]hj d6__init__.pyonu[PKB ]/AE_exceptions.pyonu[PKB ]ȳKK ]xmlreader.pyonu[PKB ]deq22 handler.pycnu[PKB ]99  saxutils.pycnu[PKB ]deq22 handler.pyonu[PKB ]ȳKK 7Ixmlreader.pycnu[PKB ]99 saxutils.pyonu[PK]Z;AA*__pycache__/xmlreader.cpython-38.opt-1.pycnu[PK]-y2y2#__pycache__/saxutils.cpython-38.pycnu[PK]bк((*C__pycache__/xmlreader.cpython-38.opt-2.pycnu[PK]nn)l__pycache__/__init__.cpython-38.opt-2.pycnu[PK](00&Uu__pycache__/expatreader.cpython-38.pycnu[PK]-y2y2)|__pycache__/saxutils.cpython-38.opt-1.pycnu[PK]G2& #N__pycache__/__init__.cpython-38.pycnu[PK]6/6/,6__pycache__/expatreader.cpython-38.opt-2.pycnu[PK]s`  ,__pycache__/_exceptions.cpython-38.opt-2.pycnu[PK]dTۈ00(?!__pycache__/handler.cpython-38.opt-1.pycnu[PK] FF,R__pycache__/_exceptions.cpython-38.opt-1.pycnu[PK]e=--(g__pycache__/handler.cpython-38.opt-2.pycnu[PK](00,Fz__pycache__/expatreader.cpython-38.opt-1.pycnu[PK]|Ik-,,)s__pycache__/saxutils.cpython-38.opt-2.pycnu[PK]Z;AA$__pycache__/xmlreader.cpython-38.pycnu[PK]G2& )__pycache__/__init__.cpython-38.opt-1.pycnu[PK]dTۈ00"&__pycache__/handler.cpython-38.pycnu[PK] FF&W__pycache__/_exceptions.cpython-38.pycnu[PK!]1*Tm__pycache__/__init__.cpython-312.opt-1.pycnu[PK!]jM\!c4c4+y|__pycache__/xmlreader.cpython-312.opt-2.pycnu[PK!]7[I[L[L+7__pycache__/xmlreader.cpython-312.opt-1.pycnu[PK!]ޏOTOT-__pycache__/expatreader.cpython-312.opt-1.pycnu[PK!]RR-R __pycache__/expatreader.cpython-312.opt-2.pycnu[PK!])Ӝu+:+:) __pycache__/handler.cpython-312.opt-1.pycnu[PK!]ٵKK'? __pycache__/_exceptions.cpython-312.pycnu[PK!]ٵKK- __pycache__/_exceptions.cpython-312.opt-1.pycnu[PK!])Ӝu+:+:# __pycache__/handler.cpython-312.pycnu[PK!]}hLL*L __pycache__/saxutils.cpython-312.opt-1.pycnu[PK!]7[I[L[L% __pycache__/xmlreader.cpython-312.pycnu[PK!];cDFDF* __pycache__/saxutils.cpython-312.opt-2.pycnu[PK!]}):, __pycache__/handler.cpython-312.opt-2.pycnu[PK!]uJ>ss-|C __pycache__/_exceptions.cpython-312.opt-2.pycnu[PK!]}hLL$LR __pycache__/saxutils.cpython-312.pycnu[PK!]~ *+ __pycache__/__init__.cpython-312.opt-2.pycnu[PK!]ޏOTOT'5 __pycache__/expatreader.cpython-312.pycnu[PK!]1$ __pycache__/__init__.cpython-312.pycnu[PKHHf