Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
5bcabd48
by lovetox at 2021-10-10T15:44:31+02:00
3 changed files:
Changes:
| ... | ... | @@ -38,6 +38,7 @@ |
| 38 | 38 |
from collections import defaultdict
|
| 39 | 39 |
|
| 40 | 40 |
import nbxmpp
|
| 41 |
+from nbxmpp.idlequeue import IdleQueue
|
|
| 41 | 42 |
from gi.repository import Gdk
|
| 42 | 43 |
|
| 43 | 44 |
import gajim
|
| ... | ... | @@ -131,7 +132,7 @@ def __init__(self): |
| 131 | 132 |
ZEROCONF_ACC_NAME = 'Local'
|
| 132 | 133 |
|
| 133 | 134 |
# These will be set in app.gui_interface.
|
| 134 |
-idlequeue = None # type: nbxmpp.idlequeue.IdleQueue
|
|
| 135 |
+idlequeue = cast(IdleQueue, None)
|
|
| 135 | 136 |
socks5queue = None
|
| 136 | 137 |
|
| 137 | 138 |
gupnp_igd = None
|
| ... | ... | @@ -15,8 +15,9 @@ |
| 15 | 15 |
# XEP-0145: Annotations
|
| 16 | 16 |
|
| 17 | 17 |
from typing import Any
|
| 18 |
-from typing import Dict # pylint: disable=unused-import
|
|
| 18 |
+from typing import Dict
|
|
| 19 | 19 |
from typing import Tuple
|
| 20 |
+from typing import Optional
|
|
| 20 | 21 |
|
| 21 | 22 |
from nbxmpp.errors import StanzaError
|
| 22 | 23 |
from nbxmpp.errors import MalformedStanzaError
|
| ... | ... | @@ -37,7 +38,7 @@ class Annotations(BaseModule): |
| 37 | 38 |
def __init__(self, con: ConnectionT) -> None:
|
| 38 | 39 |
BaseModule.__init__(self, con)
|
| 39 | 40 |
|
| 40 |
- self._annotations = {} # type: Dict[str, AnnotationNote]
|
|
| 41 |
+ self._annotations: Dict[str, AnnotationNote] = {}
|
|
| 41 | 42 |
|
| 42 | 43 |
def request_annotations(self) -> None:
|
| 43 | 44 |
self._nbxmpp('Annotations').request_annotations(
|
| ... | ... | @@ -54,7 +55,7 @@ def _annotations_received(self, task: Any) -> None: |
| 54 | 55 |
for note in annotations:
|
| 55 | 56 |
self._annotations[note.jid] = note
|
| 56 | 57 |
|
| 57 |
- def get_note(self, jid: str) -> AnnotationNote:
|
|
| 58 |
+ def get_note(self, jid: str) -> Optional[AnnotationNote]:
|
|
| 58 | 59 |
return self._annotations.get(jid)
|
| 59 | 60 |
|
| 60 | 61 |
def set_note(self, note: AnnotationNote) -> None:
|
| ... | ... | @@ -12,9 +12,9 @@ |
| 12 | 12 |
# You should have received a copy of the GNU General Public License
|
| 13 | 13 |
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
| 14 | 14 |
|
| 15 |
-from typing import Any # pylint: disable=unused-import
|
|
| 16 |
-from typing import Dict # pylint: disable=unused-import
|
|
| 17 |
-from typing import List # pylint: disable=unused-import
|
|
| 15 |
+from typing import Any
|
|
| 16 |
+from typing import Dict
|
|
| 17 |
+from typing import List
|
|
| 18 | 18 |
|
| 19 | 19 |
import logging
|
| 20 | 20 |
from functools import partial
|
| ... | ... | @@ -38,9 +38,9 @@ def __init__(self, con, *args, plugin=False, **kwargs): |
| 38 | 38 |
self._con = con
|
| 39 | 39 |
self._account = con.name
|
| 40 | 40 |
self._log = self._set_logger(plugin)
|
| 41 |
- self._nbxmpp_callbacks = {} # type: Dict[str, Any]
|
|
| 41 |
+ self._nbxmpp_callbacks: Dict[str, Any] = {}
|
|
| 42 | 42 |
self._stored_publish = None # type: Callable
|
| 43 |
- self.handlers = [] # type: List[str]
|
|
| 43 |
+ self.handlers: List[StanzaHandler] = []
|
|
| 44 | 44 |
|
| 45 | 45 |
def _set_logger(self, plugin):
|
| 46 | 46 |
logger_name = 'gajim.c.m.%s'
|