From 3b8b73b954ed26b8b179568dbc9791ddeb533665 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Mon, 1 Jul 2019 21:35:28 +0800 Subject: [PATCH] [Mod] move test_client/test_server to examples folder --- {vnpy/rpc => examples/simple_rpc}/test_client.py | 10 +++++----- {vnpy/rpc => examples/simple_rpc}/test_server.py | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) rename {vnpy/rpc => examples/simple_rpc}/test_client.py (74%) rename {vnpy/rpc => examples/simple_rpc}/test_server.py (72%) diff --git a/vnpy/rpc/test_client.py b/examples/simple_rpc/test_client.py similarity index 74% rename from vnpy/rpc/test_client.py rename to examples/simple_rpc/test_client.py index 7a693a52..57dd0909 100644 --- a/vnpy/rpc/test_client.py +++ b/examples/simple_rpc/test_client.py @@ -20,15 +20,15 @@ class TestClient(RpcClient): """ Realize callable function """ - print('client received topic:', topic, ', data:', data) + print(f"client received topic:{topic}, data:{data}") -if __name__ == '__main__': - req_address = 'tcp://localhost:2014' - sub_address = 'tcp://localhost:0602' +if __name__ == "__main__": + req_address = "tcp://localhost:2014" + sub_address = "tcp://localhost:0602" tc = TestClient(req_address, sub_address) - tc.subscribeTopic('') + tc.subscribe_topic("") tc.start() while 1: diff --git a/vnpy/rpc/test_server.py b/examples/simple_rpc/test_server.py similarity index 72% rename from vnpy/rpc/test_server.py rename to examples/simple_rpc/test_server.py index 660168fc..3589bead 100644 --- a/vnpy/rpc/test_server.py +++ b/examples/simple_rpc/test_server.py @@ -22,19 +22,19 @@ class TestServer(RpcServer): """ Test function """ - print('receiving: %s, %s' % (a, b)) + print(f"receiving:{a} {b}") return a + b -if __name__ == '__main__': - rep_address = 'tcp://*:2014' - pub_address = 'tcp://*:0602' +if __name__ == "__main__": + rep_address = "tcp://*:2014" + pub_address = "tcp://*:0602" ts = TestServer(rep_address, pub_address) ts.start() while 1: - content = 'current server time is %s' % time() + content = f"current server time is {time()}" print(content) - ts.publish('test', content) + ts.publish("test", content) sleep(2)