/usr/lib/python3/dist-packages/zope/interface/__pycache__
Edit: /usr/lib/python3/dist-packages/zope/interface/__pycache__/verify.cpython-310.pyc (4435B)
o
$
x` @ s d Z ddlmZ ddlZddlZddlmZ ddlmZ ddlm Z ddl
mZ ddl
mZ dd l
m
Z
dd
l
mZ ddl
mZ ddlmZmZmZ d
dgZefZdddZdd ZdddZddd
Zej e_ dZeefZdd Zdd ZdS )z!Verify interface implementations
)print_functionN)FunctionType)
MethodType)PYPY2)BrokenImplementation)BrokenMethodImplementation)DoesNotImplement)Invalid)MultipleInvalid)
fromMethodfromFunctionMethodverifyObjectverifyClassFc C s |dkr| j }n| j}g }|s||s|t| | | jddD ]%\}}z
t| |||| W q! tyF } z|| W Y d}~q!d}~ww |rYt|dkrS|d t| ||dS )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)allN r )
implementedBy
providedByappendr namesAndDescriptions_verify_elementr lenr
) iface candidate tentativevtypetesterexcsnamedesce r" 7/usr/lib/python3/dist-packages/zope/interface/verify.py_verify* s$ r$ c C sJ zt ||}W n ty t|ts|dkrY d S t| ||w t|ts(d S t|s2t|r4d S t|trZt j
d dkrRt|trR|dkrRt|| |dd}n4t|| |d}n,t|t
rmt|jtu rmt|| |}nt|trx|dkrxd S t|st|d|| |d S t| | }|rtrt|||rd S t|||| |d S )Nr r r )r imlevel)r zimplementation is not a method)getattrAttributeError
isinstancer
r inspectismethoddescriptor isbuiltinr sysversion_infotyper MethodTypes__func__r propertycallabler _incompatgetSignatureInfor _pypy2_false_positive)r r r r r attrmethmessr" r" r# r ` sB
r c C t | ||ddS )zF
Verify that the *candidate* might correctly provide *iface*.
r r r$ r r r r" r" r# r s c C r: )Nor; r<