Sindbad~EG File Manager
3
!��c�-�@sLddlZddlmZmZmZmZmZmZmZddl m
Z
mZddlm
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|j|d�sdSxXt|�D]L\}}xBt|�D]6\}}tj||�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�</tmp/pip-build-_uu8ur7s/jsonschema/jsonschema/_validators.pyrsrccs@|j|d�sdSx*|D]"}x|j||d�D]
}|Vq*WqWdS)Nr)rr)rr)r�
propertyNamesrr�propertyrrrrrs
rc cs�|j|d�sdStt||��}|j|d�r^x�|D](}x"|j||||d�D]
}|VqJWq0Wn�|r�|r�d|kr�t|d�}t|�dkr�d}nd}ddjttt|���|djtt|��f}t |�Vnd }t |t
|��VdS)
Nr)r
r�ZdoesZdoz&%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�|j|d�sdS|j|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.Esr.ccs�|j|d�s"|j|jdi�d�r&dSt|jdg��}|j|d�r�x�t||d�|d�D](\}}x|j|||d�D]
}|VqrWqXWnH|r�t|�t|jdg��kr�d}t|t|t|jdg��d���VdS)Nr+r.r)�start)r
z3Additional items are not allowed (%s %s unexpected))r�getr#r-rr
r)rZaIrrZ len_itemsr/r0rrrr�additionalItemsUsr3ccst||�std|f�VdS)Nz%r was expected)rr
)r�constrrrrrr4is
r4c#s<�j|d�sdSt��fdd�|D��s8td|f�VdS)Nr+c3s|]}�j|��VqdS)N)�is_valid)�.0�element)�containsrrr� <genexpr>rszcontains.<locals>.<genexpr>z+None of %r are valid under the given schema)r�anyr
)rr8rrr)r8rrr8ns
r8ccs.|j|d�sdS||kr*td||f�VdS)N�numberz-%r is less than or equal to the minimum of %r)rr
)r�minimumrrrrr�exclusiveMinimumxsr=ccs.|j|d�sdS||kr*td||f�VdS)Nr;z0%r is greater than or equal to the maximum of %r)rr
)r�maximumrrrrr�exclusiveMaximum�sr?ccs.|j|d�sdS||kr*td||f�VdS)Nr;z!%r is less than the minimum of %r)rr
)rr<rrrrrr<�s
r<ccs.|j|d�sdS||kr*td||f�VdS)Nr;z$%r is greater than the maximum of %r)rr
)rr>rrrrrr>�s
r>ccsR|j|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
rDccs,|j|d�r(t|�|kr(td|f�VdS)Nr+z%r is too short)rr#r
)r�mIrrrrr�minItems�srFccs,|j|d�r(t|�|kr(td|f�VdS)Nr+z%r is too long)rr#r
)rrErrrrr�maxItems�srGccs.|r*|j|d�r*t|�r*td|f�VdS)Nr+z%r has non-unique elements)rrr
)rZuIrrrrr�uniqueItems�s
rHccs0|j|d�r,tj||�r,td||f�VdS)N�stringz%r does not match %r)rrrr
)rZpatrnrrrrrr�srccsV|jdk rRy|jj||�Wn4tk
rP}zt|j|jd�VWYdd}~XnXdS)N)�cause)Zformat_checker�checkr r
�messagerJ)r�formatrrrrrrrM�s
rMccs,|j|d�r(t|�|kr(td|f�VdS)NrIz%r is too short)rr#r
)r�mLrrrrr� minLength�srOccs,|j|d�r(t|�|kr(td|f�VdS)NrIz%r is too long)rr#r
)rrNrrrrr� maxLength�srPc cs�|j|d�sdSxxt|�D]l\}}||kr,q|j|d�rfxL|D]"}||kr>d}t|||f�Vq>Wqx|j|||d�D]
}|VqxWqWdS)Nrr+z%r is a dependency of %r)r)rrr
r) r�dependenciesrrr�
dependency�eachrLrrrrrQ�s
rQc#s`|dks|dkrBt|��t�fdd�|D��r\td||f�Vn||kr\td||f�VdS)Nrr c3s|]}�t|�kVqdS)N)r)r6rS)�unbooledrrr9�szenum.<locals>.<genexpr>z%r is not one of %r)r�allr
)r�enumsrrr)rTr�enum�srWc
cs�t|jdd�}|dkrL|jj|��"}x|j||�D]
}|Vq2WWdQRXnJ|jj|�\}}|jj|�z x|j||�D]
}|VqxWWd|jj�XdS)N�resolve)�getattr�resolverZ resolvingrrXZ
push_scopeZ pop_scope)r�refrrrX�resolvedrZscoperrrr[�sr[c#s4t|�}t��fdd�|D��s0tt�|��VdS)Nc3s|]}�j�|�VqdS)N)r)r6�type)rrrrr9sztype.<locals>.<genexpr>)rr:r
r)r�typesrrr)rrrr]
sr]ccsX|j|d�sdSxBt|�D]6\}}||krx$|j|||||d�D]
}|VqBWqWdS)Nr)r
r)rrr)r�
propertiesrrrrrrrrr_sr_ccs8|j|d�sdSx"|D]}||krtd|�VqWdS)Nrz%r is a required property)rr
)r�requiredrrrrrrr`#s
r`ccs,|j|d�r(t|�|kr(td|f�VdS)Nrz"%r does not have enough properties)rr#r
)r�mPrrrrr�
minProperties+srbccs<|j|d�sdS|j|d�r8t|�|kr8td|f�VdS)Nrz%r has too many properties)rr#r
)rrarrrrr�
maxProperties2srcccs:x4t|�D](\}}x|j|||d�D]
}|Vq$Wq
WdS)N)r)r-r)r�allOfrrr/rrrrrrd9srdccsVg}xLt|�D],\}}t|j|||d��}|s0P|j|�qWtd|f|d�VdS)N)rz.%r is not valid under any of the given schemas)�context)r-�listr�extendr
)r�anyOfrr�
all_errorsr/r�errsrrrrh?srhc#s�t|�}g}xL|D]0\}}t�j�||d��}|s8|} P|j|�qWtd�f|d�V��fdd�|D�}
|
r�|
j| �djdd�|
D��}td �|f�VdS)
N)rz.%r is not valid under any of the given schemas)recs g|]\}}�j�|�r|�qSr)r5)r6�i�s)rrrr�
<listcomp>\szoneOf.<locals>.<listcomp>z, css|]}t|�VqdS)N)r&)r6rrrrr9_szoneOf.<locals>.<genexpr>z%r is valid under each of %s)r-rfrrgr
�appendr$)r�oneOfrrZ
subschemasrir/rrjZfirst_validZ
more_validZreprsr)rrrroMs"
roccs"|j||�rtd||f�VdS)Nz%r is not allowed for %r)r5r
)rZ
not_schemarrrrr�not_esrpccsr|j||�r>d|krn|d}xP|j||dd�D]
}|Vq.Wn0d|krn|d}x|j||dd�D]
}|Vq`WdS)N�then)r�else)r5r)rZ if_schemarrrqrZelse_rrr�if_lsrs).rZjsonschema._utilsrrrrrrrZjsonschema.exceptionsr r
Zjsonschema.compatrrrr*r.r3r4r8r=r?r<r>rDrFrGrHrrMrOrPrQrWr[r]r_r`rbrcrdrhrorprsrrrr�<module>sF$
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists