diff options
author | mathieui <mathieui@mathieui.net> | 2021-07-02 20:59:25 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2021-07-02 20:59:25 +0200 |
commit | 2b3cde233fec354bf1b1894e926d67ec9ce371b8 (patch) | |
tree | 89b28567bd65a4d71715ea29096855b4b8e5ea80 /poezio/core/tabs.py | |
parent | 26505c32df055bfe41c3a852fff1b1eaf5dafda7 (diff) | |
download | poezio-2b3cde233fec354bf1b1894e926d67ec9ce371b8.tar.gz poezio-2b3cde233fec354bf1b1894e926d67ec9ce371b8.tar.bz2 poezio-2b3cde233fec354bf1b1894e926d67ec9ce371b8.tar.xz poezio-2b3cde233fec354bf1b1894e926d67ec9ce371b8.zip |
fix: improve typing
preliminary to more typing added to slixmpp, fix things in advance
Diffstat (limited to 'poezio/core/tabs.py')
-rw-r--r-- | poezio/core/tabs.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/poezio/core/tabs.py b/poezio/core/tabs.py index 1e0a035d..6d0589ba 100644 --- a/poezio/core/tabs.py +++ b/poezio/core/tabs.py @@ -171,12 +171,17 @@ class Tabs: return any_matched, candidate - def by_name_and_class(self, name: str, + def by_name_and_class(self, name: Union[str, JID], cls: Type[T]) -> Optional[T]: """Get a tab with its name and class""" + if isinstance(name, JID): + str_name = name.full + else: + str_name = name + str cls_tabs = self._tab_types.get(cls, []) for tab in cls_tabs: - if tab.name == name: + if tab.name == str_name: return cast(T, tab) return None |