xmlstream/componentxmpp: fix some typing issues
Make mypy happier
This commit is contained in:
parent
2424a3b36f
commit
f151f0a7ab
@ -95,7 +95,9 @@ class ComponentXMPP(BaseXMPP):
|
||||
for st in Message, Iq, Presence:
|
||||
register_stanza_plugin(st, Error)
|
||||
|
||||
def connect(self, host: str = None, port: int = 0, use_ssl: Optional[bool] = None) -> None:
|
||||
def connect(self, host: Optional[str] = None, port: int = 0, use_ssl: Optional[bool] = None,
|
||||
force_starttls: Optional[bool] = None,
|
||||
disable_starttls: Optional[bool] = None) -> None:
|
||||
"""Connect to the server.
|
||||
|
||||
|
||||
@ -105,6 +107,8 @@ class ComponentXMPP(BaseXMPP):
|
||||
Defauts to :attr:`server_port`.
|
||||
:param use_ssl: Flag indicating if SSL should be used by connecting
|
||||
directly to a port using SSL.
|
||||
:param force_starttls: UNUSED
|
||||
:param disable_starttls: UNUSED
|
||||
"""
|
||||
if host is not None:
|
||||
self.server_host = host
|
||||
|
@ -524,7 +524,7 @@ class XMLStream(asyncio.BaseProtocol):
|
||||
else:
|
||||
self.loop.run_until_complete(self.disconnected)
|
||||
else:
|
||||
tasks: List[Awaitable] = [asyncio.Task(asyncio.sleep(timeout))]
|
||||
tasks: List[asyncio.Task] = [asyncio.Task(asyncio.sleep(timeout))]
|
||||
if not forever:
|
||||
tasks.append(self.disconnected)
|
||||
self.loop.run_until_complete(asyncio.wait(tasks))
|
||||
@ -850,6 +850,8 @@ class XMLStream(asyncio.BaseProtocol):
|
||||
log.debug("Connection error:", exc_info=True)
|
||||
self.disconnect()
|
||||
return False
|
||||
if transp is None:
|
||||
raise Exception("Transport should not be none")
|
||||
der_cert = transp.get_extra_info("ssl_object").getpeercert(True)
|
||||
pem_cert = ssl.DER_cert_to_PEM_cert(der_cert)
|
||||
self.event('ssl_cert', pem_cert)
|
||||
|
Loading…
Reference in New Issue
Block a user