summaryrefslogtreecommitdiff
path: root/poezio/bookmarks.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2018-07-22 14:23:39 +0200
committermathieui <mathieui@mathieui.net>2018-07-22 14:25:18 +0200
commite2414121af16474744d012cdb8466de6ae3136e4 (patch)
treee7d90b34da1d971e6e14cd8707837cab9200f0a3 /poezio/bookmarks.py
parent3cb8e33f938db6bb6e86dd349f8b56676b83556f (diff)
downloadpoezio-e2414121af16474744d012cdb8466de6ae3136e4.tar.gz
poezio-e2414121af16474744d012cdb8466de6ae3136e4.tar.bz2
poezio-e2414121af16474744d012cdb8466de6ae3136e4.tar.xz
poezio-e2414121af16474744d012cdb8466de6ae3136e4.zip
Add type hints here and there
Diffstat (limited to 'poezio/bookmarks.py')
-rw-r--r--poezio/bookmarks.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/poezio/bookmarks.py b/poezio/bookmarks.py
index 3e3893f4..91f862c8 100644
--- a/poezio/bookmarks.py
+++ b/poezio/bookmarks.py
@@ -30,9 +30,10 @@ Adding a remote bookmark:
import functools
import logging
+from typing import Optional, List
-from slixmpp.plugins.xep_0048 import Bookmarks, Conference, URL
from slixmpp import JID
+from slixmpp.plugins.xep_0048 import Bookmarks, Conference, URL
from poezio.common import safeJID
from poezio.config import config
@@ -41,11 +42,11 @@ log = logging.getLogger(__name__)
class Bookmark:
def __init__(self,
- jid,
- name=None,
+ jid: JID,
+ name: Optional[str] = None,
autojoin=False,
- nick=None,
- password=None,
+ nick: Optional[str] = None,
+ password: Optional[str] = None,
method='local'):
self.jid = jid
self.name = name or jid
@@ -55,21 +56,21 @@ class Bookmark:
self._method = method
@property
- def method(self):
+ def method(self) -> str:
return self._method
@method.setter
- def method(self, value):
+ def method(self, value: str):
if value not in ('local', 'remote'):
log.debug('Could not set bookmark storing method: %s', value)
return
self._method = value
- def __repr__(self):
+ def __repr__(self) -> str:
return '<%s%s|%s>' % (self.jid, ('/' + self.nick)
if self.nick else '', self.method)
- def stanza(self):
+ def stanza(self) -> Conference:
"""
Generate a <conference/> stanza from the instance
"""
@@ -83,7 +84,7 @@ class Bookmark:
el['password'] = self.password
return el
- def local(self):
+ def local(self) -> str:
"""Generate a str for local storage"""
local = self.jid
if self.nick: