e!dZgdZGddeZGddeZGddeZGdd eZGd d eZGd d eZGddeZ Gdde Z y)zInterface-specific exceptions )InvalidDoesNotImplementBrokenImplementationBrokenMethodImplementationMultipleInvalid BadImplementsInvalidInterfaceceZdZdZy)rz A specification is violated N__name__ __module__ __qualname____doc__;/usr/lib/python3/dist-packages/zope/interface/exceptions.pyrrrrcveZdZdZdZeZdZddZe dZ e dZ e dZ e d Z d Zd Zd Zd Zy)_TargetInvalidz NcP |j|S#|j$r|cYSwxYwN)args_NOT_GIVEN_CATCH)selfixdefaults r_get_arg_or_defaultz"_TargetInvalid._get_arg_or_default8s/ 99R= $$ N s %%c8|j|jSr)r _IX_INTERFACErs r interfacez_TargetInvalid.interface>s''(:(:;;rcN|j|j|jSr)r _IX_TARGET _NOT_GIVENr!s rtargetz_TargetInvalid.targetBs''IIrcZ|j}||jurydj|S)Nz An objectzThe object {!r})r&r%format)rr&s r _str_subjectz_TargetInvalid._str_subjectZs+ T__ $ ''//rc(d|jxsdzS)Nz$has failed to implement interface %sz )r"r!s r_str_descriptionz_TargetInvalid._str_descriptionas5 NN )k  rz: z .cdj|j|j|j|j|j S)Nz {} {}{}{}{})r(r)r+_str_conjunction _str_details _str_trailerr!s r__str__z_TargetInvalid.__str__ksB##     ! !  ! !         rr)r r r r r$ IndexErrorrr%rpropertyr"r&r)r+r.r/r0r1rrrrr"sMJ"J <<JJ.00   LL rrceZdZdZdZy)ra DoesNotImplement(interface[, target]) The *target* (optional) does not implement the *interface*. .. versionchanged:: 5.0.0 Add the *target* argument and attribute, and change the resulting string value of this object accordingly. z.Does not declaratively implement the interfaceN)r r r rr/rrrrrusDLrrcXeZdZdZej dzZedzZedZ edZ y)ra[ BrokenImplementation(interface, name[, target]) The *target* (optional) is missing the attribute *name*. .. versionchanged:: 5.0.0 Add the *target* argument and attribute, and change the resulting string value of this object accordingly. The *name* can either be a simple string or a ``Attribute`` object. rc |jdSNrrr!s rnamezBrokenImplementation.nameyy|rcdt|jtrt|jzS|jzS)Nz!The %s attribute was not provided) isinstancer9strreprr!s rr/z!BrokenImplementation._str_detailss82)$))S9DO  ?Cyy  rN) r r r rrr _IX_NAMEr$r3r9r/rrrrrsH ++a/HAJ   rrcheZdZdZdZedzZedzZedZedZ e dZ edZ y) ra BrokenMethodImplementation(method, message[, implementation, interface, target]) The *target* (optional) has a *method* in *implementation* that violates its contract in a way described by *mess*. .. versionchanged:: 5.0.0 Add the *interface* and *target* argument and attribute, and change the resulting string value of this object accordingly. The *method* can either be a simple string or a ``Method`` object. .. versionchanged:: 5.0.0 If *implementation* is given, then the *message* will have the string "implementation" replaced with an short but informative representation of *implementation*. rc |jdS)Nrr8r!s rmethodz!BrokenMethodImplementation.methodr:rc |jdSr7r8r!s rmesszBrokenMethodImplementation.messr:rcBddl} |j}t} ||} |j}|||zS#t$r |j}|j fd}YIwxYw#t tf$rt|cYSwxYw#t$r|j}YnwxYw)Nrc|Srr)sigfs rzABrokenMethodImplementation.__implementation_str..s AsGr) inspect signaturer=AttributeError getargspec formatargspec ValueError TypeErrorr>r r )implrKrH formatsigr9rIs @r__implementation_strz/BrokenMethodImplementation.__implementation_strs  ,##CI  d)C !$$Din$$' ,$$C%%A+I ,I&  :    !==D !s1:A& B&A#"A#&BBBBcx|j|j|j}|j}||jur+d|vr'|j dd}||j |fz}dj t|jtrt|j|S|j|S)Nimplementationz%rz)The contract of {} is violated because {}) r_IX_IMPLr%rEreplace/_BrokenMethodImplementation__implementation_strr(r<rCr=r>)rrRmessages rr/z'BrokenMethodImplementation._str_detailss'' tG)) t &+;w+Foo&6=G!:!:4!@ BBG:AA!+DKK!=D    CG;;   rN) r r r rrWr r$r3rCrE staticmethodrYr/rrrrrso&HqLM"J %%8    rrcNeZdZdZdZfdZedZedZdZ dZ xZ S)rz The *target* has failed to implement the *interface* in multiple ways. The failures are described by *exceptions*, a collection of other `Invalid` instances. .. versionadded:: 5.0 rc:t|||t|yr)super__init__tuple)rr"r& exceptions __class__s rr_zMultipleInvalid.__init__s FE*,=>rc |jdS)NrAr8r!s rrazMultipleInvalid.exceptionsr:rcLddjd|jDzS)Nz c3K|]9}t|tr|jjn t |;ywr)r<rr/stripr=).0xs r z/MultipleInvalid._str_details..s7( '1N&CANN "Q O( s?A)joinrar!s rr/zMultipleInvalid._str_detailss-(--( __(    r:) r r r rrr_r3rar/r.r0 __classcell__)rbs@rrrsJ?  LrrceZdZdZy)rz'The interface has invalid contents Nr rrrrr rrrceZdZdZy)rzAn implementation assertion is invalid because it doesn't contain an interface or a sequence of valid implementation assertions. Nr rrrrrsrrN) r__all__ ExceptionrrrrrrrrQrrrrrrsz i P WP f D~ D > 6H H VnByIr