From 1638f40eccc4a1321ee1bf19e3756157b6c965e1 Mon Sep 17 00:00:00 2001 From: Botond Hende Date: Mon, 2 Sep 2024 00:21:13 +0200 Subject: refactored code, use get_ship dependency for ship related calls --- entities/task_types.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 entities/task_types.py (limited to 'entities/task_types.py') diff --git a/entities/task_types.py b/entities/task_types.py new file mode 100644 index 0000000..d23ce55 --- /dev/null +++ b/entities/task_types.py @@ -0,0 +1,21 @@ +from typing import Annotated +from pydantic.functional_validators import AfterValidator + +IDLE = 'IDLE' +MINING = 'MINING' + +MIA = 'MIA' +ERROR = 'ERROR' + +task_types = [ + IDLE, + MINING, +] + + +def is_task_type(task: str): + assert task in task_types, f"'{task}' is not a valid task type." + return task + + +task_type = Annotated[str, AfterValidator(is_task_type)] -- cgit v1.2.3-70-g09d2