Your IP : 216.73.216.196


Current Path : /opt/alt/python27/lib/python2.7/site-packages/astroid/
Upload File :
Current File : //opt/alt/python27/lib/python2.7/site-packages/astroid/decorators.pyc

�
y_VXc@s>dZddlZejd��Zdefd��YZdS(s) A few useful function/method decorators.i����NcCsjt|dd�}|dkr.i|_}ny||SWn)tk
re|||�||<}|SXdS(s>Simple decorator to cache result of method calls without args.t__cacheN(tgetattrtNoneRtKeyError(tfunctinstancetargstkwargstcachetresult((sC/opt/alt/python27/lib/python2.7/site-packages/astroid/decorators.pytcacheds
tcachedpropertycBs8eZdZdZd�Zed��Zdd�ZRS(s� Provides a cached property equivalent to the stacking of
    @cached and @property, but more efficient.

    After first usage, the <property_name> becomes part of the object's
    __dict__. Doing:

      del obj.<property_name> empties the cache.

    Idea taken from the pyramid_ framework and the mercurial_ project.

    .. _pyramid: http://pypi.python.org/pypi/pyramid
    .. _mercurial: http://pypi.python.org/pypi/Mercurial
    twrappedcCs<y|jWn!tk
r.td|��nX||_dS(Ns!%s must have a __name__ attribute(t__name__tAttributeErrort	TypeErrorR(tselfR((sC/opt/alt/python27/lib/python2.7/site-packages/astroid/decorators.pyt__init__8s
cCs-t|jdd�}d|r(d|ndS(Nt__doc__s+<wrapped by the cachedproperty decorator>%ss
%st(RRR(Rtdoc((sC/opt/alt/python27/lib/python2.7/site-packages/astroid/decorators.pyR@scCs9|dkr|S|j|�}t||jj|�|S(N(RRtsetattrR
(Rtinsttobjtypetval((sC/opt/alt/python27/lib/python2.7/site-packages/astroid/decorators.pyt__get__Fs
(RN(R
t
__module__Rt	__slots__RtpropertyRR(((sC/opt/alt/python27/lib/python2.7/site-packages/astroid/decorators.pyR(s

	(Rtwraptt	decoratorR
tobjectR(((sC/opt/alt/python27/lib/python2.7/site-packages/astroid/decorators.pyt<module>s