Skip to content

Commit 55b3125

Browse files
committed
fixes regression in apply()
patch bump
1 parent 7b33400 commit 55b3125

3 files changed

Lines changed: 11 additions & 17 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "vban-cmd"
3-
version = "2.9.1"
3+
version = "2.9.2"
44
description = "Python interface for the VBAN RT Packet Service (Sendtext)"
55
authors = [{ name = "Onyx and Iris", email = "code@onyxandiris.online" }]
66
license = { text = "MIT" }

vban_cmd/iremote.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import abc
22
import logging
3-
import time
43
from dataclasses import dataclass
54

65
logger = logging.getLogger(__name__)
@@ -123,6 +122,8 @@ def public_packets(self):
123122
def apply(self, data):
124123
"""Sets all parameters of a dict for the channel."""
125124

125+
script = ''
126+
126127
def fget(attr, val):
127128
if attr == 'mode':
128129
return (f'mode.{val}', 1)
@@ -138,14 +139,9 @@ def fget(attr, val):
138139
val = 1 if val else 0
139140

140141
self._remote.cache[self._cmd(attr)] = val
141-
self._remote._script += f'{self._cmd(attr)}={val};'
142+
script += f'{self._cmd(attr)}={val};'
142143
else:
143144
target = getattr(self, attr)
144145
target.apply(val)
145146

146-
self._remote.sendtext(self._remote._script)
147-
return self
148-
149-
def then_wait(self):
150-
self._remote._script = str()
151-
time.sleep(self._remote.DELAY)
147+
self._remote.sendtext(script)

vban_cmd/vbancmd.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import time
66
from pathlib import Path
77
from queue import Queue
8-
from typing import Union
8+
from typing import Mapping, Union
99

1010
from .enums import NBS
1111
from .error import VBANCMDConnectionError, VBANCMDError
@@ -289,12 +289,8 @@ def clear_dirty(self) -> None:
289289
while self.pdirty:
290290
time.sleep(self.DELAY)
291291

292-
def apply(self, data: dict):
293-
"""
294-
Sets all parameters of a dict
295-
296-
minor delay between each recursion
297-
"""
292+
def apply(self, data: Mapping):
293+
"""Set all parameters of a dict"""
298294

299295
def target(key):
300296
match key.split('-'):
@@ -314,7 +310,9 @@ def target(key):
314310
raise ValueError(ERR_MSG)
315311
return target[int(index)]
316312

317-
[target(key).apply(di).then_wait() for key, di in data.items()]
313+
for key, di in data.items():
314+
target(key).apply(di)
315+
time.sleep(self.DELAY)
318316

319317
def apply_config(self, name):
320318
"""applies a config from memory"""

0 commit comments

Comments
 (0)