# Path: basil/dut.py
# class Base(object):
#     def __init__(self, conf):
#         self.name = None
#         self.version = None
#         self.conf_path = None
#         self.parent = None
#         self._init = {}
#         self._conf = self._open_conf(conf)
#         if 'name' in self._conf:
#             self.name = self._conf['name']
#         if 'version' in self._conf:
#             self.version = self._conf['version']
#         if 'conf_path' in self._conf:
#             self.conf_path = self._conf['conf_path']
#         if 'parent' in self._conf:
#             self.parent = self._conf['parent']
#         if 'init' in self._conf:
#             self._update_init(self._conf['init'])
# 
#     def _open_conf(self, conf):
#         def isFile(f):
#             return hasattr(f, 'read')
# 
#         conf_dict = {}
#         if not conf:
#             pass
#         elif isinstance(conf, string_types):  # parse the first YAML document in a stream
#             if os.path.isfile(conf):
#                 with open(conf, 'r') as f:
#                     conf_dict.update(safe_load(f))
#                     conf_dict.update(conf_path=f.name)
#             else:  # YAML string
#                 try:
#                     conf_dict.update(safe_load(conf))
#                 except ValueError:  # invalid path/filename
#                     raise IOError("File not found: %s" % conf)
#         elif isFile(conf):  # parse the first YAML document in a stream
#             conf_dict.update(safe_load(conf))
#             conf_dict.update(conf_path=conf.name)
#         else:  # conf is already a dict
#             conf_dict.update(conf)
#         return conf_dict
# 
#     def _update_init(self, init_conf=None, **kwargs):
#         init_conf = self._open_conf(init_conf)
#         if init_conf:
#             self._init.update(init_conf)
#         self._init.update(kwargs)
# 
#     def init(self):
#         self._initialized = True
# 
#     @property
#     def is_initialized(self):
#         if "_initialized" in self.__dict__ and self._initialized:
#             return True
#         else:
#             return False
# 
#     def close(self):
#         self._initialized = False
# 
#     def set_configuration(self, conf):
#         raise NotImplementedError("set_configuration() not implemented")
# 
#     def get_configuration(self):
#         raise NotImplementedError("get_configuration() not implemented")


    from collections.abc import Callable  # noqa
    from collections import Callable  # noqa
from basil.dut import Base
#
# ------------------------------------------------------------
# Copyright (c) All rights reserved
# SiLab, Institute of Physics, University of Bonn
# ------------------------------------------------------------
#

try:
except ImportError:



class RegisterLayer(Base):
    def __init__(self, driver, conf):
        super(RegisterLayer, self).__init__(conf)
        self._drv = driver

    def init(self):
        super(RegisterLayer, self).init()

    def __getattr__(self, name):
        if not self.is_initialized:  # this test allows attributes to be set in the __init__ method
            raise AttributeError("'%s' has no attribute '%s'" % (self.__class__.__name__, name))
        else:
            attr = getattr(self._drv, name)
            # for compatibility with RegisterHardwareLayer:
            # prevent wrting to a register twice
            if not isinstance(attr, Callable):

# Path: basil/dut.py
# class Base(object):
#     def __init__(self, conf):
#         self.name = None
#         self.version = None
#         self.conf_path = None
#         self.parent = None
#         self._init = {}
#         self._conf = self._open_conf(conf)
#         if 'name' in self._conf:
#             self.name = self._conf['name']
#         if 'version' in self._conf:
#             self.version = self._conf['version']
#         if 'conf_path' in self._conf:
#             self.conf_path = self._conf['conf_path']
#         if 'parent' in self._conf:
#             self.parent = self._conf['parent']
#         if 'init' in self._conf:
#             self._update_init(self._conf['init'])
# 
#     def _open_conf(self, conf):
#         def isFile(f):
#             return hasattr(f, 'read')
# 
#         conf_dict = {}
#         if not conf:
#             pass
#         elif isinstance(conf, string_types):  # parse the first YAML document in a stream
#             if os.path.isfile(conf):
#                 with open(conf, 'r') as f:
#                     conf_dict.update(safe_load(f))
#                     conf_dict.update(conf_path=f.name)
#             else:  # YAML string
#                 try:
#                     conf_dict.update(safe_load(conf))
#                 except ValueError:  # invalid path/filename
#                     raise IOError("File not found: %s" % conf)
#         elif isFile(conf):  # parse the first YAML document in a stream
#             conf_dict.update(safe_load(conf))
#             conf_dict.update(conf_path=conf.name)
#         else:  # conf is already a dict
#             conf_dict.update(conf)
#         return conf_dict
# 
#     def _update_init(self, init_conf=None, **kwargs):
#         init_conf = self._open_conf(init_conf)
#         if init_conf:
#             self._init.update(init_conf)
#         self._init.update(kwargs)
# 
#     def init(self):
#         self._initialized = True
# 
#     @property
#     def is_initialized(self):
#         if "_initialized" in self.__dict__ and self._initialized:
#             return True
#         else:
#             return False
# 
#     def close(self):
#         self._initialized = False
# 
#     def set_configuration(self, conf):
#         raise NotImplementedError("set_configuration() not implemented")
# 
#     def get_configuration(self):
#         raise NotImplementedError("get_configuration() not implemented")


# Path: basil/RL/RegisterLayer.py
    from collections.abc import Callable  # noqa
    from collections import Callable  # noqa
from basil.dut import Base

#
# ------------------------------------------------------------
# Copyright (c) All rights reserved
# SiLab, Institute of Physics, University of Bonn
# ------------------------------------------------------------
#

try:
except ImportError:



class RegisterLayer(Base):
    def __init__(self, driver, conf):
        super(RegisterLayer, self).__init__(conf)
        self._drv = driver

    def init(self):
        super(RegisterLayer, self).init()

    def __getattr__(self, name):
        if not self.is_initialized:  # this test allows attributes to be set in the __init__ method
            raise AttributeError("'%s' has no attribute '%s'" % (self.__class__.__name__, name))
        else:
            attr = getattr(self._drv, name)
            # for compatibility with RegisterHardwareLayer:
            # prevent wrting to a register twice
            if not isinstance(attr, Callable):

                return attr