Commit c0341864 authored by Leo Pound Singer's avatar Leo Pound Singer

Add docstring return values

parent dbe1d94d
Pipeline #110214 passed with stages
in 1 minute and 34 seconds
......@@ -197,12 +197,26 @@ class LVAlertClient(slixmpp.ClientXMPP):
return 'pubsub.{}'.format(self.boundjid.server)
async def get_nodes(self):
"""Get a list of all available pubsub nodes."""
"""Get a list of all available pubsub nodes.
Returns
-------
list
A list of strings naming the available pubsub nodes
"""
result = await self['xep_0060'].get_nodes(self._pubsub_server)
return [item for _, item, _ in result['disco_items']['items']]
async def get_subscriptions(self):
"""Get a list of your subscriptions."""
"""Get a list of your subscriptions.
Returns
-------
list
A list of strings naming the subscribed pubsub nodes
"""
result = await self['xep_0060'].get_subscriptions(self._pubsub_server)
return sorted({stanza['node'] for stanza in
result['pubsub']['subscriptions']['substanzas']})
......@@ -211,7 +225,14 @@ class LVAlertClient(slixmpp.ClientXMPP):
await self['xep_0060'].subscribe(self._pubsub_server, node)
async def subscribe(self, *nodes):
"""Subscribe to one or more pubsub nodes."""
"""Subscribe to one or more pubsub nodes.
Parameters
----------
*args : list
A list of strings naming the pubsub nodes to which to subscribe
"""
await asyncio.gather(*(self._subscribe(node) for node in nodes))
async def _unsubscribe(self, node):
......@@ -224,5 +245,12 @@ class LVAlertClient(slixmpp.ClientXMPP):
for subid in subids))
async def unsubscribe(self, *nodes):
"""Unsubscribe from one or more pubsub nodes."""
"""Unsubscribe from one or more pubsub nodes.
Parameters
----------
*args : list
A list of strings naming the pubsub nodes from which to unsubscribe
"""
await asyncio.gather(*(self._unsubscribe(node) for node in nodes))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment