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)
def test_with_no_data(self): yaml = YamlConfigurationFile() self.assertIsNotNone(yaml) yaml.load_from_text(""" brain: """, ConsoleConfiguration(), ".") brain_config = yaml.get_section("brain") overrides_config = BrainOverridesConfiguration() overrides_config.load_config_section(yaml, brain_config, ".") self.assertFalse(overrides_config.allow_system_aiml) self.assertFalse(overrides_config.allow_learn_aiml) self.assertFalse(overrides_config.allow_learnf_aiml)
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)
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)
def __init__(self, section_name="brain"): self._overrides = BrainOverridesConfiguration() self._defaults = BrainDefaultsConfiguration() self._nodes = BrainNodesConfiguration() self._binaries = BrainBinariesConfiguration() self._braintree = BrainBraintreeConfiguration() self._files = BrainFilesConfiguration() self._services = BrainServicesConfiguration() self._security = BrainSecuritiesConfiguration() self._oob = BrainOOBSConfiguration() self._dynamics = BrainDynamicsConfiguration() self._tokenizer = BrainTokenizerConfiguration() BaseContainerConfigurationData.__init__(self, section_name)
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)
class BrainConfiguration(BaseContainerConfigurationData): def __init__(self, section_name="brain"): self._overrides = BrainOverridesConfiguration() self._defaults = BrainDefaultsConfiguration() self._nodes = BrainNodesConfiguration() self._binaries = BrainBinariesConfiguration() self._braintree = BrainBraintreeConfiguration() self._files = BrainFilesConfiguration() self._services = BrainServicesConfiguration() self._security = BrainSecuritiesConfiguration() self._oob = BrainOOBSConfiguration() self._dynamics = BrainDynamicsConfiguration() self._tokenizer = BrainTokenizerConfiguration() BaseContainerConfigurationData.__init__(self, section_name) @property def overrides(self): return self._overrides @property def defaults(self): return self._defaults @property def nodes(self): return self._nodes @property def binaries(self): return self._binaries @property def braintree(self): return self._braintree @property def files(self): return self._files @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 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._nodes.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._files.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) 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, BrainNodesConfiguration(), defaults) self.config_to_yaml(data, BrainBinariesConfiguration(), defaults) self.config_to_yaml(data, BrainBraintreeConfiguration(), defaults) self.config_to_yaml(data, BrainFilesConfiguration(), 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)
def test_defaults(self): overrides_config = BrainOverridesConfiguration() data = {} overrides_config.to_yaml(data, True) BrainOverridesConfigurationTests.assert_defaults(self, data)
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)