Spade
Mini Shell
| Directory:~$ /proc/self/root/usr/lib64/python2.7/site-packages/zope/interface/ |
| [Home] [System Details] [Kill Me] |
�
j�/Qc@s�dZddlmZyddlmZWnek
rCeZnXeZddlZd�Z dd�Z
d�Zdd �Z
d
�ZdS(sjClass advice.
This module was adapted from 'protocols.advice', part of the
Python
Enterprise Application Kit (PEAK). Please notify the PEAK authors
(pje@telecommunity.com and tsarna@sarna.org) if bugs are found or
Zope-specific changes are required, so that the PEAK version of this module
can be kept in sync.
PEAK is a Python application framework that interoperates with (but does
not require) Zope 3 and Twisted. It provides tools for manipulating UML
models, object-relational persistence, aspect-oriented programming, and
more.
Visit the PEAK home page at http://peak.telecommunity.com for more
information.
i����(tFunctionType(t ClassTypeNc
Cs�|j}|j}||k}d|k}d|k}|o?|}|oY|d|dk}|rxtjj|d�p{d}|o�|j|k}|s�d} nA|r�|r�d} n+|r�|r�d} n|s�d} nd} | |||fS( s�Return
(kind,module,locals,globals) for a frame
'kind' is one of "exec", "module",
"class", "function call", or "unknown".
t
__module__t__name__texectmoduletclasss
function
calltunknownN(tf_localst f_globalstsystmodulestgettNonet__dict__(
tframeRR t
sameNamespacet hasModulethasNametsameNameRtnamespaceIsModuletkind((s;/usr/lib64/python2.7/site-packages/zope/interface/advice.pytgetFrameInfo&s& "
ics�trtd��ntj|�}t|�\}}}}|jd��trf|jdt��n|jdt�����fd�}�|_�|_ ||d<dS(s2Set
up 'callback' to be passed the containing class upon creation
This function is designed to be called by an "advising"
function executed
in a class suite. The "advising" function supplies a
callback that it
wishes to have executed when the containing class is created. The
callback will be given one argument: the newly created containing
class.
The return value of the callback will be used in place of the class, so
the callback should return the input if it does not wish to replace the
class.
The optional 'depth' argument to this function determines the
number of
frames between this function and the targeted class suite.
'depth'
defaults to 2, since this skips this function's frame and one
calling
function frame. If you use this function from a function called
directly
in the class suite, the default will be correct, otherwise you will
need
to determine the correct depth yourself.
This function works by installing a special class factory function in
place of the '__metaclass__' of the containing class.
Therefore, only
callbacks *after* the last '__metaclass__' assignment in the
containing
class will be executed. Be sure that classes using
"advising" functions
declare any '__metaclass__' *first*, to ensure all callbacks
are run.s"Class advice impossible in
Python3t
__metaclass__cs�d|kr|d=n�dkr@|r7t|�}qd�}n$t��rU�}nt|��}||||�}�|�S(NR(R
tdetermineMetaclasstisClassAdvisor(tnametbasestcdicttmetatnewClass(tcallbacktdefaultMetaclasstpreviousMetaclass(s;/usr/lib64/python2.7/site-packages/zope/interface/advice.pytadvisexs
N(
t __python3t TypeErrorR
t _getframeRRttypeRR!R(RtdepthRRRt
caller_localstcaller_globalsR"((RR
R!s;/usr/lib64/python2.7/site-packages/zope/interface/advice.pytaddClassAdvisorJs
cCst|t�ot|d�S(s(True if 'ob' is a
class advisor functionR!(t
isinstanceRthasattr(tob((s;/usr/lib64/python2.7/site-packages/zope/interface/advice.pyR�scCs�g|D]}t|dt|��^q}|dk rG|j|�nt|�dkra|dSt|�}|s�ts�t�tSt|�dkr�t d|��n|dS(sEDetermine
metaclass from 1+ bases and optional explicit
__metaclass__t __class__iisIncompatible metatypesN(
tgetattrR&R
tappendtlentminimalBasesR#tAssertionErrorRR$(Rtexplicit_mctbRt
candidates((s;/usr/lib64/python2.7/site-packages/zope/interface/advice.pyR�s+
cCs�ts.g|D]}|tk r
|^q
}ng}xg|D]_}xV|D]%}t||�rH||k rHPqHqHW||kr�|j|�n|j|�q;W|S(s?Reduce
a list of base classes to its ordered minimum equivalent(R#Rt
issubclasstremoveR0(tclassestcR6tmtn((s;/usr/lib64/python2.7/site-packages/zope/interface/advice.pyR2�s(
(t__doc__ttypesRRtImportErrortTrueR#tFalseR
RR*RR
RR2(((s;/usr/lib64/python2.7/site-packages/zope/interface/advice.pyt<module>s
$P