Example #1
0
 def __init__(self, section_name="brain"):
     self._overrides = BrainOverridesConfiguration()
     self._defaults = BrainDefaultsConfiguration()
     self._binaries = BrainBinariesConfiguration()
     self._braintree = BrainBraintreeConfiguration()
     self._security = BrainSecuritiesConfiguration()
     self._dynamics = BrainDynamicsConfiguration()
     self._tokenizer = BrainTokenizerConfiguration()
     self._debugfiles = BrainDebugFilesConfiguration()
     BaseContainerConfigurationData.__init__(self, section_name)
Example #2
0
    def test_with_no_data(self):
        yaml = YamlConfigurationFile()
        self.assertIsNotNone(yaml)
        yaml.load_from_text("""
        brain:
        """, ConsoleConfiguration(), ".")

        brain_config = yaml.get_section("brain")

        debugfiles_config = BrainDebugFilesConfiguration()

        debugfiles_config.load_config_section(yaml, brain_config, ".")

        self.assertFalse(debugfiles_config.save_errors)
        self.assertFalse(debugfiles_config.save_duplicates)
Example #3
0
    def __init__(self, section_name="brain"):
        self._bot_name = None
        self._manager_name = None

        self._overrides = BrainOverridesConfiguration()
        self._defaults = BrainDefaultsConfiguration()
        self._binaries = BrainBinariesConfiguration()
        self._braintree = BrainBraintreeConfiguration()
        self._services = BrainServicesConfiguration()
        self._security = BrainSecuritiesConfiguration()
        self._oob = BrainOOBSConfiguration()
        self._dynamics = BrainDynamicsConfiguration()
        self._tokenizer = BrainTokenizerConfiguration()
        self._debugfiles = BrainDebugFilesConfiguration()
        self._nlu = BrainNluConfiguration()
        BaseContainerConfigurationData.__init__(self, section_name)
Example #4
0
 def to_yaml(self, data, defaults=True):
     self.config_to_yaml(data, BrainOverridesConfiguration(), defaults)
     self.config_to_yaml(data, BrainDefaultsConfiguration(), defaults)
     self.config_to_yaml(data, BrainBinariesConfiguration(), defaults)
     self.config_to_yaml(data, BrainBraintreeConfiguration(), defaults)
     self.config_to_yaml(data, BrainSecuritiesConfiguration(), defaults)
     self.config_to_yaml(data, BrainDynamicsConfiguration(), defaults)
     self.config_to_yaml(data, BrainTokenizerConfiguration(), defaults)
     self.config_to_yaml(data, BrainDebugFilesConfiguration(), defaults)
Example #5
0
class BrainConfiguration(BaseContainerConfigurationData):
    def __init__(self, section_name="brain"):
        self._overrides = BrainOverridesConfiguration()
        self._defaults = BrainDefaultsConfiguration()
        self._binaries = BrainBinariesConfiguration()
        self._braintree = BrainBraintreeConfiguration()
        self._services = BrainServicesConfiguration()
        self._openchatbots = BrainOpenChatBotsConfiguration()
        self._security = BrainSecuritiesConfiguration()
        self._dynamics = BrainDynamicsConfiguration()
        self._tokenizer = BrainTokenizerConfiguration()
        self._debugfiles = BrainDebugFilesConfiguration()
        BaseContainerConfigurationData.__init__(self, section_name)

    @property
    def overrides(self):
        return self._overrides

    @property
    def defaults(self):
        return self._defaults

    @property
    def binaries(self):
        return self._binaries

    @property
    def braintree(self):
        return self._braintree

    @property
    def services(self):
        return self._services

    @property
    def openchatbots(self):
        return self._openchatbots

    @property
    def security(self):
        return self._security

    @property
    def dynamics(self):
        return self._dynamics

    @property
    def tokenizer(self):
        return self._tokenizer

    @property
    def debugfiles(self):
        return self._debugfiles

    def check_for_license_keys(self, license_keys):
        self._overrides.check_for_license_keys(license_keys)
        self._defaults.check_for_license_keys(license_keys)
        self._binaries.check_for_license_keys(license_keys)
        self._braintree.check_for_license_keys(license_keys)
        self._services.check_for_license_keys(license_keys)
        self._openchatbots.check_for_license_keys(license_keys)
        self._security.check_for_license_keys(license_keys)
        self._dynamics.check_for_license_keys(license_keys)
        self._tokenizer.check_for_license_keys(license_keys)
        self._debugfiles.check_for_license_keys(license_keys)
        BaseContainerConfigurationData.check_for_license_keys(
            self, license_keys)

    def load_configuration(self,
                           configuration_file,
                           brain_config,
                           bot_root,
                           subs: Substitutions = None):
        if brain_config is not None:
            self._overrides.load_config_section(configuration_file,
                                                brain_config,
                                                bot_root,
                                                subs=subs)
            self._defaults.load_config_section(configuration_file,
                                               brain_config,
                                               bot_root,
                                               subs=subs)
            self._binaries.load_config_section(configuration_file,
                                               brain_config,
                                               bot_root,
                                               subs=subs)
            self._braintree.load_config_section(configuration_file,
                                                brain_config,
                                                bot_root,
                                                subs=subs)
            self._services.load_config_section(configuration_file,
                                               brain_config,
                                               bot_root,
                                               subs=subs)
            self._openchatbots.load_config_section(configuration_file,
                                                   brain_config,
                                                   bot_root,
                                                   subs=subs)
            self._security.load_config_section(configuration_file,
                                               brain_config,
                                               bot_root,
                                               subs=subs)
            self._dynamics.load_config_section(configuration_file,
                                               brain_config,
                                               bot_root,
                                               subs=subs)
            self._tokenizer.load_config_section(configuration_file,
                                                brain_config,
                                                bot_root,
                                                subs=subs)
            self._debugfiles.load_config_section(configuration_file,
                                                 brain_config,
                                                 bot_root,
                                                 subs=subs)

    def to_yaml(self, data, defaults=True):
        self.config_to_yaml(data, BrainOverridesConfiguration(), defaults)
        self.config_to_yaml(data, BrainDefaultsConfiguration(), defaults)
        self.config_to_yaml(data, BrainBinariesConfiguration(), defaults)
        self.config_to_yaml(data, BrainBraintreeConfiguration(), defaults)
        self.config_to_yaml(data, BrainServicesConfiguration(), defaults)
        self.config_to_yaml(data, BrainOpenChatBotsConfiguration(), defaults)
        self.config_to_yaml(data, BrainSecuritiesConfiguration(), defaults)
        self.config_to_yaml(data, BrainDynamicsConfiguration(), defaults)
        self.config_to_yaml(data, BrainTokenizerConfiguration(), defaults)
        self.config_to_yaml(data, BrainDebugFilesConfiguration(), defaults)
Example #6
0
class BrainConfiguration(BaseContainerConfigurationData):

    def __init__(self, section_name="brain"):
        self._overrides = BrainOverridesConfiguration()
        self._defaults = BrainDefaultsConfiguration()
        self._binaries = BrainBinariesConfiguration()
        self._braintree = BrainBraintreeConfiguration()
        self._services = BrainServicesConfiguration()
        self._security = BrainSecuritiesConfiguration()
        self._oob = BrainOOBSConfiguration()
        self._dynamics = BrainDynamicsConfiguration()
        self._tokenizer = BrainTokenizerConfiguration()
        self._debugfiles = BrainDebugFilesConfiguration()
        BaseContainerConfigurationData.__init__(self, section_name)

    @property
    def overrides(self):
        return self._overrides

    @property
    def defaults(self):
        return self._defaults

    @property
    def binaries(self):
        return self._binaries

    @property
    def braintree(self):
        return self._braintree

    @property
    def services(self):
        return self._services

    @property
    def security(self):
        return self._security

    @property
    def oob(self):
        return self._oob

    @property
    def dynamics(self):
        return self._dynamics

    @property
    def tokenizer(self):
        return self._tokenizer

    @property
    def debugfiles(self):
        return self._debugfiles

    def load_configuration(self, configuration_file, bot_root):
        brain_config = configuration_file.get_section(self.section_name)
        if brain_config is not None:
            self._overrides.load_config_section(configuration_file, brain_config, bot_root)
            self._defaults.load_config_section(configuration_file, brain_config, bot_root)
            self._binaries.load_config_section(configuration_file, brain_config, bot_root)
            self._braintree.load_config_section(configuration_file, brain_config, bot_root)
            self._services.load_config_section(configuration_file, brain_config, bot_root)
            self._security.load_config_section(configuration_file, brain_config, bot_root)
            self._oob.load_config_section(configuration_file, brain_config, bot_root)
            self._dynamics.load_config_section(configuration_file, brain_config, bot_root)
            self._tokenizer.load_config_section(configuration_file, brain_config, bot_root)
            self._debugfiles.load_config_section(configuration_file, brain_config, bot_root)

    def to_yaml(self, data, defaults=True):
        self.config_to_yaml(data, BrainOverridesConfiguration(), defaults)
        self.config_to_yaml(data, BrainDefaultsConfiguration(), defaults)
        self.config_to_yaml(data, BrainBinariesConfiguration(), defaults)
        self.config_to_yaml(data, BrainBraintreeConfiguration(), defaults)
        self.config_to_yaml(data, BrainServicesConfiguration(), defaults)
        self.config_to_yaml(data, BrainSecuritiesConfiguration(), defaults)
        self.config_to_yaml(data, BrainOOBSConfiguration(), defaults)
        self.config_to_yaml(data, BrainDynamicsConfiguration(), defaults)
        self.config_to_yaml(data, BrainTokenizerConfiguration(), defaults)
        self.config_to_yaml(data, BrainDebugFilesConfiguration(), defaults)
Example #7
0
    def test_defaults(self):
        debugfiles_config = BrainDebugFilesConfiguration()
        data = {}
        debugfiles_config.to_yaml(data, True)

        BrainDebugFilesConfigurationTests.assert_defaults(self, data)
Example #8
0
class BrainConfiguration(BaseContainerConfigurationData):
    def __init__(self, section_name="brain"):
        self._bot_name = None
        self._manager_name = None

        self._overrides = BrainOverridesConfiguration()
        self._defaults = BrainDefaultsConfiguration()
        self._binaries = BrainBinariesConfiguration()
        self._braintree = BrainBraintreeConfiguration()
        self._services = BrainServicesConfiguration()
        self._security = BrainSecuritiesConfiguration()
        self._oob = BrainOOBSConfiguration()
        self._dynamics = BrainDynamicsConfiguration()
        self._tokenizer = BrainTokenizerConfiguration()
        self._debugfiles = BrainDebugFilesConfiguration()
        self._nlu = BrainNluConfiguration()
        BaseContainerConfigurationData.__init__(self, section_name)

    @property
    def bot_name(self):
        return self._bot_name

    @property
    def manager_name(self):
        return self._manager_name

    @property
    def overrides(self):
        return self._overrides

    @property
    def defaults(self):
        return self._defaults

    @property
    def binaries(self):
        return self._binaries

    @property
    def braintree(self):
        return self._braintree

    @property
    def services(self):
        return self._services

    @property
    def security(self):
        return self._security

    @property
    def oob(self):
        return self._oob

    @property
    def dynamics(self):
        return self._dynamics

    @property
    def tokenizer(self):
        return self._tokenizer

    @property
    def debugfiles(self):
        return self._debugfiles

    @property
    def nlu(self):
        return self._nlu

    def check_for_license_keys(self, license_keys):
        self._overrides.check_for_license_keys(license_keys)
        self._defaults.check_for_license_keys(license_keys)
        self._binaries.check_for_license_keys(license_keys)
        self._braintree.check_for_license_keys(license_keys)
        self._services.check_for_license_keys(license_keys)
        self._security.check_for_license_keys(license_keys)
        self._oob.check_for_license_keys(license_keys)
        self._dynamics.check_for_license_keys(license_keys)
        self._tokenizer.check_for_license_keys(license_keys)
        self._debugfiles.check_for_license_keys(license_keys)
        self._nlu.check_for_license_keys(license_keys)
        BaseContainerConfigurationData.check_for_license_keys(
            self, license_keys)

    def load_configuration(self,
                           configuration_file,
                           bot_root,
                           subs: Substitutions = None):
        brain_config = configuration_file.get_section(self.section_name)
        if brain_config is not None:
            self._bot_name = configuration_file.get_option(
                brain_config, "bot_name")
            self._manager_name = configuration_file.get_option(
                brain_config, "manager_name")

            self._overrides.load_config_section(configuration_file,
                                                brain_config,
                                                bot_root,
                                                subs=subs)
            self._defaults.load_config_section(configuration_file,
                                               brain_config,
                                               bot_root,
                                               subs=subs)
            self._binaries.load_config_section(configuration_file,
                                               brain_config,
                                               bot_root,
                                               subs=subs)
            self._braintree.load_config_section(configuration_file,
                                                brain_config,
                                                bot_root,
                                                subs=subs)
            self._services.load_config_section(configuration_file,
                                               brain_config,
                                               bot_root,
                                               subs=subs)
            self._security.load_config_section(configuration_file,
                                               brain_config,
                                               bot_root,
                                               subs=subs)
            self._oob.load_config_section(configuration_file,
                                          brain_config,
                                          bot_root,
                                          subs=subs)
            self._dynamics.load_config_section(configuration_file,
                                               brain_config,
                                               bot_root,
                                               subs=subs)
            self._tokenizer.load_config_section(configuration_file,
                                                brain_config,
                                                bot_root,
                                                subs=subs)
            self._debugfiles.load_config_section(configuration_file,
                                                 brain_config,
                                                 bot_root,
                                                 subs=subs)
            self._nlu.load_config_section(configuration_file,
                                          brain_config,
                                          bot_root,
                                          subs=subs)

    def to_yaml(self, data, defaults=True):
        self.config_to_yaml(data, BrainOverridesConfiguration(), defaults)
        self.config_to_yaml(data, BrainDefaultsConfiguration(), defaults)
        self.config_to_yaml(data, BrainBinariesConfiguration(), defaults)
        self.config_to_yaml(data, BrainBraintreeConfiguration(), defaults)
        self.config_to_yaml(data, BrainServicesConfiguration(), defaults)
        self.config_to_yaml(data, BrainSecuritiesConfiguration(), defaults)
        self.config_to_yaml(data, BrainOOBSConfiguration(), defaults)
        self.config_to_yaml(data, BrainDynamicsConfiguration(), defaults)
        self.config_to_yaml(data, BrainTokenizerConfiguration(), defaults)
        self.config_to_yaml(data, BrainDebugFilesConfiguration(), defaults)
        self.config_to_yaml(data, BrainNluConfiguration(), defaults)