Ñò
¶TJJc @ s› d Z d d k l Z l Z d d k l Z d d k l Z l Z d d k l Z l
Z
l Z e f Z d d d „ Z d d „ Z d d „ Z d
„ Z d S( sU Verify interface implementations
$Id: verify.py 92658 2008-10-28 17:12:35Z tlotze $
iÿÿÿÿ( t BrokenImplementationt DoesNotImplement( t BrokenMethodImplementation( t FunctionTypet
MethodType( t
fromMethodt fromFunctiont Methodi c
C sª | d j o
| i } n
| i } | o | | ƒ o t | ƒ ‚ n xZ| i d ƒ D]I\ } } y t | | ƒ } WnG t j
o; t | t ƒ o | d j o qY n t | | ƒ ‚ n Xt | t ƒ p qY n t | t ƒ o t
| | d | ƒ} n` t | t ƒ o, t | i
ƒ t j o t | | | ƒ } n$ t | ƒ p t | d ƒ ‚ qY qY | i ƒ } | i ƒ } t | | ƒ } | o t | | ƒ ‚ qY qY Wt S( sÍ Verify 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.
t ci t names Not a method( t
implementedByt
providedByR t namesAndDescriptionst getattrt AttributeErrort
isinstanceR R R R t MethodTypest typet im_funcR t callableR t getSignatureInfot _incompatt True(
t ifacet candidatet tentativet vtypet testerR t desct attrt metht mess( ( s; /usr/lib64/python2.6/site-packages/zope/interface/verify.pyt _verify s:
c C s t | | | d d ƒS( NR R ( R ( R R R ( ( s; /usr/lib64/python2.6/site-packages/zope/interface/verify.pyt verifyClass] s c C s t | | | d d ƒS( NR t o( R ( R R R ( ( s; /usr/lib64/python2.6/site-packages/zope/interface/verify.pyt verifyObject` s c C s” t | d ƒ t | d ƒ j o d St | d ƒ t | d ƒ j o | d o d S| d o | d o d S| d o | d o d Sd S( Nt requireds* implementation requires too many argumentst
positionalt varargss- implementation doesn't allow enough argumentst kwargss0 implementation doesn't support keyword argumentss1 implementation doesn't support variable arguments( t len( R$ t implemented( ( s; /usr/lib64/python2.6/site-packages/zope/interface/verify.pyR c s !!N( t __doc__t zope.interface.exceptionsR R R t typesR R t zope.interface.interfaceR R R R t NoneR R! R# R ( ( ( s; /usr/lib64/python2.6/site-packages/zope/interface/verify.pyt