aboutsummaryrefslogtreecommitdiffstats
path: root/slack
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2022-10-24 21:48:24 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:52 +0100
commitfed1898bb75f2c3f0297cf7228c9d86adef57b78 (patch)
treee89f562226c038bacb1aa33a8a3a3026dcd328af /slack
parent4b004a356aec12eb59fb4c5a208c21d3817ef9d7 (diff)
downloadwee-slack-fed1898bb75f2c3f0297cf7228c9d86adef57b78.tar.gz
Move main file out of directory
Diffstat (limited to 'slack')
-rw-r--r--slack/__init__.py0
-rw-r--r--slack/api.py4
-rw-r--r--slack/config.py9
-rw-r--r--slack/globals.py6
-rw-r--r--slack/log.py3
-rw-r--r--slack/main.py16
-rw-r--r--slack/task.py5
-rw-r--r--slack/util.py2
-rw-r--r--slack/weechat_http.py8
9 files changed, 25 insertions, 28 deletions
diff --git a/slack/__init__.py b/slack/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/slack/__init__.py
diff --git a/slack/api.py b/slack/api.py
index 47d3156..1ef7907 100644
--- a/slack/api.py
+++ b/slack/api.py
@@ -4,8 +4,8 @@ import json
from typing import TYPE_CHECKING, Any, Dict, Union
from urllib.parse import urlencode
-import globals as G
-from weechat_http import http_request
+from . import globals as G
+from .weechat_http import http_request
if TYPE_CHECKING:
from slack_api import SlackConversation, SlackConversationIm, SlackConversationNotIm
diff --git a/slack/config.py b/slack/config.py
index a2ab654..65dd929 100644
--- a/slack/config.py
+++ b/slack/config.py
@@ -3,11 +3,12 @@ from __future__ import annotations
from dataclasses import dataclass
from typing import Generic, TypeVar, Union, cast
-import globals as G
import weechat
-from api import SlackWorkspace
-from log import print_error
-from util import get_callback_name
+
+from . import globals as G
+from .api import SlackWorkspace
+from .log import print_error
+from .util import get_callback_name
class WeeChatColor(str):
diff --git a/slack/globals.py b/slack/globals.py
index 8cdd9a3..73001dd 100644
--- a/slack/globals.py
+++ b/slack/globals.py
@@ -1,8 +1,8 @@
from typing import Any, Dict, Tuple
-from api import SlackWorkspace
-from config import SlackConfig
-from task import Task
+from .api import SlackWorkspace
+from .config import SlackConfig
+from .task import Task
SCRIPT_NAME = "slack"
SCRIPT_AUTHOR = "Trygve Aaberge <trygveaa@gmail.com>"
diff --git a/slack/log.py b/slack/log.py
index d7b6843..21b6434 100644
--- a/slack/log.py
+++ b/slack/log.py
@@ -1,8 +1,9 @@
from enum import IntEnum
-import globals as G
import weechat
+from . import globals as G
+
class LogLevel(IntEnum):
TRACE = 1
diff --git a/slack/main.py b/slack/main.py
index 5ab431c..3a4c652 100644
--- a/slack/main.py
+++ b/slack/main.py
@@ -1,17 +1,11 @@
from __future__ import annotations
-import os
-import sys
-
import weechat
-sys.path.append(os.path.dirname(os.path.realpath(__file__)))
-import globals as G # pylint: disable=wrong-import-position
-from config import SlackConfig, SlackWorkspace # pylint: disable=wrong-import-position
-from task import create_task # pylint: disable=wrong-import-position
-from util import get_callback_name # pylint: disable=wrong-import-position
-
-G.weechat_callbacks = globals()
+from . import globals as G
+from .config import SlackConfig, SlackWorkspace
+from .task import create_task
+from .util import get_callback_name
def shutdown_cb():
@@ -35,7 +29,7 @@ async def init():
print(G.config.color.reaction_suffix.value)
-if __name__ == "__main__":
+def main():
if weechat.register(
G.SCRIPT_NAME,
G.SCRIPT_AUTHOR,
diff --git a/slack/task.py b/slack/task.py
index c6c72f6..db914fb 100644
--- a/slack/task.py
+++ b/slack/task.py
@@ -3,9 +3,10 @@ from __future__ import annotations
from typing import Any, Awaitable, Coroutine, Generator, Tuple, TypeVar
from uuid import uuid4
-import globals as G
import weechat
-from util import get_callback_name
+
+from . import globals as G
+from .util import get_callback_name
T = TypeVar("T")
diff --git a/slack/util.py b/slack/util.py
index 10d4ce9..acbe5cf 100644
--- a/slack/util.py
+++ b/slack/util.py
@@ -1,6 +1,6 @@
from typing import Any, Callable
-import globals as G
+from . import globals as G
def get_callback_name(callback: Callable[..., Any]) -> str:
diff --git a/slack/weechat_http.py b/slack/weechat_http.py
index 61e6c38..ba30339 100644
--- a/slack/weechat_http.py
+++ b/slack/weechat_http.py
@@ -5,11 +5,11 @@ import resource
from io import StringIO
from typing import Dict
-import globals as G
import weechat
-from log import LogLevel, log
-from task import FutureProcess, sleep, weechat_task_cb
-from util import get_callback_name
+
+from .log import LogLevel, log
+from .task import FutureProcess, sleep, weechat_task_cb
+from .util import get_callback_name
class HttpError(Exception):