|
35 | 35 | "from .async_base_client import AsyncBaseClient, AsyncSlackResponse", |
36 | 36 | async_source, |
37 | 37 | ) |
38 | | - # from slack_sdk import WebClient |
39 | 38 | async_source = re.sub( |
40 | 39 | r"class WebClient\(BaseClient\):", |
41 | 40 | "class AsyncWebClient(AsyncBaseClient):", |
|
122 | 121 | legacy_source = re.sub(r"= WebClient\(", "= LegacyWebClient(", legacy_source) |
123 | 122 | with open(f"{args.path}/slack_sdk/web/legacy_client.py", "w") as output: |
124 | 123 | output.write(legacy_source) |
| 124 | + |
| 125 | +with open(f"{args.path}/slack_sdk/web/chat_stream.py", "r") as original: |
| 126 | + source = original.read() |
| 127 | + import re |
| 128 | + |
| 129 | + async_source = header + source |
| 130 | + async_source = re.sub( |
| 131 | + "from slack_sdk.web.slack_response import SlackResponse", |
| 132 | + "from slack_sdk.web.async_slack_response import AsyncSlackResponse", |
| 133 | + async_source, |
| 134 | + ) |
| 135 | + async_source = re.sub( |
| 136 | + r"from slack_sdk import WebClient", |
| 137 | + "from slack_sdk.web.async_client import AsyncWebClient", |
| 138 | + async_source, |
| 139 | + ) |
| 140 | + async_source = re.sub("class ChatStream", "class AsyncChatStream", async_source) |
| 141 | + async_source = re.sub('"WebClient"', '"AsyncWebClient"', async_source) |
| 142 | + async_source = re.sub(r"Optional\[SlackResponse\]", "Optional[AsyncSlackResponse]", async_source) |
| 143 | + async_source = re.sub(r"SlackResponse ", "AsyncSlackResponse ", async_source) |
| 144 | + async_source = re.sub(r"SlackResponse:", "AsyncSlackResponse:", async_source) |
| 145 | + async_source = re.sub(r"def append\(", "async def append(", async_source) |
| 146 | + async_source = re.sub(r"def stop\(", "async def stop(", async_source) |
| 147 | + async_source = re.sub(r"def _flush_buffer\(", "async def _flush_buffer(", async_source) |
| 148 | + async_source = re.sub("self._client.chat_", "await self._client.chat_", async_source) |
| 149 | + async_source = re.sub("self._flush_buffer", "await self._flush_buffer", async_source) |
| 150 | + with open(f"{args.path}/slack_sdk/web/async_chat_stream.py", "w") as output: |
| 151 | + output.write(async_source) |
0 commit comments