o ]LbP@sdZddlmZddlmZmZddlmZddlmZm Z ddl m Z m Z m Z ddlZe fZdd d Zdd d Zdd dZddZdS)z!Verify interface implementations )absolute_import)BrokenImplementationDoesNotImplement)BrokenMethodImplementation) FunctionType MethodType) fromMethod fromFunctionMethodNc CsF|dkr|j}n|j}|s||st||dD]\}}zt||}Wnty<t|ts7|dkr7Yqt||wt|tsCqt|t ret j ddkr]t|t r]t |||dd}n/t |||d}n't|trxt |jt urxt|||}nt|tr|dkrqt|st|dq|}|}t||} | rt|| qdS) aVerify that 'candidate' might correctly implements 'iface'. This involves: o Making sure the candidate defines all the necessary methods o Making sure the methods have the correct signature o Making sure the candidate asserts that it implements the interface Note that this isn't the same as verifying that the class does implement the interface. If optional tentative is true, suppress the "is implemented by" test. crr)nameimlevel)rz Not a methodT) implementedBy providedByrnamesAndDescriptionsgetattrAttributeError isinstancer rrsys version_infotyper MethodTypes__func__r propertycallablergetSignatureInfo _incompat) iface candidate tentativevtypetesterrdescattrmethmessr(L/usr/lib/python3/dist-packages/mercurial/thirdparty/zope/interface/verify.py_verifysH         r*cCt|||ddS)Nr r"r*rr r!r(r(r) verifyClassgr/cCr+)Nor,r-r.r(r(r) verifyObjectjr0r2cCspt|dt|dkrdSt|dt|dkr |ds dS|dr*|ds*dS|dr4|ds6dSdSdS) Nrequiredz*implementation requires too many arguments positionalvarargsz-implementation doesn't allow enough argumentskwargsz0implementation doesn't support keyword argumentsz1implementation doesn't support variable arguments)len)r3 implementedr(r(r)rmsr)rN)r)__doc__ __future__r exceptionsrrrtypesrr interfacer r r rrr*r/r2rr(r(r(r)s    J