from slic.utils.eco_components.config import initFromConfigList from epics import PV from slic.utils.eco_components import ecocnf from slic.utils.eco_components.aliases import NamespaceCollection import logging from devices import components, config import sys _namespace = globals() _mod = sys.modules[__name__] _scope_name = "bernina" alias_namespaces = NamespaceCollection() def init(*args,lazy=None): if args: allnames = [tc['name'] for tc in components] comp_toinit = [] for arg in args: if not arg in allnames: raise Exception(f'The component {arg} has no configuration defined!') else: comp_toinit.append(components[allnames.index(arg)]) else: comp_toinit = components if lazy is None: lazy=ecocnf.startup_lazy op = {} for key, value in initFromConfigList(comp_toinit, components, lazy=lazy).items(): # _namespace[key] = value _mod.__dict__[key] = value op[key]= value if not ecocnf.startup_lazy: try: for ta in value.alias.get_all(): alias_namespaces.bernina.update( ta["alias"], ta["channel"], ta["channeltype"] ) except: pass # alias_namespaces.bernina.store() return op init()