From ec394dad53eefc410de4058a2abe7181c1bd58c3 Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Mon, 26 Sep 2011 16:02:14 -0700 Subject: [PATCH] stream.py: Make usage() function return a string. This will marginally simplify a future patch. --- python/ovs/stream.py | 18 +++++++----------- tests/test-jsonrpc.py | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/python/ovs/stream.py b/python/ovs/stream.py index 5180642d..3bb0c10f 100644 --- a/python/ovs/stream.py +++ b/python/ovs/stream.py @@ -302,14 +302,10 @@ class PassiveStream(object): self.socket.close() -def usage(name, active, passive): - print - if active: - print("Active %s connection methods:" % name) - print(" unix:FILE " - "Unix domain socket named FILE") - - if passive: - print("Passive %s connection methods:" % name) - print(" punix:FILE " - "listen on Unix domain socket FILE") +def usage(name): + return """ +Active %s connection methods: + unix:FILE Unix domain socket named FILE + +Passive %s connection methods: + punix:FILE Listen on Unix domain socket FILE""" % (name, name) diff --git a/tests/test-jsonrpc.py b/tests/test-jsonrpc.py index 9da3bd2d..5ce45ad2 100644 --- a/tests/test-jsonrpc.py +++ b/tests/test-jsonrpc.py @@ -212,7 +212,7 @@ usage: %s [OPTIONS] COMMAND [ARG...] request REMOTE METHOD PARAMS send request, print reply notify REMOTE METHOD PARAMS send notification and exit """ % (ovs.util.PROGRAM_NAME, ovs.util.PROGRAM_NAME)) - ovs.stream.usage("JSON-RPC", True, True) + sys.stdout.write(ovs.stream.usage("JSON-RPC") + "\n") ovs.daemon.usage() sys.stdout.write(""" Other options: -- 2.30.2