Your IP : 3.17.76.163


Current Path : /opt/alt/python37/lib/python3.7/site-packages/jsonschema/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/jsonschema/__pycache__/_validators.cpython-37.pyc

B

�pSe�-�@sLddlZddlmZmZmZmZmZmZmZddl	m
Z
mZddlm
Z
dd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Z d+d,�Z!d-d.�Z"d/d0�Z#d1d2�Z$d3d4�Z%d5d6�Z&d7d8�Z'd9d:�Z(d;d<�Z)d=d>�Z*d?d@�Z+dAdB�Z,dCdD�Z-dS)E�N)�ensure_list�equal�
extras_msg�find_additional_properties�	types_msg�unbool�uniq)�FormatError�ValidationError)�	iteritemsc	csn|�|d�sdSxXt|�D]L\}}xBt|�D]6\}}t�||�r,x |j||||d�D]
}|VqTWq,WqWdS)N�object)�path�schema_path)�is_typer�re�search�descend)	�	validator�patternProperties�instance�schema�pattern�	subschema�k�v�error�r�G/opt/alt/python37/lib/python3.7/site-packages/jsonschema/_validators.pyrsrccs@|�|d�sdSx*|D]"}x|j||d�D]
}|Vq*WqWdS)Nr)rr)rr)r�
propertyNamesrr�propertyrrrrrs
rc	cs�|�|d�sdStt||��}|�|d�r^x�|D](}x"|j||||d�D]
}|VqJWq0Wn~|s�|r�d|kr�t|d�}t|�dkr�d}nd}dd�ttt|���|d�tt|��f}t	|�Vnd	}t	|t
|��VdS)
Nr)r
r�Zdoes�doz&%s %s not match any of the regexes: %sz, z8Additional properties are not allowed (%s %s unexpected))r�setrr�sorted�len�join�map�reprr
r)	rZaPrr�extras�extrar�patternsZverbrrr�additionalProperties)s(
r+ccs�|�|d�sdS|�|d�r`xxtt|�|�D].\\}}}x |j||||d�D]
}|VqLWq,Wn6x4t|�D](\}}x|j|||d�D]
}|Vq�WqjWdS)N�array)r
r)r
)r�zip�	enumerater)r�itemsrr�index�itemrrrrrr/Esr/c	cs�|�|d�r |�|�di�d�r$dSt|�dg��}|�|d�r�x�t||d�|d�D](\}}x|j|||d�D]
}|VqpWqVWnF|s�t|�t|�dg��kr�d}t|t|t|�dg��d���VdS)Nr,r/r)�start)r
z3Additional items are not allowed (%s %s unexpected))r�getr$r.rr
r)rZaIrrZ	len_itemsr0r1rrrr�additionalItemsUsr4ccst||�std|f�VdS)Nz%r was expected)rr
)r�constrrrrrr5is
r5c#s<��|d�sdSt��fdd�|D��s8td|f�VdS)Nr,c3s|]}��|��VqdS)N)�is_valid)�.0�element)�containsrrr�	<genexpr>rszcontains.<locals>.<genexpr>z+None of %r are valid under the given schema)r�anyr
)rr9rrr)r9rrr9ns
r9ccs.|�|d�sdS||kr*td||f�VdS)N�numberz-%r is less than or equal to the minimum of %r)rr
)r�minimumrrrrr�exclusiveMinimumxsr>ccs.|�|d�sdS||kr*td||f�VdS)Nr<z0%r is greater than or equal to the maximum of %r)rr
)r�maximumrrrrr�exclusiveMaximum�sr@ccs.|�|d�sdS||kr*td||f�VdS)Nr<z!%r is less than the minimum of %r)rr
)rr=rrrrrr=�s
r=ccs.|�|d�sdS||kr*td||f�VdS)Nr<z$%r is greater than the maximum of %r)rr
)rr?rrrrrr?�s
r?ccsR|�|d�sdSt|t�r0||}t|�|k}n||}|rNtd||f�VdS)Nr<z%r is not a multiple of %r)r�
isinstance�float�intr
)rZdBrrZquotient�failedrrr�
multipleOf�s
rEccs,|�|d�r(t|�|kr(td|f�VdS)Nr,z%r is too short)rr$r
)r�mIrrrrr�minItems�srGccs,|�|d�r(t|�|kr(td|f�VdS)Nr,z%r is too long)rr$r
)rrFrrrrr�maxItems�srHccs,|r(|�|d�r(t|�s(td|f�VdS)Nr,z%r has non-unique elements)rrr
)rZuIrrrrr�uniqueItems�srIccs.|�|d�r*t�||�s*td||f�VdS)N�stringz%r does not match %r)rrrr
)rZpatrnrrrrrr�src
csV|jdk	rRy|j�||�Wn4tk
rP}zt|j|jd�VWdd}~XYnXdS)N)�cause)Zformat_checker�checkr	r
�messagerK)r�formatrrrrrrrN�s

rNccs,|�|d�r(t|�|kr(td|f�VdS)NrJz%r is too short)rr$r
)r�mLrrrrr�	minLength�srPccs,|�|d�r(t|�|kr(td|f�VdS)NrJz%r is too long)rr$r
)rrOrrrrr�	maxLength�srQc	cs�|�|d�sdSxxt|�D]l\}}||kr,q|�|d�rfxL|D]"}||kr>d}t|||f�Vq>Wqx|j|||d�D]
}|VqxWqWdS)Nrr,z%r is a dependency of %r)r)rrr
r)	r�dependenciesrrrZ
dependency�eachrMrrrrrR�s
rRc#s`|dks|dkrBt|��t�fdd�|D��r\td||f�Vn||kr\td||f�VdS)Nrr c3s|]}�t|�kVqdS)N)r)r7rS)�unbooledrrr:�szenum.<locals>.<genexpr>z%r is not one of %r)r�allr
)rZenumsrrr)rTr�enum�srVc	cs�t|jdd�}|dkrL|j�|��"}x|�||�D]
}|Vq2WWdQRXnJ|j�|�\}}|j�|�z x|�||�D]
}|VqxWWd|j��XdS)N�resolve)�getattrZresolverZ	resolvingrrWZ
push_scopeZ	pop_scope)r�refrrrWZresolvedrZscoperrrrY�srYc#s4t|�}t��fdd�|D��s0tt�|��VdS)Nc3s|]}���|�VqdS)N)r)r7�type)rrrrr:sztype.<locals>.<genexpr>)rr;r
r)r�typesrrr)rrrrZ
srZccsX|�|d�sdSxBt|�D]6\}}||krx$|j|||||d�D]
}|VqBWqWdS)Nr)r
r)rrr)r�
propertiesrrrrrrrrr\sr\ccs8|�|d�sdSx"|D]}||krtd|�VqWdS)Nrz%r is a required property)rr
)r�requiredrrrrrrr]#s

r]ccs,|�|d�r(t|�|kr(td|f�VdS)Nrz"%r does not have enough properties)rr$r
)r�mPrrrrr�
minProperties+sr_ccs<|�|d�sdS|�|d�r8t|�|kr8td|f�VdS)Nrz%r has too many properties)rr$r
)rr^rrrrr�
maxProperties2sr`ccs:x4t|�D](\}}x|j|||d�D]
}|Vq$Wq
WdS)N)r)r.r)r�allOfrrr0rrrrrra9sraccsVg}xLt|�D],\}}t|j|||d��}|s0P|�|�qWtd|f|d�VdS)N)rz.%r is not valid under any of the given schemas)�context)r.�listr�extendr
)r�anyOfrr�
all_errorsr0r�errsrrrre?srec#s�t|�}g}xL|D]0\}}t�j�||d��}|s8|}	P|�|�qWtd�f|d�V��fdd�|D�}
|
r�|
�|	�d�dd�|
D��}td	�|f�VdS)
N)rz.%r is not valid under any of the given schemas)rbcs g|]\}}���|�r|�qSr)r6)r7�i�s)rrrr�
<listcomp>\szoneOf.<locals>.<listcomp>z, css|]}t|�VqdS)N)r')r7rrrrr:_szoneOf.<locals>.<genexpr>z%r is valid under each of %s)r.rcrrdr
�appendr%)r�oneOfrrZ
subschemasrfr0rrgZfirst_validZ
more_validZreprsr)rrrrlMs"

rlccs"|�||�rtd||f�VdS)Nz%r is not allowed for %r)r6r
)rZ
not_schemarrrrr�not_esrmccsr|�||�r>d|krn|d}xP|j||dd�D]
}|Vq.Wn0d|krn|d}x|j||dd�D]
}|Vq`WdS)N�then)r�else)r6r)rZ	if_schemarrrnrZelse_rrr�if_lsrp).rZjsonschema._utilsrrrrrrrZjsonschema.exceptionsr	r
Zjsonschema.compatrrrr+r/r4r5r9r>r@r=r?rErGrHrIrrNrPrQrRrVrYrZr\r]r_r`rarerlrmrprrrr�<module>sF$	



		

?>