Philipp Hörist pushed to branch master at gajim / gajim
Commits: 5bcabd48 by lovetox at 2021-10-10T15:44:31+02:00 Fix typing hints
- - - - -
3 changed files:
- gajim/common/app.py - gajim/common/modules/annotations.py - gajim/common/modules/base.py
Changes:
===================================== gajim/common/app.py ===================================== @@ -38,6 +38,7 @@ from collections import defaultdict
import nbxmpp +from nbxmpp.idlequeue import IdleQueue from gi.repository import Gdk
import gajim @@ -131,7 +132,7 @@ def __init__(self): ZEROCONF_ACC_NAME = 'Local'
# These will be set in app.gui_interface. -idlequeue = None # type: nbxmpp.idlequeue.IdleQueue +idlequeue = cast(IdleQueue, None) socks5queue = None
gupnp_igd = None
===================================== gajim/common/modules/annotations.py ===================================== @@ -15,8 +15,9 @@ # XEP-0145: Annotations
from typing import Any -from typing import Dict # pylint: disable=unused-import +from typing import Dict from typing import Tuple +from typing import Optional
from nbxmpp.errors import StanzaError from nbxmpp.errors import MalformedStanzaError @@ -37,7 +38,7 @@ class Annotations(BaseModule): def __init__(self, con: ConnectionT) -> None: BaseModule.__init__(self, con)
- self._annotations = {} # type: Dict[str, AnnotationNote] + self._annotations: Dict[str, AnnotationNote] = {}
def request_annotations(self) -> None: self._nbxmpp('Annotations').request_annotations( @@ -54,7 +55,7 @@ def _annotations_received(self, task: Any) -> None: for note in annotations: self._annotations[note.jid] = note
- def get_note(self, jid: str) -> AnnotationNote: + def get_note(self, jid: str) -> Optional[AnnotationNote]: return self._annotations.get(jid)
def set_note(self, note: AnnotationNote) -> None:
===================================== gajim/common/modules/base.py ===================================== @@ -12,9 +12,9 @@ # You should have received a copy of the GNU General Public License # along with Gajim. If not, see http://www.gnu.org/licenses/.
-from typing import Any # pylint: disable=unused-import -from typing import Dict # pylint: disable=unused-import -from typing import List # pylint: disable=unused-import +from typing import Any +from typing import Dict +from typing import List
import logging from functools import partial @@ -38,9 +38,9 @@ def __init__(self, con, *args, plugin=False, **kwargs): self._con = con self._account = con.name self._log = self._set_logger(plugin) - self._nbxmpp_callbacks = {} # type: Dict[str, Any] + self._nbxmpp_callbacks: Dict[str, Any] = {} self._stored_publish = None # type: Callable - self.handlers = [] # type: List[str] + self.handlers: List[StanzaHandler] = []
def _set_logger(self, plugin): logger_name = 'gajim.c.m.%s'
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/5bcabd4896b4c8f71cc9eaac3f4a82476...