• File: _validators.cpython-37.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib/python3.7/site-packages/jsonschema/__pycache__/_validators.cpython-37.pyc
  • Date Modified: 07/08/2021 10:56 AM
  • File size: 9.7 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

`-@sLddlZddlmZmZmZmZmZmZmZddl	m
Z
mZddlm
Z
ddZddZd	d
ZddZd
dZddZddZddZddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Z d+d,Z!d-d.Z"d/d0Z#d1d2Z$d3d4Z%d5d6Z&d7d8Z'd9d:Z(d;d<Z)d=d>Z*d?d@Z+dAdBZ,dCdDZ-dS)EN)ensure_listequal
extras_msgfind_additional_properties	types_msgunbooluniq)FormatErrorValidationError)	iteritemsc	csn||dsdSxXt|D]L\}}xBt|D]6\}}t||r,x |j||||dD]
}|VqTWq,WqWdS)Nobject)pathschema_path)is_typerresearchdescend)		validatorpatternPropertiesinstanceschemapattern	subschemakverrorrG/opt/alt/python37/lib/python3.7/site-packages/jsonschema/_validators.pyrsrccs@||dsdSx*|D]"}x|j||dD]
}|Vq*WqWdS)Nr)rr)rr)r
propertyNamesrrpropertyrrrrrs
rc	cs||dsdStt||}||dr^x|D](}x"|j||||dD]
}|VqJWq0Wn~|s|rd|krt|d}t|dkrd}nd}ddttt||dtt|f}t	|Vnd	}t	|t
|VdS)
Nr)r
rZdoesZdoz&%s %s not match any of the regexes: %sz, z8Additional properties are not allowed (%s %s unexpected))rsetrrsortedlenjoinmapreprr
r)	rZaPrrZextrasZextrarZpatternsZverbrrradditionalProperties)s(
r'ccs||dsdS||dr`xxtt||D].\\}}}x |j||||dD]
}|VqLWq,Wn6x4t|D](\}}x|j|||dD]
}|VqWqjWdS)Narray)r
r)r
)rzip	enumerater)ritemsrrindexitemrrrrrr+Esr+c	cs||dr ||didr$dSt|dg}||drxt||d|dD](\}}x|j|||dD]
}|VqpWqVWnF|st|t|dgkrd}t|t|t|dgdVdS)Nr(r+r)start)r
z3Additional items are not allowed (%s %s unexpected))rgetr#r*rr
r)rZaIrrZ	len_itemsr,r-rrrradditionalItemsUsr0ccst||std|fVdS)Nz%r was expected)rr
)rconstrrrrrr1is
r1c#s<|dsdStfdd|Ds8td|fVdS)Nr(c3s|]}|VqdS)N)is_valid).0Zelement)containsrrr	<genexpr>rszcontains.<locals>.<genexpr>z+None of %r are valid under the given schema)ranyr
)rr4rrr)r4rrr4ns
r4ccs.||dsdS||kr*td||fVdS)Nnumberz-%r is less than or equal to the minimum of %r)rr
)rminimumrrrrrexclusiveMinimumxsr9ccs.||dsdS||kr*td||fVdS)Nr7z0%r is greater than or equal to the maximum of %r)rr
)rmaximumrrrrrexclusiveMaximumsr;ccs.||dsdS||kr*td||fVdS)Nr7z!%r is less than the minimum of %r)rr
)rr8rrrrrr8s
r8ccs.||dsdS||kr*td||fVdS)Nr7z$%r is greater than the maximum of %r)rr
)rr:rrrrrr:s
r:ccsR||dsdSt|tr0||}t||k}n||}|rNtd||fVdS)Nr7z%r is not a multiple of %r)r
isinstancefloatintr
)rZdBrrZquotientZfailedrrr
multipleOfs
r?ccs,||dr(t||kr(td|fVdS)Nr(z%r is too short)rr#r
)rmIrrrrrminItemssrAccs,||dr(t||kr(td|fVdS)Nr(z%r is too long)rr#r
)rr@rrrrrmaxItemssrBccs,|r(||dr(t|s(td|fVdS)Nr(z%r has non-unique elements)rrr
)rZuIrrrrruniqueItemssrCccs.||dr*t||s*td||fVdS)Nstringz%r does not match %r)rrrr
)rZpatrnrrrrrrsrc
csV|jdk	rRy|j||Wn4tk
rP}zt|j|jdVWdd}~XYnXdS)N)cause)Zformat_checkerZcheckr	r
messagerE)rformatrrrrrrrGs

rGccs,||dr(t||kr(td|fVdS)NrDz%r is too short)rr#r
)rmLrrrrr	minLengthsrIccs,||dr(t||kr(td|fVdS)NrDz%r is too long)rr#r
)rrHrrrrr	maxLengthsrJc	cs||dsdSxxt|D]l\}}||kr,q||drfxL|D]"}||kr>d}t|||fVq>Wqx|j|||dD]
}|VqxWqWdS)Nrr(z%r is a dependency of %r)r)rrr
r)	rdependenciesrrrZ
dependencyeachrFrrrrrKs
rKc#s`|dks|dkrBt|tfdd|Dr\td||fVn||kr\td||fVdS)Nrr c3s|]}t|kVqdS)N)r)r3rL)unbooledrrr5szenum.<locals>.<genexpr>z%r is not one of %r)rallr
)rZenumsrrr)rMrenumsrOc	cst|jdd}|dkrL|j|"}x|||D]
}|Vq2WWdQRXnJ|j|\}}|j|z x|||D]
}|VqxWWd|jXdS)Nresolve)getattrZresolverZ	resolvingrrPZ
push_scopeZ	pop_scope)rrefrrrPZresolvedrZscoperrrrRsrRc#s4t|}tfdd|Ds0tt|VdS)Nc3s|]}|VqdS)N)r)r3type)rrrrr5sztype.<locals>.<genexpr>)rr6r
r)rtypesrrr)rrrrS
srSccsX||dsdSxBt|D]6\}}||krx$|j|||||dD]
}|VqBWqWdS)Nr)r
r)rrr)r
propertiesrrrrrrrrrUsrUccs8||dsdSx"|D]}||krtd|VqWdS)Nrz%r is a required property)rr
)rrequiredrrrrrrrV#s

rVccs,||dr(t||kr(td|fVdS)Nrz"%r does not have enough properties)rr#r
)rmPrrrrr
minProperties+srXccs<||dsdS||dr8t||kr8td|fVdS)Nrz%r has too many properties)rr#r
)rrWrrrrr
maxProperties2srYccs:x4t|D](\}}x|j|||dD]
}|Vq$Wq
WdS)N)r)r*r)rallOfrrr,rrrrrrZ9srZccsVg}xLt|D],\}}t|j|||d}|s0P||qWtd|f|dVdS)N)rz.%r is not valid under any of the given schemas)context)r*listrextendr
)ranyOfrr
all_errorsr,rerrsrrrr^?sr^c#st|}g}xL|D]0\}}tj||d}|s8|}	P||qWtdf|dVfdd|D}
|
r|
|	ddd|
D}td	|fVdS)
N)rz.%r is not valid under any of the given schemas)r[cs g|]\}}|r|qSr)r2)r3is)rrrr
<listcomp>\szoneOf.<locals>.<listcomp>z, css|]}t|VqdS)N)r&)r3rrrrr5_szoneOf.<locals>.<genexpr>z%r is valid under each of %s)r*r\rr]r
appendr$)roneOfrrZ
subschemasr_r,rr`Zfirst_validZ
more_validZreprsr)rrrreMs"

reccs"|||rtd||fVdS)Nz%r is not allowed for %r)r2r
)rZ
not_schemarrrrrnot_esrfccsr|||r>d|krn|d}xP|j||ddD]
}|Vq.Wn0d|krn|d}x|j||ddD]
}|Vq`WdS)Nthen)relse)r2r)rZ	if_schemarrrgrZelse_rrrif_lsri).rZjsonschema._utilsrrrrrrrZjsonschema.exceptionsr	r
Zjsonschema.compatrrrr'r+r0r1r4r9r;r8r:r?rArBrCrrGrIrJrKrOrRrSrUrVrXrYrZr^rerfrirrrr<module>sF$