def resolve(self): """ Return a copy of the original object wrapped by this :class:`Proxy`. :rtype: object """ data = serialize((RESOLVE, self.capsule, None, None, None)) result = rpc(self.owner, data) return deserialize(result)
def __getattr__(self, name): """ Get a copy of a remote attribute. :param name: the attribute name :type name: string """ data = serialize((GETATTR, self.capsule, name, None, None)) result = rpc(self.owner, data) answer = deserialize(result) return answer
def __setattr__(self, name, value): """ Set a remote attribute to a copy of a local object. :param name: the attribute name :type name: string :param value: the new attribute value :type value: object :rtype: None """ data = serialize((SETATTR, self.capsule, name, [value], None)) result = rpc(self.owner, data) return deserialize(result)
def __call__(self, *args, **kwargs): """ Invoke the `__call__` method on the original object and return a copy of the result. :param args: positional arguments :type args: tuple :param kwargs: keyword arguments :type args: dictionary :rtype: object """ data = serialize((CALL, self.capsule, '__call__', args, kwargs)) result = rpc(self.owner, data) return deserialize(result)