From 7ede9b1ef3e47a33efac18e9d4eaf89fffb3eff4 Mon Sep 17 00:00:00 2001 From: Onyx and Iris Date: Wed, 15 Jan 2025 10:21:22 +0000 Subject: [PATCH] freeze dataclasses --- xair_api/kinds.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/xair_api/kinds.py b/xair_api/kinds.py index dc00991..2bb693d 100644 --- a/xair_api/kinds.py +++ b/xair_api/kinds.py @@ -1,15 +1,16 @@ from dataclasses import dataclass -@dataclass +@dataclass(frozen=True) class KindMap: + id_: str + def __str__(self) -> str: return self.id_ -@dataclass +@dataclass(frozen=True) class X32KindMap(KindMap): - id_: str num_dca: int = 8 num_strip: int = 32 num_bus: int = 16 @@ -19,28 +20,25 @@ class X32KindMap(KindMap): num_headamp: int = 127 -@dataclass +@dataclass(frozen=True) class XR18KindMap(KindMap): # note ch 17-18 defined as aux return - id_: str num_dca: int = 4 num_strip: int = 16 num_bus: int = 6 num_fx: int = 4 -@dataclass +@dataclass(frozen=True) class XR16KindMap(KindMap): - id_: str num_dca: int = 4 num_strip: int = 16 num_bus: int = 4 num_fx: int = 4 -@dataclass +@dataclass(frozen=True) class XR12KindMap(KindMap): - id_: str num_dca: int = 4 num_strip: int = 12 num_bus: int = 2 @@ -60,4 +58,4 @@ def get(kind_id): return _kinds[kind_id] -all = list(kind for kind in _kinds.values()) +all = list(_kinds.values())