From 3f6e14a01fc1c39a4309b970b040bfe7f92d2fd1 Mon Sep 17 00:00:00 2001 From: Imogen Date: Thu, 5 Oct 2023 13:29:50 +0200 Subject: [PATCH] add Ellipsis type annotation --- algobattle/battle.py | 13 +++++++------ tests/test_battles.py | 25 +++++++++++++------------ 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/algobattle/battle.py b/algobattle/battle.py index a167d06a..ab106a63 100644 --- a/algobattle/battle.py +++ b/algobattle/battle.py @@ -9,6 +9,7 @@ from abc import abstractmethod from inspect import isclass from itertools import count +from types import EllipsisType from typing import ( TYPE_CHECKING, Any, @@ -118,12 +119,12 @@ async def run( self, max_size: int, *, - timeout_generator: float | None = ..., - space_generator: int | None = ..., - cpus_generator: int = ..., - timeout_solver: float | None = ..., - space_solver: int | None = ..., - cpus_solver: int = ..., + timeout_generator: float | None | EllipsisType = ..., + space_generator: int | None | EllipsisType = ..., + cpus_generator: int | EllipsisType = ..., + timeout_solver: float | None | EllipsisType = ..., + space_solver: int | None | EllipsisType = ..., + cpus_solver: int | EllipsisType = ..., generator_battle_input: Encodable | None = None, solver_battle_input: Encodable | None = None, generator_battle_output: type[Encodable] | None = None, diff --git a/tests/test_battles.py b/tests/test_battles.py index 4cf68c61..fb74b6cc 100644 --- a/tests/test_battles.py +++ b/tests/test_battles.py @@ -1,6 +1,7 @@ """Tests for the Battle types.""" from enum import Enum from itertools import chain, cycle +from types import EllipsisType from typing import Iterable, TypeVar from unittest import IsolatedAsyncioTestCase, main @@ -51,12 +52,12 @@ async def run( self, max_size: int, *, - timeout_generator: float | None = ..., - space_generator: int | None = ..., - cpus_generator: int = ..., - timeout_solver: float | None = ..., - space_solver: int | None = ..., - cpus_solver: int = ..., + timeout_generator: float | None | EllipsisType = ..., + space_generator: int | None | EllipsisType = ..., + cpus_generator: int | EllipsisType = ..., + timeout_solver: float | None | EllipsisType = ..., + space_solver: int | None | EllipsisType = ..., + cpus_solver: int | EllipsisType = ..., generator_battle_input: Encodable | None = None, solver_battle_input: Encodable | None = None, generator_battle_output: type[Encodable] | None = None, @@ -95,12 +96,12 @@ async def run( self, max_size: int, *, - timeout_generator: float | None = ..., - space_generator: int | None = ..., - cpus_generator: int = ..., - timeout_solver: float | None = ..., - space_solver: int | None = ..., - cpus_solver: int = ..., + timeout_generator: float | None | EllipsisType = ..., + space_generator: int | None | EllipsisType = ..., + cpus_generator: int | EllipsisType = ..., + timeout_solver: float | None | EllipsisType = ..., + space_solver: int | None | EllipsisType = ..., + cpus_solver: int | EllipsisType = ..., generator_battle_input: Encodable | None = None, solver_battle_input: Encodable | None = None, generator_battle_output: type[Encodable] | None = None,