KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache
System : Linux cs317.bluehost.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : andertr9 ( 1047)
PHP Version : 8.2.18
Disable Function : NONE
Directory :  /lib64/python2.7/site-packages/lxml/isoschematron/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib64/python2.7/site-packages/lxml/isoschematron/__init__.pyc
�
�qPc	@sRdZddlZddlZddlmZyeWnek
rOe	ZnXye
Wnek
rqe	Z
nXyeWnek
r�e	ZnXdddddd	d
ddg	Zd
Z
dZdZdZdeZde
Zejjejje�d�Zejejejjedd���Zejejejjedd���Zejejejjeddd���Zejejejjeddd���Zejejejjeddd���Zejddied6�Z ej!ejejjedd���Z"d�Z#d �Z$dej%fd!��YZ&dS("sxThe ``lxml.isoschematron`` package implements ISO Schematron support on top
of the pure-xslt 'skeleton' implementation.
i����N(tetreetextract_xsdtextract_rngtiso_dsdl_includetiso_abstract_expandtiso_svrl_for_xslt1tsvrl_validation_errorstschematron_schema_validtstylesheet_paramst
Schematrons http://www.w3.org/2001/XMLSchemas#http://relaxng.org/ns/structure/1.0s$http://purl.oclc.org/dsdl/schematronshttp://purl.oclc.org/dsdl/svrls
{%s}schemat	resourcestxslsXSD2Schtrn.xslsRNG2Schtrn.xslsiso-schematron-xslt1siso_dsdl_include.xslsiso_abstract_expand.xslsiso_svrl_for_xslt1.xsls//svrl:failed-assertt
namespacestsvrltrngsiso-schematron.rngcKs�i}x�|j�D]v\}}t|t�rCtjj|�}n<|dkr^td��n!t|tj�st	|�}n|||<qW|S(s)Convert keyword args to a dictionary of stylesheet parameters.
    XSL stylesheet parameters must be XPath expressions, i.e.:
     * string expressions, like "'5'"
     * simple (number) expressions, like "5"
     * valid XPath expressions, like "/a/b/text()"
    This function converts native Python keyword arguments to stylesheet
    parameters following these rules:
    If an arg is a string wrap it with XSLT.strparam().
    If an arg is an XPath object use its path string.
    If arg is None raise TypeError.
    Else convert arg to string.
    s*None not allowed as a stylesheet parameterN(
titemst
isinstancet
basestringt_etreetXSLTtstrparamtNonet	TypeErrortXPathtunicode(tkwargstresulttkeytval((sA/usr/lib64/python2.7/site-packages/lxml/isoschematron/__init__.pyRKs
cCsRt|�}x3|j�D]%\}}|dk	r|||<qqWt|�}|S(s�Return a copy of paramsDict, updated with kwargsDict entries, wrapped as
    stylesheet arguments.
    kwargsDict entries with a value of None are ignored.
    N(tdictRRR(t
paramsDictt
kwargsDicttktv((sA/usr/lib64/python2.7/site-packages/lxml/isoschematron/__init__.pyt_stylesheet_param_dictescBs�eZdZejjZejjZ	ej
jZd�Z
eZeZeZeZeZeZddeeiiieeedd�Zd�Zd�Ze edej�Zd�Z!e e!de!j�Z!d�Z"e e"de"j�Z"RS(	sW
An ISO Schematron validator.

    Pass a root Element or an ElementTree to turn it into a validator.
    Alternatively, pass a filename as keyword argument 'file' to parse from
    the file system.
    Built on the Schematron language 'reference' skeleton pure-xslt
    implementation, the validator is created as an XSLT 1.0 stylesheet using
    these steps:

     0) (Extract from XML Schema or RelaxNG schema)
     1) Process inclusions
     2) Process abstract patterns
     3) Compile the schematron schema to XSLT

    The ``include`` and ``expand`` keyword arguments can be used to switch off
    steps 1) and 2).
    To set parameters for steps 1), 2) and 3) hand parameter dictionaries to the
    keyword arguments ``include_params``, ``expand_params`` or
    ``compile_params``.
    For convenience, the compile-step parameter ``phase`` is also exposed as a
    keyword argument ``phase``. This takes precedence if the parameter is also
    given in the parameter dictionary.
    If ``store_schematron`` is set to True, the (included-and-expanded)
    schematron document tree is stored and available through the ``schematron``
    property.
    If ``store_xslt`` is set to True, the validation XSLT document tree will be
    stored and can be retrieved through the ``validator_xslt`` property.
    With ``store_report`` set to True (default: False), the resulting validation
    report document gets stored and can be accessed as the ``validation_report``
    property.

    Schematron is a less well known, but very powerful schema language.  The main
    idea is to use the capabilities of XPath to put restrictions on the structure
    and the content of XML documents.  Here is a simple example::

      >>> from lxml import isoschematron
      >>> schematron = isoschematron.Schematron(etree.XML('''
      ... <schema xmlns="http://purl.oclc.org/dsdl/schematron" >
      ...   <pattern id="id_only_attribute">
      ...     <title>id is the only permitted attribute name</title>
      ...     <rule context="*">
      ...       <report test="@*[not(name()='id')]">Attribute
      ...         <name path="@*[not(name()='id')]"/> is forbidden<name/>
      ...       </report>
      ...     </rule>
      ...   </pattern>
      ... </schema>
      ... '''))

      >>> xml = etree.XML('''
      ... <AAA name="aaa">
      ...   <BBB id="bbb"/>
      ...   <CCC color="ccc"/>
      ... </AAA>
      ... ''')

      >>> schematron.validate(xml)
      0

      >>> xml = etree.XML('''
      ... <AAA id="aaa">
      ...   <BBB id="bbb"/>
      ...   <CCC/>
      ... </AAA>
      ... ''')

      >>> schematron.validate(xml)
      1
    cCsSd}|jtkr'|j|�}n(|j|jtkrO|j|�}n|S(s
Extract embedded schematron schema from non-schematron host schema.
        This method will only be called by __init__ if the given schema document
        is not a schematron schema by itself.
        Must return a schematron schema document tree or None.
        N(Rttagt_xml_schema_roott_extract_xsdtnsmaptprefixt
RELAXNG_NSt_extract_rng(tselftelementt
schematron((sA/usr/lib64/python2.7/site-packages/lxml/isoschematron/__init__.pyt_extract�scCs�tt|�j�|
|_d|_d|_d|_y^|dk	rpt|t	j
�ra|}q�|j�}n$|dk	r�t	j|�j�}nWn.t
k
r�t	jdtj�d��nX|dkr�td��n|jtkr�|}
n|j|�}
|
dkr&t	jd��n|rA|j|
|�}
n|r\|j|
|�}
nt|
�s�t	jdtj��n|r�|
|_ni|d6}t||�}|j|
|�}|	r�||_nt	j|�|_dS(NsNo tree or file given: %sis
Empty trees=Document is not a schematron schema or schematron-extractablesinvalid schematron schema: %stphase(tsuperR	t__init__t
_store_reportRt_schematront_validator_xsltt_validation_reportRRt_Elementtgetroottparset	ExceptiontSchematronParseErrortsystexc_infot
ValueErrorR#t_schematron_rootR-t_includet_expandRt	error_logR"t_compileRt
_validator(R*Rtfiletincludetexpandtinclude_paramst
expand_paramstcompile_paramststore_schematront
store_xslttstore_reportR.trootR,tcompile_kwargstvalidator_xslt((sA/usr/lib64/python2.7/site-packages/lxml/isoschematron/__init__.pyR0�sN					
	
cCs�|j�|j|�}|jr.||_n|j|�}|r�t|tj�rp|j�j	j
pjd}n|j	j
pd}xN|D]F}|jd|jd|j
d|jdddtj|�d|�q�WtStS(	saValidate doc using Schematron.

        Returns true if document is valid, false if not.
        s<file>tdomainttypetleveltlineitmessagetfilename(t_clear_error_logRBR1R4t_validation_errorsRRR5tgetroottreetdocinfotURLt_append_log_messaget_domaint_error_typet_levelt	tounicodetFalsetTrue(R*RRterrorstfnameterror((sA/usr/lib64/python2.7/site-packages/lxml/isoschematron/__init__.pyt__call__s 
	
	cCs|jS(srISO-schematron schema document (None if object has been initialized
        with store_schematron=False).
        (R2(R*((sA/usr/lib64/python2.7/site-packages/lxml/isoschematron/__init__.pyR,'stdoccCs|jS(s�ISO-schematron skeleton implementation XSLT validator document (None
        if object has been initialized with store_xslt=False). 
        (R3(R*((sA/usr/lib64/python2.7/site-packages/lxml/isoschematron/__init__.pyRN.scCs|jS(sfISO-schematron validation result report (None if result-storing has
        been turned off).
        (R4(R*((sA/usr/lib64/python2.7/site-packages/lxml/isoschematron/__init__.pytvalidation_report5sN(#t__name__t
__module__t__doc__RtErrorDomainstSCHEMATRONVR[tErrorLevelstERRORR]t
ErrorTypestSCHEMATRONV_ASSERTR\R-RR%RR)RR>RR?RRARRVRR`R_R0RdR,tpropertyRNRf(((sA/usr/lib64/python2.7/site-packages/lxml/isoschematron/__init__.pyR	ss,E			2				('RiR:tos.pathtostlxmlRRtbytest	NameErrortstrRRt__all__t
XML_SCHEMA_NSR(t
SCHEMATRON_NStSVRL_NSR=R$tpathtjointdirnamet__file__t_resources_dirRR7RRRRRRRtRelaxNGRRR"t
_ValidatorR	(((sA/usr/lib64/python2.7/site-packages/lxml/isoschematron/__init__.pyt<module>s\





	

!		

Anon7 - 2021