freeze dataclasses

import kinds as namespace
This commit is contained in:
Onyx and Iris 2025-01-15 12:08:14 +00:00
parent 01633f06da
commit a6f52be9ac
7 changed files with 22 additions and 22 deletions

View File

@ -4,8 +4,8 @@ from enum import IntEnum
from math import log
from typing import Union
from . import kinds
from .iremote import IRemote
from .kinds import kinds_all
from .meta import bus_mode_prop, device_prop, float_prop
BusModes = IntEnum(
@ -248,7 +248,7 @@ def make_bus_level_map(kind):
return tuple((i, i + 8) for i in range(0, (kind.phys_out + kind.virt_out) * 8, 8))
_make_bus_level_maps = {kind.name: make_bus_level_map(kind) for kind in kinds_all}
_make_bus_level_maps = {kind.name: make_bus_level_map(kind) for kind in kinds.all}
def _make_bus_mode_mixin():

View File

@ -22,7 +22,7 @@ class SingletonType(type):
return cls._instances[cls]
@dataclass
@dataclass(frozen=True)
class KindMapClass(metaclass=SingletonType):
name: str
ins: tuple
@ -68,9 +68,8 @@ class KindMapClass(metaclass=SingletonType):
return self.name.capitalize()
@dataclass
@dataclass(frozen=True)
class BasicMap(KindMapClass):
name: str
ins: tuple = (2, 1)
outs: tuple = (1, 1)
vban: tuple = (4, 4, 1, 1)
@ -79,9 +78,8 @@ class BasicMap(KindMapClass):
composite: int = 0
@dataclass
@dataclass(frozen=True)
class BananaMap(KindMapClass):
name: str
ins: tuple = (3, 2)
outs: tuple = (3, 2)
vban: tuple = (8, 8, 1, 1)
@ -90,9 +88,8 @@ class BananaMap(KindMapClass):
composite: int = 8
@dataclass
@dataclass(frozen=True)
class PotatoMap(KindMapClass):
name: str
ins: tuple = (5, 3)
outs: tuple = (5, 3)
vban: tuple = (8, 8, 1, 1)
@ -123,4 +120,4 @@ def request_kind_map(kind_id):
return KIND_obj
kinds_all = list(request_kind_map(kind_id.name.lower()) for kind_id in KindId)
all = kinds_all = [request_kind_map(kind_id.name.lower()) for kind_id in KindId]

View File

@ -1,7 +1,7 @@
from typing import Optional
from . import kinds
from .iremote import IRemote
from .kinds import kinds_all
class FX(IRemote):
@ -133,7 +133,7 @@ def _make_asio_mixin(remote, kind):
def _make_asio_mixins(remote):
return {kind.name: _make_asio_mixin(remote, kind) for kind in kinds_all}
return {kind.name: _make_asio_mixin(remote, kind) for kind in kinds.all}
class Composite(IRemote):

View File

@ -1,8 +1,8 @@
import re
from . import kinds
from .error import VMError
from .iremote import IRemote
from .kinds import kinds_all
from .meta import action_fn, bool_prop
@ -222,7 +222,7 @@ def _make_armchannel_mixin(remote, kind):
def _make_armchannel_mixins(remote):
return {kind.name: _make_armchannel_mixin(remote, kind) for kind in kinds_all}
return {kind.name: _make_armchannel_mixin(remote, kind) for kind in kinds.all}
def _make_channelout_mixin(kind):
@ -238,5 +238,5 @@ def _make_channelout_mixin(kind):
_make_channelout_mixins = {
kind.name: _make_channelout_mixin(kind) for kind in kinds_all
kind.name: _make_channelout_mixin(kind) for kind in kinds.all
}

View File

@ -288,7 +288,10 @@ class Remote(CBindings):
target = getattr(self, kls)
case [
"vban",
"in" | "instream" | "out" | "outstream" as direction,
"in"
| "instream"
| "out"
| "outstream" as direction,
index,
] if index.isnumeric():
target = getattr(

View File

@ -3,8 +3,8 @@ from abc import abstractmethod
from math import log
from typing import Union
from . import kinds
from .iremote import IRemote
from .kinds import kinds_all
from .meta import bool_prop, device_prop, float_prop
@ -467,7 +467,7 @@ def make_strip_level_map(kind):
return phys_map + virt_map
_make_strip_level_maps = {kind.name: make_strip_level_map(kind) for kind in kinds_all}
_make_strip_level_maps = {kind.name: make_strip_level_map(kind) for kind in kinds.all}
class GainLayer(IRemote):
@ -514,7 +514,7 @@ def _make_channelout_mixin(kind):
_make_channelout_mixins = {
kind.name: _make_channelout_mixin(kind) for kind in kinds_all
kind.name: _make_channelout_mixin(kind) for kind in kinds.all
}
@ -569,7 +569,7 @@ def _make_effects_mixin(kind, is_phys):
def _make_effects_mixins(is_phys):
return {kind.name: _make_effects_mixin(kind, is_phys) for kind in kinds_all}
return {kind.name: _make_effects_mixin(kind, is_phys) for kind in kinds.all}
def strip_factory(is_phys_strip, remote, i) -> Union[PhysicalStrip, VirtualStrip]:

View File

@ -1,7 +1,7 @@
from abc import abstractmethod
from . import kinds
from .iremote import IRemote
from .kinds import kinds_all
class VbanStream(IRemote):
@ -194,7 +194,7 @@ def _make_stream_pair(remote, kind):
def _make_stream_pairs(remote):
return {kind.name: _make_stream_pair(remote, kind) for kind in kinds_all}
return {kind.name: _make_stream_pair(remote, kind) for kind in kinds.all}
class Vban: