edZddlZddlZddlmZddlmZddlmZddlmZddlm Z ddlm Z dd lm Z dd l m Z mZmZd d gZefZdd ZdZddZddZeje_dZdZy)z!Verify interface implementations N) FunctionType) MethodType)BrokenImplementation)BrokenMethodImplementation)DoesNotImplement)Invalid)MultipleInvalid) fromMethod fromFunctionMethod verifyObject verifyClassct|dk(r |j}n |j}g}|s#||s|jt|||j dD]\}} t ||||||r t|dk(r|dt|||y#t $r}|j|Yd}~Zd}~wwxYw)a Verify that *candidate* might correctly provide *iface*. This involves: - Making sure the candidate claims that it provides the interface using ``iface.providedBy`` (unless *tentative* is `True`, in which case this step is skipped). This means that the candidate's class declares that it `implements ` the interface, or the candidate itself declares that it `provides ` the interface - Making sure the candidate defines all the necessary methods - Making sure the methods have the correct signature (to the extent possible) - Making sure the candidate defines all the necessary attributes :return bool: Returns a true value if everything that could be checked passed. :raises zope.interface.Invalid: If any of the previous conditions does not hold. .. versionchanged:: 5.0 If multiple methods or attributes are invalid, all such errors are collected and reported. Previously, only the first error was reported. As a special case, if only one such error is present, it is raised alone, like before. cT)allNr) implementedBy providedByappendrnamesAndDescriptions_verify_elementrlenr ) iface candidate tentativevtypetesterexcsnamedesces 7/usr/lib/python3/dist-packages/zope/interface/verify.py_verifyr#'s@ |$$!! D VI. $UI6700T0: d  E4y% @  t9>q'MeY55   KKNN sB B7B22B7c t||}t|tsyt j |st j|ryt|tr4t|tr|dk(rt|||d}nyt|||}njt|tr)t|jturt|||}n1t|tr|dk(ryt|st!|d|||yt#|j%|j%}|rt!|||||y#t$r%t|ts|dk(rYyt |||wxYw)Nrr)rimlevel)rzimplementation is not a method)getattrAttributeError isinstancer rinspectismethoddescriptor isbuiltinrtyper MethodTypes__func__r propertycallabler _incompatgetSignatureInfo)rrr rrattrmethmesss r"rr]sV;y$' dF #!!$'7+<+ implementeds r"r1r1sy  ;z "#c(:*>&?? [ & '#h|.D*E EI&>+h"7A ;y#9B$:r:)FN)F)__doc__r)systypesrrzope.interface.exceptionsrrrrr zope.interface.interfacer r r __all__r-r#rrr rBr1r:r"rKss :@6-5EE n 4l>MD; ; <  Cr: