From 95d40a3ca336a4e1b66c7ed287ec3f2ef92b201c Mon Sep 17 00:00:00 2001 From: mathieui Date: Thu, 10 Dec 2020 19:20:23 +0100 Subject: docs: update docstrings for sphinx conformity Remove most references to timeout/callback/ifrom/timeout_callbacks args --- slixmpp/plugins/xep_0222.py | 53 +++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 26 deletions(-) (limited to 'slixmpp/plugins/xep_0222.py') diff --git a/slixmpp/plugins/xep_0222.py b/slixmpp/plugins/xep_0222.py index abb10163..fdcf6c70 100644 --- a/slixmpp/plugins/xep_0222.py +++ b/slixmpp/plugins/xep_0222.py @@ -8,8 +8,11 @@ import logging -from slixmpp.xmlstream import register_stanza_plugin +from typing import Optional, Callable, List +from slixmpp import JID +from slixmpp.xmlstream import register_stanza_plugin, ElementBase from slixmpp.plugins.base import BasePlugin, register_plugin +from slixmpp.plugins.xep_0004.stanza import Form log = logging.getLogger(__name__) @@ -43,27 +46,23 @@ class XEP_0222(BasePlugin): callback=callback, timeout=timeout) - def store(self, stanza, node=None, id=None, ifrom=None, options=None, - callback=None, timeout=None): + def store(self, stanza: ElementBase, node: Optional[str] = None, + id: Optional[str] = None, ifrom: Optional[JID] = None, + options: Optional[Form] = None, + callback: Optional[Callable] = None, + timeout: Optional[int] = None): """ Store public data via PEP. This is just a (very) thin wrapper around the XEP-0060 publish() method to set the defaults expected by PEP. - Arguments: - stanza -- The private content to store. - node -- The node to publish the content to. If not specified, - the stanza's namespace will be used. - id -- Optionally specify the ID of the item. - options -- Publish options to use, which will be modified to + :param stanza: The private content to store. + :param node: The node to publish the content to. If not specified, + the stanza's namespace will be used. + :param id: Optionally specify the ID of the item. + :param options: Publish options to use, which will be modified to fit the persistent storage option profile. - ifrom -- Specify the sender's JID. - timeout -- The length of time (in seconds) to wait for a response - before exiting the send call if blocking is used. - Defaults to slixmpp.xmlstream.RESPONSE_TIMEOUT - callback -- Optional reference to a stream handler function. Will - be executed when a reply stanza is received. """ if not options: options = self.xmpp['xep_0004'].stanza.Form() @@ -85,25 +84,27 @@ class XEP_0222(BasePlugin): callback=callback, timeout=timeout) - def retrieve(self, node, id=None, item_ids=None, ifrom=None, - callback=None, timeout=None): + def retrieve(self, node: str, id: Optional[str] = None, + item_ids: Optional[List[str]] = None, + ifrom: Optional[JID] = None, + callback: Optional[Callable] = None, + timeout: Optional[int] = None): """ Retrieve public data via PEP. This is just a (very) thin wrapper around the XEP-0060 publish() method to set the defaults expected by PEP. - Arguments: - node -- The node to retrieve content from. - id -- Optionally specify the ID of the item. - item_ids -- Specify a group of IDs. If id is also specified, it - will be included in item_ids. - ifrom -- Specify the sender's JID. - timeout -- The length of time (in seconds) to wait for a response + :param node: The node to retrieve content from. + :param id: Optionally specify the ID of the item. + :param item_ids: Specify a group of IDs. If id is also specified, it + will be included in item_ids. + :param ifrom: Specify the sender's JID. + :param timeout: The length of time (in seconds) to wait for a response before exiting the send call if blocking is used. Defaults to slixmpp.xmlstream.RESPONSE_TIMEOUT - callback -- Optional reference to a stream handler function. Will - be executed when a reply stanza is received. + :param callback: Optional reference to a stream handler function. Will + be executed when a reply stanza is received. """ if item_ids is None: item_ids = [] -- cgit v1.2.3