File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11[project ]
22name = " vban-cmd"
3- version = " 2.9.1 "
3+ version = " 2.9.2 "
44description = " Python interface for the VBAN RT Packet Service (Sendtext)"
55authors = [{ name = " Onyx and Iris" , email = " code@onyxandiris.online" }]
66license = { text = " MIT" }
Original file line number Diff line number Diff line change 11import abc
22import logging
3- import time
43from dataclasses import dataclass
54
65logger = 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 )
Original file line number Diff line number Diff line change 55import time
66from pathlib import Path
77from queue import Queue
8- from typing import Union
8+ from typing import Mapping , Union
99
1010from .enums import NBS
1111from .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"""
You can’t perform that action at this time.
0 commit comments