Skip to content
Snippets Groups Projects
Commit 6feac48c authored by Daniel Brötzmann's avatar Daniel Brötzmann
Browse files

chore: SecLabels: Add type annotations

parent 3c9084de
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,7 @@
from dataclasses import field
from nbxmpp.protocol import JID
from nbxmpp.modules.security_labels import Catalog
from nbxmpp.structs import HTTPAuthData
from nbxmpp.structs import ModerationData
from nbxmpp.structs import LocationData
......@@ -606,7 +607,7 @@ class SecCatalogReceived(ApplicationEvent):
name: str = field(init=False, default='sec-catalog-received')
account: str
jid: str
catalog: dict[str, Any]
catalog: dict[str, Catalog]
@dataclass
......
......@@ -14,13 +14,18 @@
# XEP-0258: Security Labels in XMPP
from __future__ import annotations
from typing import Generator
from typing import Optional
from nbxmpp.errors import is_error
from nbxmpp.namespaces import Namespace
from nbxmpp.modules.security_labels import Catalog
from nbxmpp.structs import DiscoInfo
from gajim.common import app
from gajim.common import types
from gajim.common.events import SecCatalogReceived
from gajim.common.modules.base import BaseModule
from gajim.common.modules.util import as_task
......@@ -33,13 +38,13 @@ class SecLabels(BaseModule):
'request_catalog',
]
def __init__(self, con):
def __init__(self, con: types.Client) -> None:
BaseModule.__init__(self, con)
self._catalogs: dict[str, Catalog] = {}
self.supported = False
def pass_disco(self, info):
def pass_disco(self, info: DiscoInfo) -> None:
if Namespace.SECLABEL not in info.features:
return
......@@ -47,7 +52,7 @@ def pass_disco(self, info):
self._log.info('Discovered security labels: %s', info.jid)
@as_task
def request_catalog(self, jid: str):
def request_catalog(self, jid: str) -> Generator[Catalog, None, None]:
_task = yield
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment