U e5d‹S ã @ sÐ d Z ddlmZmZmZmZmZmZmZm Z ddl mZmZ ddl Z ddlZddlZeefZddddd d ddd ddddg ZG dd„ deƒZG dd„ de jƒZG dd„ deƒZG dd „ d e jƒZG dd„ dƒZdS )z{Weak reference support for Python. This module is an implementation of PEP 205: http://www.python.org/dev/peps/pep-0205/ é )ÚgetweakrefcountÚgetweakrefsÚrefÚproxyÚCallableProxyTypeÚ ProxyTypeÚ ReferenceTypeÚ_remove_dead_weakref)ÚWeakSetÚ_IterationGuardNr r r r ÚWeakKeyDictionaryr r r Ú ProxyTypesÚWeakValueDictionaryr Ú WeakMethodÚfinalizec sD e Zd ZdZdZddd„Z‡ fdd„Zdd „ Zd d„ Ze j Z ‡ ZS ) r z— A custom `weakref.ref` subclass which simulates a weak reference to a bound method, working around the lifetime problem of bound methods. )Ú _func_refÚ _meth_typeÚ_aliveÚ__weakref__Nc s~ z|j }|j}W n( tk r8 td t|ƒ¡ƒd ‚Y nX ‡ ‡fdd„}t | ||¡}t||ƒ|_t|ƒ|_ d|_ t|ƒ‰|S )Nz)argument should be a bound method, not {}c s&