1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# This file is part of Gajim.
#
# Gajim is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation; version 3 only.
#
# Gajim is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
# Types for typechecking
from typing import Any
from typing import TYPE_CHECKING
from typing import Union
import weakref
from collections.abc import Callable
import nbxmpp
from gi.repository import GdkPixbuf
from nbxmpp.const import PresenceShow
from nbxmpp.protocol import JID
from nbxmpp.structs import BookmarkData
from gajim.common.const import PresenceShowExt
if TYPE_CHECKING:
from nbxmpp.client import Client as xmppClient # noqa: F401
from gajim.common.client import Client
from gajim.common.modules.contacts import BareContact
from gajim.common.modules.contacts import CommonContact # noqa: F401
from gajim.common.modules.contacts import GroupchatContact
from gajim.common.modules.contacts import GroupchatParticipant
from gajim.common.modules.contacts import ResourceContact
from gajim.common.settings import Settings
from gajim.gui_interface import Interface
from gajim.plugins.pluginmanager import PluginManager
from gajim.plugins.repository import PluginRepository
from gajim.gtk.css_config import CSSConfig
ContactT = (BareContact |
ResourceContact |
GroupchatContact |
GroupchatParticipant)
InterfaceT = Union['Interface']
PluginManagerT = Union['PluginManager']
PluginRepositoryT = Union['PluginRepository']
ConnectionT = Union['Client']
CSSConfigT = Union['CSSConfig']
# PEP
PEPNotifyCallback = Callable[[nbxmpp.JID, nbxmpp.Node], None]
PEPHandlersDict = dict[str, list[PEPNotifyCallback]]
# Plugins
PluginExtensionPoints = dict[str, tuple[Callable[..., None] | None,
Callable[..., None] | None]]
SettingsT = Union['Settings']
BookmarksDict = dict[JID, BookmarkData]
GdkPixbufType = GdkPixbuf.Pixbuf | GdkPixbuf.PixbufAnimation
AnyCallableT = Callable[..., Any]
ObservableCbDict = dict[str, list[weakref.WeakMethod[AnyCallableT]]]
BareContactT = Union['BareContact']
ChatContactT = Union['BareContact', 'GroupchatContact', 'GroupchatParticipant']
OneOnOneContactT = Union['BareContact', 'GroupchatParticipant']
GroupchatContactT = Union['GroupchatContact']
PresenceShowT = PresenceShowExt | PresenceShow
|