def __init__(self, func, identify_observed, weakref_info):
        """Initialize an ObserverFunction.

        Args:
            func: function I wrap. I call this function when I am called.
            identify_observed: boolean indicating whether or not I will pass
                the observed object as the first argument to the function I
                wrap. True means pass the observed object, False means do not
                pass the observed objec.
            weakref_info: Tuple of (key, dict) where dict is the dictionary
                which is keeping track of my role as an observer and key is
                the key in that dict which maps to me. When the function I wrap
                is finalized, I use this information to delete myself from the
                dictionary.
        """

        # For some reason, if we put the update_wrapper after we make the
        # weak reference to func, the call to weakref.ref returns a function
        # instead of a weak ref. So, don't move the next line chomp, chomp...
        functools.update_wrapper(self, func)
        self.identify_observed = identify_observed
        key, d = weakref_info
        self.func_wr = weakref.ref(func, CleanupHandler(key, d))
def __init__ ( self , func , identify_observed , weakref_info ) : functools . update_wrapper ( self , func ) self . identify_observed = identify_observed key , d = weakref_info self . func_wr = weakref . ref ( func , CleanupHandler ( key , d ) )
Initialize an ObserverFunction.

        Args:
            func: function I wrap. I call this function when I am called.
            identify_observed: boolean indicating whether or not I will pass
                the observed object as the first argument to the function I
                wrap. True means pass the observed object, False means do not
                pass the observed objec.
            weakref_info: Tuple of (key, dict) where dict is the dictionary
                which is keeping track of my role as an observer and key is
                the key in that dict which maps to me. When the function I wrap
                is finalized, I use this information to delete myself from the
                dictionary.