added FIXED_CHANNELS constant
This commit is contained in:
@ -4,6 +4,12 @@ from .bsvar import BSVar
|
|||||||
from .prodthread import ProdThread
|
from .prodthread import ProdThread
|
||||||
|
|
||||||
|
|
||||||
|
FIXED_CHANNELS = {
|
||||||
|
"pid",
|
||||||
|
"toc"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class BSCache:
|
class BSCache:
|
||||||
|
|
||||||
def __init__(self, timeout=1000, maxsize=100):
|
def __init__(self, timeout=1000, maxsize=100):
|
||||||
@ -51,7 +57,7 @@ class BSCache:
|
|||||||
|
|
||||||
new_chans = {}
|
new_chans = {}
|
||||||
for name, kwargs in names.items():
|
for name, kwargs in names.items():
|
||||||
if name not in ["pid", "toc"] and name not in self.channels:
|
if name not in FIXED_CHANNELS and name not in self.channels:
|
||||||
if not is_available(name):
|
if not is_available(name):
|
||||||
raise ValueError(f"channel {name} is not available")
|
raise ValueError(f"channel {name} is not available")
|
||||||
cfg = make_channel_config(name, *kwargs)
|
cfg = make_channel_config(name, *kwargs)
|
||||||
@ -72,13 +78,13 @@ class BSCache:
|
|||||||
next(self)
|
next(self)
|
||||||
|
|
||||||
while not chans.keys() <= self.data.keys():
|
while not chans.keys() <= self.data.keys():
|
||||||
missing = self.data.keys() - chans.keys() - {"pid", "toc"}
|
missing = self.data.keys() - chans.keys() - FIXED_CHANNELS
|
||||||
print("dropping data that is missing new channel(s)", sorted(missing))
|
print("dropping data that is missing new channel(s)", sorted(missing))
|
||||||
next(self)
|
next(self)
|
||||||
|
|
||||||
|
|
||||||
def get_var(self, name, modulo=None, offset=None):
|
def get_var(self, name, modulo=None, offset=None):
|
||||||
if name not in ["pid", "toc"] and name not in self.channels:
|
if name not in FIXED_CHANNELS and name not in self.channels:
|
||||||
if not is_available(name):
|
if not is_available(name):
|
||||||
raise ValueError(f"channel {name} is not available")
|
raise ValueError(f"channel {name} is not available")
|
||||||
cfg = make_channel_config(name, modulo, offset)
|
cfg = make_channel_config(name, modulo, offset)
|
||||||
|
Reference in New Issue
Block a user