diff options
-rw-r--r-- | slack/slack_api.py | 6 | ||||
-rw-r--r-- | slack/slack_workspace.py | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/slack/slack_api.py b/slack/slack_api.py index 656227e..221bb59 100644 --- a/slack/slack_api.py +++ b/slack/slack_api.py @@ -1,7 +1,7 @@ from __future__ import annotations import json -from typing import TYPE_CHECKING, Dict, List, Union +from typing import TYPE_CHECKING, Dict, Iterable, Union from urllib.parse import urlencode from slack.http import http_request @@ -89,11 +89,11 @@ class SlackApi: async def fetch_user_info(self, user_id: str) -> SlackUserInfoResponse: return await self._fetch("users.info", {"user": user_id}) - async def fetch_users_info(self, user_ids: List[str]) -> SlackUsersInfoResponse: + async def fetch_users_info(self, user_ids: Iterable[str]) -> SlackUsersInfoResponse: return await self._fetch("users.info", {"users": ",".join(user_ids)}) async def fetch_bot_info(self, bot_id: str) -> SlackBotInfoResponse: return await self._fetch("bots.info", {"bot": bot_id}) - async def fetch_bots_info(self, bot_ids: List[str]) -> SlackBotsInfoResponse: + async def fetch_bots_info(self, bot_ids: Iterable[str]) -> SlackBotsInfoResponse: return await self._fetch("bots.info", {"bots": ",".join(bot_ids)}) diff --git a/slack/slack_workspace.py b/slack/slack_workspace.py index bf0f13f..d4c932a 100644 --- a/slack/slack_workspace.py +++ b/slack/slack_workspace.py @@ -4,7 +4,7 @@ import json import socket import ssl import time -from typing import TYPE_CHECKING, Any, Dict, List, Optional +from typing import TYPE_CHECKING, Any, Dict, Iterable, Optional import weechat from websocket import ABNF, WebSocketConnectionClosedException, create_connection @@ -31,7 +31,7 @@ class SlackUsers(Dict[str, Future[SlackUser]]): self[key] = create_task(self._create_item(key)) return self[key] - async def initialize_items(self, item_ids: List[str]): + async def initialize_items(self, item_ids: Iterable[str]): items_info_task = create_task(self._fetch_items_info(item_ids)) for item_id in set(item_ids): self[item_id] = create_task(self._create_item(item_id, items_info_task)) @@ -50,7 +50,7 @@ class SlackUsers(Dict[str, Future[SlackUser]]): await item.ensure_initialized() return item - async def _fetch_items_info(self, item_ids: List[str]): + async def _fetch_items_info(self, item_ids: Iterable[str]): response = await self.workspace.api.fetch_users_info(item_ids) if response["ok"] is False: # TODO: Handle error @@ -67,7 +67,7 @@ class SlackBots(Dict[str, Future[SlackBot]]): self[key] = create_task(self._create_item(key)) return self[key] - async def initialize_items(self, item_ids: List[str]): + async def initialize_items(self, item_ids: Iterable[str]): items_info_task = create_task(self._fetch_items_info(item_ids)) for item_id in set(item_ids): self[item_id] = create_task(self._create_item(item_id, items_info_task)) @@ -86,7 +86,7 @@ class SlackBots(Dict[str, Future[SlackBot]]): await item.ensure_initialized() return item - async def _fetch_items_info(self, item_ids: List[str]): + async def _fetch_items_info(self, item_ids: Iterable[str]): response = await self.workspace.api.fetch_bots_info(item_ids) if response["ok"] is False: # TODO: Handle error |