summaryrefslogtreecommitdiff
path: root/python/qpid/util.py
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2008-05-16 15:58:12 +0000
committerRafael H. Schloming <rhs@apache.org>2008-05-16 15:58:12 +0000
commit7f60fd46d5aad44dad79cdc3cf67c9804fc94e3e (patch)
tree7e2ab527f6cd802baf57c63c0a15ea784425874f /python/qpid/util.py
parente6bc6ff91d47d1330d2fbbe88005beaf935382a3 (diff)
downloadqpid-python-7f60fd46d5aad44dad79cdc3cf67c9804fc94e3e.tar.gz
QPID-947: initialize docstrings for protocol methods from the spec
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@657112 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/util.py')
-rw-r--r--python/qpid/util.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/python/qpid/util.py b/python/qpid/util.py
index d03a9bd7e9..1140cbe5ef 100644
--- a/python/qpid/util.py
+++ b/python/qpid/util.py
@@ -17,7 +17,7 @@
# under the License.
#
-import os, socket, time
+import os, socket, time, textwrap
def connect(host, port):
sock = socket.socket()
@@ -65,3 +65,14 @@ def notify(condition, action=lambda: None):
condition.notifyAll()
finally:
condition.release()
+
+def fill(text, indent, heading = None):
+ sub = indent * " "
+ if heading:
+ if not text:
+ return (indent - 2) * " " + heading
+ init = (indent - 2) * " " + heading + " -- "
+ else:
+ init = sub
+ w = textwrap.TextWrapper(initial_indent = init, subsequent_indent = sub)
+ return w.fill(" ".join(text.split()))