<filename>priactice_test/RPC_test/RPCproxy.py<gh_stars>0
import pickle


class RPCproxy():
    def __init__(self, connection):
        self._connection = connection

    def get_attr(self, name):
        def do_rpc(*args, **kwargs):
            self._connection.send(pickle.dumps((name, args, kwargs)))
            result = pickle.loads(self._connection.recv())
            if isinstance(result, Exception):
                raise result
            return result

        return do_rpc

<filename>priactice_test/RPC_test/RPCproxy.py<gh_stars>0
import pickle


class RPCproxy():
    def __init__(self, connection):
        self._connection = connection

    def get_attr(self, name):
        def do_rpc(*args, **kwargs):
            self._connection.send(pickle.dumps((name, args, kwargs)))
            result = pickle.loads(self._connection.recv())
            if isinstance(result, Exception):
                raise result
            return result

        return do_rpc
