ó ÅNTc@sIddlmZmZddlZddlZddlZddlmZddlm Z m Z e ddgƒZ e ƒZ ejƒZdefd„ƒYZd efd „ƒYZd efd „ƒYZd efd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZe e d„ZeƒZed„ZdS(iÿÿÿÿ(t defaultdicttdequeN(t_utils(tPY3t iteritemstanyOftoneOft_Errorc Bs•eZed d d eeed d d„ Zd„Zd„Zd„ZerTeZne d„ƒZ e d„ƒZ e d„ƒZ d„Zd„ZRS( c CsÐtt|ƒj||||||||| | ƒ ||_t|ƒ|_|_t| ƒ|_|_t |ƒ|_ ||_ |_ ||_ ||_||_||_| |_x|D]} || _q¹WdS(N(tsuperRt__init__tmessageRtpatht relative_patht schema_pathtrelative_schema_pathtlisttcontexttcauset __cause__t validatortvalidator_valuetinstancetschematparent( tselfR RR RRRRRR Rterror((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyR s.        cCsd|jj|jfS(Ns<%s: %r>(t __class__t__name__R (R((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyt__repr__8scCst|ƒjdƒS(Nsutf-8(tunicodetencode(R((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyt__str__;scCsÏ|j|j|j|jf}td„|Dƒƒr;|jStj|jddƒ}tj|jddƒ}|jtj dj ƒƒ|jt j t |jƒd ƒt j|ƒt j |jƒt j|ƒfS(Ncss|]}|tkVqdS(N(t_unset(t.0tm((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pys BstwidthiHsv Failed validating %r in schema%s: %s On instance%s: %s iÿÿÿÿ(RRRRtanyR tpprinttpformatttextwraptdedenttrstripRtformat_as_indexRRtindentR (Rtessential_for_verbosetpschemat pinstance((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyt __unicode__>s   cCs||jƒS(N(t _contents(tclstother((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyt create_fromZscCsE|j}|dkr|jSt|jƒ}|jt|jƒƒ|S(N(RtNoneR Rt extendlefttreversedt absolute_path(RRR ((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyR7^s   cCsE|j}|dkr|jSt|jƒ}|jt|jƒƒ|S(N(RR4RRR5R6tabsolute_schema_path(RRR ((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyR8hs   cKsIxBt|ƒD]4\}}t||ƒtkr t|||ƒq q WdS(N(RtgetattrR tsetattr(Rtkwargstktv((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyt_setrsc s d }t‡fd †|DƒƒS( NR RRRRR R RRRc3s$|]}|tˆ|ƒfVqdS(N(R9(R!tattr(R(s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pys |s( smessagescausescontexts validatorsvalidator_valuespaths schema_pathsinstancesschemasparent(tdict(Rtattrs((Rs9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyR0ws(N(((Rt __module__R R4R RRR/Rt classmethodR3tpropertyR7R8R>R0(((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyRs&       tValidationErrorcBseZRS((RRB(((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyREst SchemaErrorcBseZRS((RRB(((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyRFƒstRefResolutionErrorcBseZRS((RRB(((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyRG‡st UnknownTypecBs2eZd„Zd„Zd„Zer0eZnRS(cCs||_||_||_dS(N(ttypeRR(RRIRR((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyR Œs  cCst|ƒjdƒS(Nsutf-8(RR(R((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyR‘scCsetj|jddƒ}tj|jddƒ}tjdjƒƒ|jtj |ƒtj |ƒfS(NR#iHsˆ Unknown type %r for validator with schema: %s While checking instance: %s ( R%R&RRR'R(R)RIRR+(RR-R.((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyR/”s  (RRBR RR/R(((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyRH‹s    t FormatErrorcBs5eZdd„Zd„Zd„Zer3eZnRS(cCs6tt|ƒj||ƒ||_||_|_dS(N(RRJR R RR(RR R((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyR ¦s cCs|jjdƒS(Nsutf-8(R R(R((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyR«scCs|jS(N(R (R((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyR/®sN(RRBR4R RR/R(((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyRJ¥s    t ErrorTreecBseeZdZeZd d„Zd„Zd„Zd„Zd„Z d„Z d„Z e d„ƒZ RS( sG ErrorTrees make it easier to check which validations failed. cCspi|_t|jƒ|_xN|D]F}|}x|jD]}||}q8W||j|j<|j|_q"WdS(N(terrorsRRR0R RRt _instance(RRLRt containertelement((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyR ½s  cCs ||jkS(sD Check whether ``instance[index]`` has any errors. (R0(Rtindex((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyt __contains__ÉscCs4|jtk r)||kr)|j|n|j|S(sY Retrieve the child tree one level down at the given ``index``. If the index is not in the instance that this tree corresponds to and is not known by this tree, whatever error would be raised by ``instance.__getitem__`` will be propagated (usually this is some subclass of :class:`LookupError`. (RMR R0(RRP((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyt __getitem__Ñs cCs||j|(RRtlen(R((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyRóscCs0td„t|jƒDƒƒ}t|jƒ|S(sU The total number of errors in the entire tree, including children. css!|]\}}t|ƒVqdS(N(RY(R!t_ttree((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pys ýs(tsumRR0RYRL(Rt child_errors((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyRWös((RRBt__doc__R RMR RQRRRTRVRXRRDRW(((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyRKµs      cs‡‡fd†}|S(Ncs,|j}t|jƒ |ˆk|ˆkfS(N(RRYR (RR(tstrongtweak(s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyt relevances ((R`R_Ra((R_R`s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyt by_relevancescCsut|ƒ}t|dƒ}|dkr+dSttj|g|ƒd|ƒ}x"|jrpt|jd|ƒ}qOW|S(Ntkey(RUtnextR4tmaxt itertoolstchainRtmin(RLRctbest((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyt best_match s  ! (t collectionsRRRfR%R't jsonschemaRtjsonschema.compatRRt frozensett WEAK_MATCHEStSTRONG_MATCHEStUnsetR t ExceptionRRERFRGRHRJtobjectRKRbRaRj(((s9/usr/lib/python2.7/site-packages/jsonschema/exceptions.pyts$     oL