# HG changeset patch # User Laurent Peuch # Date 1576018898 -3600 # Node ID f6662c6037306225e9611718147dd5f78b4697ea # Parent 1156108afab91045377c3e3d9f2590dc73b60575 [debug_channels/doc] add docstring to functions diff -r 1156108afab9 -r f6662c603730 cubicweb/debug.py --- a/cubicweb/debug.py Tue Dec 10 23:34:46 2019 +0100 +++ b/cubicweb/debug.py Wed Dec 11 00:01:38 2019 +0100 @@ -31,6 +31,15 @@ def subscribe_to_debug_channel(channel, subscriber): + """ + Allow to subscribe a callable to one of the debug channels. + + The channel must be one of: %s + + And the callable need to accept one argument. + + It will raise Exception if the channel doesn't exist. + """ % SUBSCRIBERS.keys() if channel not in SUBSCRIBERS.keys(): raise Exception("debug channel '%s' doesn't exist" % channel) @@ -38,6 +47,10 @@ def unsubscribe_to_debug_channel(channel, subscriber): + """ + Unsubscribe a callable from a channel. It will raise Exception if the + channel doesn't exist nor + """ if channel not in SUBSCRIBERS.keys(): raise Exception("debug channel '%s' doesn't exist" % channel) @@ -48,6 +61,12 @@ def emit_to_debug_channel(channel, message): + """ + Send a message to a specified debug channel that will call all its + subscribers. + + It will raise Exception if the channel doesn't exist. + """ if channel not in SUBSCRIBERS.keys(): raise Exception("debug channel '%s' doesn't exist" % channel)