# Path: uchroma/traits.py
# def get_args_dict(obj: HasTraits, incl_all=False):
#     """
#     Return a dict of user-configurable traits for an object
# 
#     :param obj: an instance of HasTraits
#     :param incl_all: If all items should be included, regardless of RO status
#     :return: dict of arguments
#     """
#     argsdict = ArgsDict()
#     for k in sorted(obj._trait_values.keys()):
#         v = obj._trait_values[k]
#         trait = obj.traits()[k]
#         if incl_all or (not trait.get_metadata('hidden') and is_trait_writable(trait)):
#             argsdict[k] = v
#     return argsdict
# 
# Path: uchroma/util.py
# def camel_to_snake(name: str) -> str:
#     """
#     Returns a snake_case_name from a CamelCaseName
#     """
#     s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
#     return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()


import functools
import inspect
import re
from abc import abstractmethod
from frozendict import frozendict
from traitlets import Bool, HasTraits, Instance, Tuple, Unicode
from uchroma.traits import get_args_dict
from uchroma.util import camel_to_snake


    def __init__(self, fxmod, driver, *args, **kwargs):
        super(BaseFX, self).__init__(*args, **kwargs)
        self._fxmod = fxmod
        self._driver = driver

    @abstractmethod
    def apply(self) -> bool:
        return False



class FXModule:
    def __init__(self, driver):
        self._driver = driver
        self._available_fx = frozendict(self._load_fx())


    def _load_fx(self) -> dict:
        fx = {}
        for k, v in inspect.getmembers(self.__class__, \
                lambda x: inspect.isclass(x) and issubclass(x, BaseFX)):
            key = camel_to_snake(re.sub(r'FX$', '', k))
            if key in [item.lower() for item in self._driver.hardware.supported_fx]:
                fx[key] = v

        return fx



# Path: uchroma/traits.py
# def get_args_dict(obj: HasTraits, incl_all=False):
#     """
#     Return a dict of user-configurable traits for an object
# 
#     :param obj: an instance of HasTraits
#     :param incl_all: If all items should be included, regardless of RO status
#     :return: dict of arguments
#     """
#     argsdict = ArgsDict()
#     for k in sorted(obj._trait_values.keys()):
#         v = obj._trait_values[k]
#         trait = obj.traits()[k]
#         if incl_all or (not trait.get_metadata('hidden') and is_trait_writable(trait)):
#             argsdict[k] = v
#     return argsdict
# 
# Path: uchroma/util.py
# def camel_to_snake(name: str) -> str:
#     """
#     Returns a snake_case_name from a CamelCaseName
#     """
#     s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
#     return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()


# Path: uchroma/server/fx.py
import functools
import inspect
import re
from abc import abstractmethod
from frozendict import frozendict
from traitlets import Bool, HasTraits, Instance, Tuple, Unicode
from uchroma.traits import get_args_dict
from uchroma.util import camel_to_snake



    def __init__(self, fxmod, driver, *args, **kwargs):
        super(BaseFX, self).__init__(*args, **kwargs)
        self._fxmod = fxmod
        self._driver = driver

    @abstractmethod
    def apply(self) -> bool:
        return False



class FXModule:
    def __init__(self, driver):
        self._driver = driver
        self._available_fx = frozendict(self._load_fx())


    def _load_fx(self) -> dict:
        fx = {}
        for k, v in inspect.getmembers(self.__class__, \
                lambda x: inspect.isclass(x) and issubclass(x, BaseFX)):
            key = camel_to_snake(re.sub(r'FX$', '', k))
            if key in [item.lower() for item in self._driver.hardware.supported_fx]:
                fx[key] = v

        return fx



    @property