diff options
author | Maxime Buquet <pep@bouah.net> | 2020-05-31 01:35:26 +0200 |
---|---|---|
committer | Maxime Buquet <pep@bouah.net> | 2020-05-31 01:35:26 +0200 |
commit | ce9d59f19e2a4b2150de66bee1159931158e8009 (patch) | |
tree | 7313bde4e1fa11db0f9f28927f694c696be5a64b /poezio/bookmarks.py | |
parent | ab9108e00a631d9b600d51999b9a9c765cf3f0d4 (diff) | |
parent | 21c45ff72e23b66c04d56a6ac5d832dd564baf65 (diff) | |
download | poezio-ce9d59f19e2a4b2150de66bee1159931158e8009.tar.gz poezio-ce9d59f19e2a4b2150de66bee1159931158e8009.tar.bz2 poezio-ce9d59f19e2a4b2150de66bee1159931158e8009.tar.xz poezio-ce9d59f19e2a4b2150de66bee1159931158e8009.zip |
Merge branch 'type-bookmarks' into 'master'
Type bookmarks
See merge request poezio/poezio!138
Diffstat (limited to 'poezio/bookmarks.py')
-rw-r--r-- | poezio/bookmarks.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/poezio/bookmarks.py b/poezio/bookmarks.py index d842d2dd..46f6dfab 100644 --- a/poezio/bookmarks.py +++ b/poezio/bookmarks.py @@ -30,7 +30,7 @@ Adding a remote bookmark: import functools import logging -from typing import Optional, List, Union +from typing import Optional, List, Literal, Union from slixmpp import InvalidJID, JID from slixmpp.plugins.xep_0048 import Bookmarks, Conference, URL @@ -39,6 +39,8 @@ from poezio.config import config log = logging.getLogger(__name__) +Method = Union[Literal['local'], Literal['remote']] + class Bookmark: def __init__(self, jid: Union[JID, str], @@ -46,7 +48,7 @@ class Bookmark: autojoin=False, nick: Optional[str] = None, password: Optional[str] = None, - method='local') -> None: + method: Method = 'local') -> None: try: if isinstance(jid, JID): self._jid = jid @@ -82,7 +84,7 @@ class Bookmark: return self._method @method.setter - def method(self, value: str): + def method(self, value: Method): if value not in ('local', 'remote'): log.debug('Could not set bookmark storing method: %s', value) return |