Skip to content

Commit 95a3c49

Browse files
committed
Replace durect usage of Future constructor
1 parent a28ffd0 commit 95a3c49

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

.github/workflows/pythonapp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- '3.8'
2020
- '3.9'
2121
- '3.10'
22-
runs-on: ubuntu-latest
22+
runs-on: ubuntu-22.04
2323
steps:
2424
- uses: actions/checkout@v3
2525
with:

cloudbot/__main__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import asyncio
12
import logging
23
import os
34
import signal
@@ -8,8 +9,7 @@
89
from cloudbot.bot import CloudBot
910
from cloudbot.util import async_util
1011

11-
12-
def main():
12+
async def async_main():
1313
# store the original working directory, for use when restarting
1414
original_wd = Path().resolve()
1515

@@ -84,5 +84,9 @@ def exit_gracefully(signum, frame):
8484
logging.shutdown()
8585

8686

87+
def main():
88+
asyncio.run(async_main())
89+
90+
8791
if __name__ == "__main__":
8892
main()

tests/util/mock_bot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import asyncio
21
import logging
32
from typing import Awaitable, Dict, Optional
43

@@ -7,6 +6,7 @@
76
from cloudbot.bot import CloudBot
87
from cloudbot.client import Client
98
from cloudbot.plugin import PluginManager
9+
from cloudbot.util.async_util import create_future
1010
from tests.util.mock_config import MockConfig
1111
from tests.util.mock_db import MockDB
1212

@@ -26,7 +26,7 @@ def __init__(
2626
self.data_path = self.base_dir / "data"
2727
self.data_dir = str(self.data_path)
2828
self.plugin_dir = self.base_dir / "plugins"
29-
self.stopped_future: Awaitable[bool] = asyncio.Future()
29+
self.stopped_future: Awaitable[bool] = create_future()
3030

3131
if db:
3232
self.db_engine = db.engine

0 commit comments

Comments
 (0)