aboutsummaryrefslogtreecommitdiffstats
path: root/slack/shared.py
blob: 600723be0e0d0bda00290e1ba9c05db6ce12f08d (plain) (blame)
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
from __future__ import annotations

from collections import defaultdict
from typing import TYPE_CHECKING, Callable, Dict, List, Union

if TYPE_CHECKING:
    from slack.config import SlackConfig
    from slack.error import UncaughtError
    from slack.slack_emoji import Emoji
    from slack.slack_workspace import SlackWorkspace
    from slack.task import Future, Task

WeechatCallbackReturnType = Union[int, str, Dict[str, str], None]


class Shared:
    def __init__(self):
        self.SCRIPT_NAME = "slack"
        self.SCRIPT_VERSION = "3.0.0"

        self.weechat_version: int
        self.weechat_callbacks: Dict[str, Callable[..., WeechatCallbackReturnType]]
        self.active_tasks: Dict[str, List[Task[object]]] = defaultdict(list)
        self.active_futures: Dict[str, Future[object]] = {}
        self.workspaces: Dict[str, SlackWorkspace] = {}
        self.config: SlackConfig
        self.uncaught_errors: List[UncaughtError] = []
        self.standard_emojis: Dict[str, Emoji]


shared = Shared()