mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Update mypy.
Needed so mypy can recognize the new Python 3.12 generic syntax.
This commit is contained in:
parent
2447cc156d
commit
6c4b8c81ee
@ -1,5 +1,5 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from asyncio import wait
|
from asyncio import wait, Future
|
||||||
|
|
||||||
from fastapi import APIRouter, WebSocket
|
from fastapi import APIRouter, WebSocket
|
||||||
from fastapi.encoders import jsonable_encoder
|
from fastapi.encoders import jsonable_encoder
|
||||||
@ -16,9 +16,9 @@ class ConnectionManager:
|
|||||||
self.active_connections: list[WebSocket] = []
|
self.active_connections: list[WebSocket] = []
|
||||||
|
|
||||||
async def shutdown(self) -> None:
|
async def shutdown(self) -> None:
|
||||||
futures = []
|
futures: list[Future[None]] = []
|
||||||
for connection in self.active_connections:
|
for connection in self.active_connections:
|
||||||
futures.append(connection.close())
|
futures.append(asyncio.create_task(connection.close()))
|
||||||
await wait(futures)
|
await wait(futures)
|
||||||
|
|
||||||
async def connect(self, websocket: WebSocket) -> None:
|
async def connect(self, websocket: WebSocket) -> None:
|
||||||
|
|||||||
@ -22,7 +22,7 @@ idna==3.6
|
|||||||
iniconfig==2.0.0
|
iniconfig==2.0.0
|
||||||
Jinja2==3.1.2
|
Jinja2==3.1.2
|
||||||
MarkupSafe==2.1.3
|
MarkupSafe==2.1.3
|
||||||
mypy==1.2.0
|
mypy==1.7.1
|
||||||
mypy-extensions==1.0.0
|
mypy-extensions==1.0.0
|
||||||
nodeenv==1.8.0
|
nodeenv==1.8.0
|
||||||
numpy==1.26.2
|
numpy==1.26.2
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from faker import Faker
|
from faker import Faker
|
||||||
|
|
||||||
from game.squadrons.pilot import Pilot, PilotStatus
|
from game.squadrons.pilot import Pilot, PilotStatus
|
||||||
|
|
||||||
|
|
||||||
@ -29,7 +29,8 @@ def test_pilot_on_leave(pilot: Pilot) -> None:
|
|||||||
assert pilot.on_leave == True
|
assert pilot.on_leave == True
|
||||||
pilot.return_from_leave()
|
pilot.return_from_leave()
|
||||||
assert pilot.status == PilotStatus.Active
|
assert pilot.status == PilotStatus.Active
|
||||||
assert pilot.on_leave == False
|
# mypy thinks this line is unreachable. It isn't.
|
||||||
|
assert pilot.on_leave == False # type: ignore
|
||||||
|
|
||||||
|
|
||||||
def test_pilot_on_leave_twice(pilot: Pilot) -> None:
|
def test_pilot_on_leave_twice(pilot: Pilot) -> None:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user