diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2020-12-12 18:44:37 +0100 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2020-12-12 19:36:18 +0100 |
commit | 65b8046fe08a19df937068e5fe5ad15f9b0a785a (patch) | |
tree | 827e17a99d39c5db453d0fc0e9b46249292aa4e3 /poezio/plugin_e2ee.py | |
parent | 34ec9e3ee1384506b2e803bdfe94201a7b7ff4c3 (diff) | |
download | poezio-65b8046fe08a19df937068e5fe5ad15f9b0a785a.tar.gz poezio-65b8046fe08a19df937068e5fe5ad15f9b0a785a.tar.bz2 poezio-65b8046fe08a19df937068e5fe5ad15f9b0a785a.tar.xz poezio-65b8046fe08a19df937068e5fe5ad15f9b0a785a.zip |
from __future__ import annotations
Now that our baseline is Python 3.7, we can rely on type annotations to
be lazily evaluated.
Diffstat (limited to 'poezio/plugin_e2ee.py')
-rw-r--r-- | poezio/plugin_e2ee.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/poezio/plugin_e2ee.py b/poezio/plugin_e2ee.py index 9d1d4903..a0856957 100644 --- a/poezio/plugin_e2ee.py +++ b/poezio/plugin_e2ee.py @@ -97,30 +97,30 @@ class E2EEPlugin(BasePlugin): #: Encryption name, used in command descriptions, and logs. At least one #: of `encryption_name` and `encryption_short_name` must be set. - encryption_name = None # type: Optional[str] + encryption_name: Optional[str] = None #: Encryption short name, used as command name, and also to display #: encryption status in a tab. At least one of `encryption_name` and #: `encryption_short_name` must be set. - encryption_short_name = None # type: Optional[str] + encryption_short_name: Optional[str] = None #: Required. https://xmpp.org/extensions/xep-0380.html. - eme_ns = None # type: Optional[str] + eme_ns: Optional[str] = None #: Used to figure out what messages to attempt decryption for. Also used #: in combination with `tag_whitelist` to avoid removing encrypted tags #: before sending. - encrypted_tags = None # type: Optional[List[Tuple[str, str]]] + encrypted_tags: Optional[List[Tuple[str, str]]] = None # Static map, to be able to limit to one encryption mechanism per tab at a # time - _enabled_tabs = {} # type: Dict[JID, Callable] + _enabled_tabs: Dict[JID, Callable] = {} # Tabs that support this encryption mechanism - supported_tab_types = tuple() # type: Tuple[ChatTabs] + supported_tab_types: Tuple[ChatTabs] = tuple() # States for each remote entity - trust_states = {'accepted': set(), 'rejected': set()} # type: Dict[str, Set[str]] + trust_states: Dict[str, Set[str]] = {'accepted': set(), 'rejected': set()} def init(self): self._all_trust_states = self.trust_states['accepted'].union( @@ -229,7 +229,7 @@ class E2EEPlugin(BasePlugin): return "" def _toggle_tab(self, _input: str) -> None: - jid = self.api.current_tab().jid # type: JID + jid: JID = self.api.current_tab().jid if self._encryption_enabled(jid): del self._enabled_tabs[jid] @@ -394,7 +394,7 @@ class E2EEPlugin(BasePlugin): # Find who to encrypt to. If in a groupchat this can be multiple JIDs. # It is possible that we are not able to find a jid (e.g., semi-anon # MUCs). Let the plugin decide what to do with this information. - jids = [message['to']] # type: Optional[List[JID]] + jids: Optional[List[JID]] = [message['to']] tab = self.core.tabs.by_jid(message['to']) if tab is None: # When does that ever happen? log.debug('Attempting to encrypt a message to \'%s\' ' |