def _hijack_target()

in doubles/proxy_method.py [0:0]


    def _hijack_target(self):
        """Replaces the target method on the target object with the proxy method."""

        if self._target.is_class_or_module():
            setattr(self._target.obj, self._method_name, self)
        elif self._attr.kind == 'property':
            proxy_property = ProxyProperty(
                double_name(self._method_name),
                self._original_method,
            )
            setattr(self._target.obj.__class__, self._method_name, proxy_property)
            self._target.obj.__dict__[double_name(self._method_name)] = self
        else:
            self._target.obj.__dict__[self._method_name] = self

        if self._method_name in ['__call__', '__enter__', '__exit__']:
            self._target.hijack_attr(self._method_name)