diff options
author | Link Mauve <linkmauve@linkmauve.fr> | 2020-12-10 19:45:30 +0100 |
---|---|---|
committer | Link Mauve <linkmauve@linkmauve.fr> | 2020-12-10 19:45:30 +0100 |
commit | 1e2d15b8f58249b31dd5882772d58add1369fc37 (patch) | |
tree | 6d39e5fc8241884acf30b209a07ef4cabd80c323 /slixmpp/plugins/xep_0199/ping.py | |
parent | d37182804102682a715df43c48a6d874835cd71a (diff) | |
parent | 155fc58a22d631746436a81119a94c80d6ea2d2b (diff) | |
download | slixmpp-1e2d15b8f58249b31dd5882772d58add1369fc37.tar.gz slixmpp-1e2d15b8f58249b31dd5882772d58add1369fc37.tar.bz2 slixmpp-1e2d15b8f58249b31dd5882772d58add1369fc37.tar.xz slixmpp-1e2d15b8f58249b31dd5882772d58add1369fc37.zip |
Merge branch 'docs-event-sphinx-plugins' into 'master'
Docs: add more events, add plugins to the doc
See merge request poezio/slixmpp!84
Diffstat (limited to 'slixmpp/plugins/xep_0199/ping.py')
-rw-r--r-- | slixmpp/plugins/xep_0199/ping.py | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/slixmpp/plugins/xep_0199/ping.py b/slixmpp/plugins/xep_0199/ping.py index adbf2203..d1a82026 100644 --- a/slixmpp/plugins/xep_0199/ping.py +++ b/slixmpp/plugins/xep_0199/ping.py @@ -9,6 +9,8 @@ import time import logging +from typing import Optional, Callable + from slixmpp.jid import JID from slixmpp.stanza import Iq from slixmpp import asyncio @@ -123,17 +125,13 @@ class XEP_0199(BasePlugin): log.debug("Pinged by %s", iq['from']) iq.reply().send() - def send_ping(self, jid, ifrom=None, timeout=None, callback=None, - timeout_callback=None): + def send_ping(self, jid: JID, ifrom: Optional[JID] = None, + timeout: Optional[int] = None, + callback: Optional[Callable] = None, + timeout_callback: Optional[Callable] = None): """Send a ping request. - Arguments: - jid -- The JID that will receive the ping. - ifrom -- Specifiy the sender JID. - timeout -- Time in seconds to wait for a response. - Defaults to self.timeout. - callback -- Optional handler to execute when a pong - is received. + :param jid: The JID that will receive the ping. """ if not timeout: timeout = self.timeout @@ -147,15 +145,12 @@ class XEP_0199(BasePlugin): return iq.send(timeout=timeout, callback=callback, timeout_callback=timeout_callback) - async def ping(self, jid=None, ifrom=None, timeout=None): + async def ping(self, jid: Optional[JID] =None, + ifrom: Optional[JID] = None, timeout: Optional[int] = None) -> float: """Send a ping request and calculate RTT. This is a coroutine. - Arguments: - jid -- The JID that will receive the ping. - ifrom -- Specifiy the sender JID. - timeout -- Time in seconds to wait for a response. - Defaults to self.timeout. + :param jid: The JID that will receive the ping. """ own_host = False if not jid: |