Your IP : 216.73.216.196


Current Path : /opt/alt/python35/lib/python3.5/site-packages/jsonschema/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib/python3.5/site-packages/jsonschema/__pycache__/_validators.cpython-35.pyc



�$�]�,�@s�ddlZddlmZddlmZmZddlmZdd�Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Z d7d8�Z!d9d:�Z"d;d<�Z#d=d>�Z$d?d@�Z%dAdB�Z&dCdD�Z'dS)E�N)�_utils)�FormatError�ValidationError)�	iteritemsc		cs�|j|d�sdSxwt|�D]i\}}xZt|�D]L\}}tj||�r<x+|j||d|d|�D]}|VqyWq<Wq#WdS)N�object�path�schema_path)�is_typer�re�search�descend)	�	validator�patternProperties�instance�schema�pattern�	subschema�k�v�error�r�G/opt/alt/python35/lib/python3.5/site-packages/jsonschema/_validators.pyrs	rccsS|j|d�sdSx6|D].}x%|jd|d|�D]}|Vq<WqWdS)Nrrr)r	r)r
�
propertyNamesrr�propertyrrrrrs

rc	cs7|j|d�sdSttj||��}|j|d�r�x�|D]2}x)|j|||d|�D]}|VqjWqGWn�|r3|r3d|krt|d�}t|�dkr�d}nd}ddjtt	t|���|djtt	|��f}t
|�Vnd	}t
|tj|��VdS)
Nrrr�Zdoes�doz&%s %s not match any of the regexes: %sz, z8Additional properties are not allowed (%s %s unexpected))r	�setrZfind_additional_propertiesr�sorted�len�join�map�reprr�
extras_msg)	r
ZaPrr�extras�extrar�patternsZverbrrr�additionalProperties!s(
#
	r&ccs�|j|d�sdS|j|d�r�x�tt|�|�D]@\\}}}x+|j||d|d|�D]}|VqoWq>WnExBt|�D]4\}}x%|j||d|�D]}|Vq�Wq�WdS)N�arrayrr)r	�zip�	enumerater)r
�itemsrr�index�itemrrrrrr*=s(	r*ccs |j|d�s1|j|jdi�d�r5dSt|jdg��}|j|d�r�x�t||d�d|�D]4\}}x%|j||d|�D]}|Vq�Wq|Wne|rt|�t|jdg��krd}t|tj|t|jdg��d���VdS)Nr'r*r�startrz3Additional items are not allowed (%s %s unexpected))r	�getrr)rrrr")r
ZaIrrZ	len_itemsr+r,rrrr�additionalItemsMs)+r/ccs"||krtd|f�VdS)Nz%r was expected)r)r
�constrrrrrr0asr0c#sN�j|d�sdSt��fdd�|D��sJtd|f�VdS)Nr'c3s!|]}�j|��VqdS)N)�is_valid)�.0�element)�containsr
rr�	<genexpr>jszcontains.<locals>.<genexpr>z+None of %r are valid under the given schema)r	�anyr)r
r4rrr)r4r
rr4fs
"r4ccs;|j|d�sdS||kr7td||f�VdS)N�numberz-%r is less than or equal to the minimum of %r)r	r)r
�minimumrrrrr�exclusiveMinimumpsr9ccs;|j|d�sdS||kr7td||f�VdS)Nr7z0%r is greater than or equal to the maximum of %r)r	r)r
�maximumrrrrr�exclusiveMaximum|sr;ccs;|j|d�sdS||kr7td||f�VdS)Nr7z!%r is less than the minimum of %r)r	r)r
r8rrrrrr8�s
r8ccs;|j|d�sdS||kr7td||f�VdS)Nr7z$%r is greater than the maximum of %r)r	r)r
r:rrrrrr:�s
r:ccsm|j|d�sdSt|t�rD||}t|�|k}n
||}|ritd||f�VdS)Nr7z%r is not a multiple of %r)r	�
isinstance�float�intr)r
ZdBrrZquotient�failedrrr�
multipleOf�s

r@ccs:|j|d�r6t|�|kr6td|f�VdS)Nr'z%r is too short)r	rr)r
�mIrrrrr�minItems�s$rBccs:|j|d�r6t|�|kr6td|f�VdS)Nr'z%r is too long)r	rr)r
rArrrrr�maxItems�s$rCccs>|r:|j|d�r:tj|�r:td|f�VdS)Nr'z%r has non-unique elements)r	rZuniqr)r
ZuIrrrrr�uniqueItems�srDccs>|j|d�r:tj||�r:td||f�VdS)N�stringz%r does not match %r)r	r
rr)r
Zpatrnrrrrrr�srccsi|jdk	rey|jj||�Wn<tk
rd}zt|jd|j�VWYdd}~XnXdS)N�cause)Zformat_checker�checkrr�messagerF)r
�formatrrrrrrrI�s
rIccs:|j|d�r6t|�|kr6td|f�VdS)NrEz%r is too short)r	rr)r
�mLrrrrr�	minLength�s$rKccs:|j|d�r6t|�|kr6td|f�VdS)NrEz%r is too long)r	rr)r
rJrrrrr�	maxLength�s$rLc	cs�|j|d�sdSx�t|�D]�\}}||kr>q#|j|d�r�x`|D]-}||krWd}t|||f�VqWWq#x%|j||d|�D]}|Vq�Wq#WdS)Nrr'z%r is a dependency of %rr)r	rrr)	r
�dependenciesrrrZ
dependencyZeachrHrrrrrM�s
	rMccs%||kr!td||f�VdS)Nz%r is not one of %r)r)r
Zenumsrrrrr�enum�srNc
cs�t|jdd�}|dkrb|jj|��)}x|j||�D]}|VqIWWdQRXn_|jj|�\}}|jj|�z&x|j||�D]}|Vq�WWd|jj�XdS)N�resolve)�getattrZresolverZ	resolvingrrOZ
push_scopeZ	pop_scope)r
�refrrrOZresolvedrZscoperrrrQ�s
rQc#sLtj|�}t��fdd�|D��sHttj�|��VdS)Nc3s!|]}�j�|�VqdS)N)r	)r2�type)rr
rrr5sztype.<locals>.<genexpr>)rZensure_listr6rZ	types_msg)r
�typesrrr)rr
rrRs"rRccsu|j|d�sdSxXt|�D]J\}}||kr#x/|j|||d|d|�D]}|Vq^Wq#WdS)Nrrr)r	rr)r
�
propertiesrrrrrrrrrTs	
rTccsF|j|d�sdSx)|D]!}||krtd|�VqWdS)Nrz%r is a required property)r	r)r
�requiredrrrrrrrUs

rUccs:|j|d�r6t|�|kr6td|f�VdS)Nrz"%r does not have enough properties)r	rr)r
�mPrrrrr�
minPropertiess$rWccsP|j|d�sdS|j|d�rLt|�|krLtd|f�VdS)Nrz%r has too many properties)r	rr)r
rVrrrrr�
maxProperties&s$rXccsIxBt|�D]4\}}x%|j||d|�D]}|Vq2Wq
WdS)Nr)r)r)r
�allOfrrr+rrrrrrY-srYccsqg}xdt|�D]>\}}t|j||d|��}|sDP|j|�qWtd|fd|�VdS)Nrz.%r is not valid under any of the given schemas�context)r)�listr�extendr)r
�anyOfrr�
all_errorsr+r�errsrrrr]3s
r]c#s�t|�}g}xd|D]D\}}t�j�|d|��}|sP|}	P|j|�qWtd�fd|�V��fdd�|D�}
|
r�|
j|	�djdd�|
D��}td	�|f�VdS)
Nrz.%r is not valid under any of the given schemasrZcs.g|]$\}}�j�|�r|�qSr)r1)r2�i�s)rr
rr�
<listcomp>Ps	zoneOf.<locals>.<listcomp>z, css|]}t|�VqdS)N)r!)r2rrrrr5SszoneOf.<locals>.<genexpr>z%r is valid under each of %s)r)r[rr\r�appendr)r
�oneOfrrZ
subschemasr^r+rr_Zfirst_validZ
more_validZreprsr)rr
rrdAs"

rdccs+|j||�r'td||f�VdS)Nz%r is not allowed for %r)r1r)r
Z
not_schemarrrrr�not_Ysreccs�|j||�rSd|kr�|d}xf|j||dd�D]}|VqAWn>d|kr�|d}x%|j||dd�D]}|Vq�WdS)N�thenr�else)r1r)r
Z	if_schemarrrfrZelse_rrr�if_`s

rh)(r
Z
jsonschemarZjsonschema.exceptionsrrZjsonschema.compatrrrr&r*r/r0r4r9r;r8r:r@rBrCrDrrIrKrLrMrNrQrRrTrUrWrXrYr]rdrerhrrrr�<module>sF