Spade

Mini Shell

Directory:~$ /proc/self/root/usr/lib64/python2.7/site-packages/zope/interface/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ //proc/self/root/usr/lib64/python2.7/site-packages/zope/interface/interface.pyc

�
j�/Qc@sZdZddlmZddlZddlmZddlmZddlZddlZddl	m
Z
ddlmZdZ
d	Zd
Ze�Zd�Zd�Zd
efd��YZdefd��YZeZyddlmZWnek
rnXe�Zdefd��YZeZyddlmZWnek
rMnXgZyddlmZWnek
r{nXdefd��YZdeeefd��YZeddd�Zdefd��YZ
de fd
��YZ!e"d!e"d"�Z#e"e"d#�Z$d$�Z%dd%l&m'Z'dd&l&m(Z(dd'l	m)Z)dd(l	m*Z*dS()s
Interface object implementation
i����(t
generatorsN(t
MethodType(tFunctionType(tInvalid(troiit__interface_tagged_values__cCsGtjd�j}|jti�}|jdg�}|j|�tS(Nit
invariants(tsyst	_getframetf_localst
setdefaulttTAGGED_DATAtappendt_decorator_non_return(tcallR	ttagsR((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt	invariant"s

cCs2tjd�j}|jti�}|||<tS(s;Attaches a tagged
value to an interface at definition time.i(RRR	R
RR
(tkeytvalueR	t
tagged_values((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyttaggedValue*s
tElementcBsMeZdd�Zd�Zd�Zd�Zdd�Zd�Zd�Z	RS(	tcCsJ|r+|jd�dkr+|}d}n||_||_i|_dS(s*Create
an 'attribute' description
        t
iN(tfindtNonet__name__t__doc__t_Element__tagged_values(tselfRR((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt__init__9s			cCs|jS(s!
Returns the name of the object.
(R(R((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pytgetNameDscCs|jS(s+
Returns the documentation for the object.
(R(R((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pytgetDocHscCs|j|S(s*
Returns the value associated with 'tag'.
(R(Rttag((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pytgetTaggedValueLscCs|jj||�S(s*
Returns the value associated with 'tag'.
(Rtget(RR!tdefault((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pytqueryTaggedValuePscCs
|jj�S(s
Returns a list of all tags.
(Rtkeys(R((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pytgetTaggedValueTagsTscCs||j|<dS(s
 Associates 'value' with 'key'.
N(R(RR!R((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pytsetTaggedValueXsN(
Rt
__module__RRR
R"RR%R'R((((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyR2s				tSpecificationBasePycBs)eZd�Zd�Zd�ZeZRS(cCst|�}||jkS(s2Is
the interface implemented by an object
        (t
providedByt_implied(Rtobtspec((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyR+^scCst|�}||jkS(s�Test
whether the specification is implemented by a class or factory.

        Raise TypeError if argument is neither a class nor a callable.
       
(t
implementedByR,(RtclsR.((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyR/dscCs
||jkS(sCIs
the interface the same as or extend the given interface
       
(R,(Rt	interface((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pytisOrExtendsls(RR)R+R/R2t__call__(((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyR*\s			(tSpecificationBasetInterfaceBasePycBs#eZdZed�Zd�ZRS(s:Base
class that wants to be replaced with a C base :)
   
cCs�t|dd�}|dk	r@|j|�}|dk	r@|Sn|j|�}|dk	r_|S|tk	ro|Std||��dS(s)Adapt
an object to the interface
        t__conform__sCould not
adaptN(tgetattrRt
_call_conformt	__adapt__t_markert	TypeError(Rtobjt	alternatetconformtadapter((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyR3~scCsG|j|�r|Sx-tD]%}|||�}|dk	r|SqWdS(s(Adapt
an object to the reciever
       
N(R+t
adapter_hooksR(RR<thookR?((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyR9�s
(RR)RR:R3R9(((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyR5zs(t
InterfaceBase(R@t
SpecificationcBs�eZdZejZejZdd�Zd�Zd�Zd�Z	e
d�e	�Zd�Zd�Z
ed�Zdd	�Zdd
�ZRS(
swSpecifications

    An interface specification is used to track interface declarations
    and component registrations.

    This class is a base class for both interfaces themselves and for
    interface specifications (declarations).

    Specifications are mutable.  If you reassign their bases, their
    relations with other specifications are adjusted accordingly.
    cCs+i|_tj�|_t|�|_dS(N(R,tweakreftWeakKeyDictionaryt
dependentsttuplet	__bases__(Rtbases((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyR�s	cCs$|jj|d�d|j|<dS(Nii(RFR#(Rt	dependent((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt	subscribe�scCsX|jj|d�d}|s,|j|=n(|dkrH||j|<nt|��dS(Nii(RFR#tKeyError(RRJtn((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pytunsubscribe�s
cCs]x|jD]}|j|�q
W||jd<x|D]}|j|�q5W|j|�dS(NRH(RHRNt__dict__RKtchanged(RRItb((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt
__setBases�s

cCs|jjdd�S(NRH((ROR#(R((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt<lambda>�scCs�y
|`Wntk
rnX|j}|j�t|�}y t|kr\|jt�nWntk
rpnXt|�|_	tg|D]}t
|t�r�|^q��|_x|D]}d||<q�Wx*t|j
j��D]}|j|�q�WdS(s4We,
or something we depend on, have changed
       
N((t_v_attrstAttributeErrorR,tclearRt	InterfaceRt	NameErrorRGt__sro__t
isinstancetInterfaceClasst__iro__RFR&RP(Rtoriginally_changedtimpliedt	ancestorstancestorRJ((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyRP�s&

	

!
ccsSi}xF|jD];}x2|j�D]$}||kr#d||<|Vq#q#WqWdS(sDReturn
an iterator for the interfaces in the specification.
        iN(RHt
interfaces(RtseentbaseR1((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyRa�s
cCs ||jko|p||kS(s�Does the specification extend the given
interface?

        Test whether an interface in the specification extends the
        given interface
       
(R,(RR1tstrict((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pytextends
scCstj||�S(N(RDtref(Rtcallback((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyRDscCs�y
|j}Wntk
r-i}|_nX|j|�}|dkr�x=|jD]/}|j|�}|dk	rS|||<PqSqSWn|dkr�|S|SdS(s+Query
for an attribute description
       
N(RTRUR#RR\tdirect(RtnameR$tattrstattrtiface((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyR#s


(N(RR)RR4R2R+RRKRNt_Specification__setBasestpropertyRHRPRatTrueReRRDR#(((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyRC�s								!	R[cBs
eZdZddddd�Zd�Zd�Zd�Zed�Z	d�Z
ed�Zd�ZeZ
d	�Zd
�Zdd�Zd�Zdd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(s0Prototype
(scarecrow) Interfaces
Implementation.cCsm|dkri}n|dkr�|jd�}t|t�rI|d=q�ytjd�jd}Wq�ttfk
r|q�Xn||_	|jd�}|dk	r�t|t
�s�|dkr�|}n|d=q�n|dkr�d}ntj|||�|j
td�}|dk	rKx-|j�D]\}}	|j||	�q(Wnx,|D]$}
t|
t�sRtd��qRqRWtj||�x�t|j��D]�\}}|dkr�||=q�nt|t
�r�||_|jsC||_qCq�t|t�rt||d	|�||<q�|tkr3||=q�td
|��q�W||_d|j	|jf|_dS(
NR)iRRRsExpected base
interfacest
__locals__t__qualname__RisConcrete attribute,
s%s.%s(RpRq(RR#RZtstrRRt	f_globalsRURLR)t	AttributeRRtpopRtitemsR(R[R;RCtlistR1RRtfromFunctionR
tInvalidInterfacet_InterfaceClass__attrst__identifier__(RRiRIRjRR)tdttagged_dataRtvalRcRk((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyR4sV	
		
	
		
	ccs	|VdS(sDReturn an iterator for the interfaces in the
specification.
       
N((R((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyRawscCs|jS(N(RH(R((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pytgetBases|scCs||kp|j|�S(sSame
interface or
extends?(Re(Rtother((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pytisEqualOrExtendedByscCs_|s|jj�S|jj�}x0|jD]%}|jtj|j|���q,W|j�S(s4Return
the attribute names defined by the
interface.(RzR&tcopyRHtupdatetdicttfromkeystnames(RtalltrRc((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyR��s
#cCst|jdt��S(NR�(titerR�Ro(R((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt__iter__�scCsp|s|jj�Si}x:|jddd�D]"}|jt|j|���q0W|j|j�|j�S(s=Return
attribute names and descriptions defined by
interface.Ni����(RzRvRHR�R�tnamesAndDescriptions(RR�R�Rc((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyR��s

cCs/|j|�}|dk	r|St|��dS(s4Return the attribute
description for the given
name.N(R#RRL(RRiR�((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pytgetDescriptionFor�scCs|j|�dk	S(N(R#R(RRi((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt__contains__�scCs|jj|�S(N(RzR#(RRi((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyRh�scCs|j||�S(N(R#(RRiR$((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pytqueryDescriptionFor�scBsXe|d�r|jSi}d|j|fdU||j}|j|�||_|S(s6Return
a defered class corresponding to the interface.t	_deferredsclass %s:
passN(thasattrR�Rt_InterfaceClass__d(Rtklass((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pytdeferred�s

	cCs�x]|jdg�D]I}y||�Wqtk
r[}|dkrK�q\|j|�qXqWxK|jD]@}y|j||�Wqjtk
r�|dkr��q�qjXqjW|r�t|��ndS(s&validate object
to defined
invariants.RN(R%RRRRHtvalidateInvariants(RR<terrorsRteRc((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyR��s
cCsvxN|jj�D]=\}}t|t�r||jkrt|||�qqWx|jD]}|j|�q[WdS(N(RzRvRZtMethodROtsetattrRHR�(RR�tktvRQ((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt__d�s
cCsny|jSWn\tk
ri|j}|j}|rFd||f}nd|jj|f}||_|SXdS(Ns%s.%ss<%s
%s>(t_v_reprRURR)t	__class__(RRitmR�((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt__repr__�s
			cCsEy||�SWn0tk
r@tj�djdk	rA�qAnXdS(Ni(R;Rtexc_infottb_nextR(RR>((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyR8�s

cCs|jS(N(R(R((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt
__reduce__�scCsl|dkrdSt|dd�t|dd�f}t|dd�t|dd�f}||k||kS(s�Make
interfaces sortable

        TODO: It would ne nice if:

           More specific interfaces should sort before less specific ones.
           Otherwise, sort on name and module.

           But this is too complicated, and we're going to punt on it
           for now.

        For now, sort on interface and module name.

        None is treated as a pseudo interface that implies the loosest
        contact possible, no contract. For that reason, all interfaces
        sort before None.

       
i����RRR)N(RR7(RR�tn1tn2((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt__cmps
$$cCsH|j}d|ks!d|kr2tjd�dSt|j|jf�S(NR)Rs-Hashing
uninitialized InterfaceClass
instancei(ROtwarningstwarnthashRR)(RR|((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt__hash__!s
	
cCs|j|�}|dkS(Ni(t_InterfaceClass__cmp(RR�tc((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt__eq__(scCs|j|�}|dkS(Ni(R�(RR�R�((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt__ne__,scCs|j|�}|dkS(Ni(R�(RR�R�((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt__lt__0scCs|j|�}|dkS(Ni(R�(RR�R�((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt__le__4scCs|j|�}|dkS(Ni(R�(RR�R�((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt__gt__8scCs|j|�}|dkS(Ni(R�(RR�R�((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt__ge__<s(N(RR)RRRRaRR�tFalseR�R�R�R�t__getitem__R�RhR�R�R�R�R�R8R�R�R�R�R�R�R�R�R�(((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyR[,s8	B				
															RWR)szope.interfaceRtcBseZdZdZRS(sAttribute
descriptions
   
N(RR)RRR1(((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyRtCsR�cBsneZdZdZZdZZZd�Z	d�Z
d�Zee	e
e�Z
d�Zd�Zd�ZRS(	s�Method interfaces

    The idea here is that you have objects that describe methods.
    This provides an opportunity for rich meta-data.
   
cCs|jdkriS|jS(N(t	_optionalR(R((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt
_get_optional]scCs
||_dS(N(R�(Rtopt((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt
_set_optionalascCs
d|_dS(N(RR�(R((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt
_del_optionalcscOst|j|j��dS(N(tBrokenImplementationR1R(Rtargstkw((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyR3gscCs6i|jd6|jd6|jd6|jd6|jd6S(Nt
positionaltrequiredtoptionaltvarargstkwargs(R�R�R�R�R�(R((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pytgetSignatureInfojs




cCs�g}xW|jD]L}|j|�||jj�kr|dcdt|j|�7<qqW|jr�|jd|j�n|jr�|jd|j�nddj|�S(Ni����t=t*s**s(%s)s,
(R�RR�R&treprR�R�tjoin(RtsigR�((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pytgetSignatureStringrs
(		(N(RR)RR�R�RR�R�R�R�R�R�RnR�R3R�R�(((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyR�Os
					icCsn|p|j}t||j�}t|dd�p6d}|j}|j|}|j|}i}	|t|�}
|
dkr�||
}d}
n|	j	t
t||
|���|| |_||
 |_
|	|_|}|jt@r|||_|d}n	d|_|jt@r(|||_n	d|_||_x-|jj�D]\}}
|j||
�qJW|S(Nt__defaults__ii((RR�RR7Rt__code__tco_argcounttco_varnamestlenR�R�tzipR�R�R�tco_flagst
CO_VARARGSR�tCO_VARKEYWORDSR�R1RORvR((tfuncR1timlevelRitmethodtdefaultstcodetnaR�R�tnrtargnoRR((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyRxs6	

	


	


	
		cCs:t|t�r|j}n|}t||ddd|�S(NR�iRi(RZRt__func__Rx(tmethR1RiR�((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt
fromMethod�scCs�ddlm}ddlm}|t|�ddlm}|t|�ddlm}|t|�ddlm	}|t
|�dS(Ni����(tclassImplements(t
IAttribute(tIMethod(t
IInterface(tISpecification(tzope.interface.declarationsR�tzope.interface.interfacesR�RtR�R�R�R[R�RC(R�R�R�R�R�((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt_wire�s


(R/(R+(Ry(R�(+Rt
__future__RRttypesRRR�RDtzope.interface.exceptionsRtzope.interface.roRR�R�RtobjectR
RRRR*R4t_zope_interface_coptimizationstImportErrorR:R5RBR@RCR[RWRtR�RRxR�R�R�R/R+RyR�(((s>/usr/lib64/python2.7/site-packages/zope/interface/interface.pyt<module>s\			*
	"

��0-