|
@@ -58,17 +58,17 @@ class SettingLoader(object):
|
|
|
def get_yaml_config(cls, file_path=None):
|
|
|
"""
|
|
|
|
|
|
- Class Methods which loads default or the provided YAML file and return it as a String
|
|
|
+ Class Methods which loads default or the provided YAML file and return it as a String
|
|
|
|
|
|
- :param file_path: the setting file path to load if None takes default
|
|
|
- :type file_path: String
|
|
|
- :return: The loaded settings YAML
|
|
|
- :rtype: String
|
|
|
+ :param file_path: the setting file path to load if None takes default
|
|
|
+ :type file_path: String
|
|
|
+ :return: The loaded settings YAML
|
|
|
+ :rtype: String
|
|
|
|
|
|
- :Example:
|
|
|
- settings_yaml = SettingLoader.get_yaml_config(/var/tmp/settings.yml)
|
|
|
+ :Example:
|
|
|
+ settings_yaml = SettingLoader.get_yaml_config(/var/tmp/settings.yml)
|
|
|
|
|
|
- .. warnings:: Class Method
|
|
|
+ .. warnings:: Class Method
|
|
|
"""
|
|
|
|
|
|
if file_path is None:
|
|
@@ -79,19 +79,19 @@ class SettingLoader(object):
|
|
|
def get_settings(cls, file_path=None):
|
|
|
"""
|
|
|
|
|
|
- Class Methods which loads default or the provided YAML file and return a Settings Object
|
|
|
+ Class Methods which loads default or the provided YAML file and return a Settings Object
|
|
|
|
|
|
- :param file_path: the setting file path to load
|
|
|
- :type file_path: String
|
|
|
- :return: The loaded Settings
|
|
|
- :rtype: Settings
|
|
|
+ :param file_path: the setting file path to load
|
|
|
+ :type file_path: String
|
|
|
+ :return: The loaded Settings
|
|
|
+ :rtype: Settings
|
|
|
|
|
|
- :Example:
|
|
|
+ :Example:
|
|
|
|
|
|
- settings = SettingLoader.get_settings(file_path="/var/tmp/settings.yml")
|
|
|
+ settings = SettingLoader.get_settings(file_path="/var/tmp/settings.yml")
|
|
|
|
|
|
- .. seealso:: Settings
|
|
|
- .. warnings:: Class Method
|
|
|
+ .. seealso:: Settings
|
|
|
+ .. warnings:: Class Method
|
|
|
"""
|
|
|
|
|
|
# create a new setting
|
|
@@ -132,20 +132,20 @@ class SettingLoader(object):
|
|
|
def _get_default_speech_to_text(settings):
|
|
|
"""
|
|
|
|
|
|
- Get the default speech to text defined in the settings.yml file
|
|
|
+ Get the default speech to text defined in the settings.yml file
|
|
|
|
|
|
- :param settings: The YAML settings file
|
|
|
- :type settings: String
|
|
|
- :return: the default speech to text
|
|
|
- :rtype: String
|
|
|
+ :param settings: The YAML settings file
|
|
|
+ :type settings: String
|
|
|
+ :return: the default speech to text
|
|
|
+ :rtype: String
|
|
|
|
|
|
- :Example:
|
|
|
+ :Example:
|
|
|
|
|
|
- default_stt_name = cls._get_default_speech_to_text(settings)
|
|
|
+ default_stt_name = cls._get_default_speech_to_text(settings)
|
|
|
|
|
|
- .. seealso:: Stt
|
|
|
- .. raises:: NullSettingException, SettingNotFound
|
|
|
- .. warnings:: Static and Private
|
|
|
+ .. seealso:: Stt
|
|
|
+ .. raises:: NullSettingException, SettingNotFound
|
|
|
+ .. warnings:: Static and Private
|
|
|
"""
|
|
|
|
|
|
try:
|
|
@@ -161,20 +161,20 @@ class SettingLoader(object):
|
|
|
def _get_default_text_to_speech(settings):
|
|
|
"""
|
|
|
|
|
|
- Get the default text to speech defined in the settings.yml file
|
|
|
+ Get the default text to speech defined in the settings.yml file
|
|
|
|
|
|
- :param settings: The YAML settings file
|
|
|
- :type settings: String
|
|
|
- :return: the default text to speech
|
|
|
- :rtype: String
|
|
|
+ :param settings: The YAML settings file
|
|
|
+ :type settings: String
|
|
|
+ :return: the default text to speech
|
|
|
+ :rtype: String
|
|
|
|
|
|
- :Example:
|
|
|
+ :Example:
|
|
|
|
|
|
- default_tts_name = cls._get_default_text_to_speech(settings)
|
|
|
+ default_tts_name = cls._get_default_text_to_speech(settings)
|
|
|
|
|
|
- .. seealso:: Tts
|
|
|
- .. raises:: NullSettingException, SettingNotFound
|
|
|
- .. warnings:: Static and Private
|
|
|
+ .. seealso:: Tts
|
|
|
+ .. raises:: NullSettingException, SettingNotFound
|
|
|
+ .. warnings:: Static and Private
|
|
|
"""
|
|
|
|
|
|
try:
|
|
@@ -190,20 +190,20 @@ class SettingLoader(object):
|
|
|
def _get_default_trigger(settings):
|
|
|
"""
|
|
|
|
|
|
- Get the default trigger defined in the settings.yml file
|
|
|
+ Get the default trigger defined in the settings.yml file
|
|
|
|
|
|
- :param settings: The YAML settings file
|
|
|
- :type settings: String
|
|
|
- :return: the default trigger
|
|
|
- :rtype: String
|
|
|
+ :param settings: The YAML settings file
|
|
|
+ :type settings: String
|
|
|
+ :return: the default trigger
|
|
|
+ :rtype: String
|
|
|
|
|
|
- :Example:
|
|
|
+ :Example:
|
|
|
|
|
|
- default_trigger_name = cls._get_default_trigger(settings)
|
|
|
+ default_trigger_name = cls._get_default_trigger(settings)
|
|
|
|
|
|
- .. seealso:: Trigger
|
|
|
- .. raises:: NullSettingException, SettingNotFound
|
|
|
- .. warnings:: Static and Private
|
|
|
+ .. seealso:: Trigger
|
|
|
+ .. raises:: NullSettingException, SettingNotFound
|
|
|
+ .. warnings:: Static and Private
|
|
|
"""
|
|
|
|
|
|
try:
|
|
@@ -219,20 +219,20 @@ class SettingLoader(object):
|
|
|
def _get_stts(cls, settings):
|
|
|
"""
|
|
|
|
|
|
- Return a list of stt object
|
|
|
+ Return a list of stt object
|
|
|
|
|
|
- :param settings: The YAML settings file
|
|
|
- :type settings: String
|
|
|
- :return: List of Stt
|
|
|
- :rtype: List
|
|
|
+ :param settings: The YAML settings file
|
|
|
+ :type settings: String
|
|
|
+ :return: List of Stt
|
|
|
+ :rtype: List
|
|
|
|
|
|
- :Example:
|
|
|
+ :Example:
|
|
|
|
|
|
- stts = cls._get_stts(settings)
|
|
|
+ stts = cls._get_stts(settings)
|
|
|
|
|
|
- .. seealso:: Stt
|
|
|
- .. raises:: SettingNotFound
|
|
|
- .. warnings:: Class Method and Private
|
|
|
+ .. seealso:: Stt
|
|
|
+ .. raises:: SettingNotFound
|
|
|
+ .. warnings:: Class Method and Private
|
|
|
"""
|
|
|
|
|
|
try:
|
|
@@ -259,20 +259,20 @@ class SettingLoader(object):
|
|
|
def _get_ttss(cls, settings):
|
|
|
"""
|
|
|
|
|
|
- Return a list of stt object
|
|
|
+ Return a list of stt object
|
|
|
|
|
|
- :param settings: The YAML settings file
|
|
|
- :type settings: String
|
|
|
- :return: List of Ttss
|
|
|
- :rtype: List
|
|
|
+ :param settings: The YAML settings file
|
|
|
+ :type settings: String
|
|
|
+ :return: List of Ttss
|
|
|
+ :rtype: List
|
|
|
|
|
|
- :Example:
|
|
|
+ :Example:
|
|
|
|
|
|
- ttss = cls._get_ttss(settings)
|
|
|
+ ttss = cls._get_ttss(settings)
|
|
|
|
|
|
- .. seealso:: Tts
|
|
|
- .. raises:: SettingNotFound
|
|
|
- .. warnings:: Class Method and Private
|
|
|
+ .. seealso:: Tts
|
|
|
+ .. raises:: SettingNotFound
|
|
|
+ .. warnings:: Class Method and Private
|
|
|
"""
|
|
|
|
|
|
try:
|
|
@@ -299,20 +299,20 @@ class SettingLoader(object):
|
|
|
def _get_triggers(cls, settings):
|
|
|
"""
|
|
|
|
|
|
- Return a list of Trigger object
|
|
|
+ Return a list of Trigger object
|
|
|
|
|
|
- :param settings: The YAML settings file
|
|
|
- :type settings: String
|
|
|
- :return: List of Trigger
|
|
|
- :rtype: List
|
|
|
+ :param settings: The YAML settings file
|
|
|
+ :type settings: String
|
|
|
+ :return: List of Trigger
|
|
|
+ :rtype: List
|
|
|
|
|
|
- :Example:
|
|
|
+ :Example:
|
|
|
|
|
|
- triggers = cls._get_triggers(settings)
|
|
|
+ triggers = cls._get_triggers(settings)
|
|
|
|
|
|
- .. seealso:: Trigger
|
|
|
- .. raises:: SettingNotFound
|
|
|
- .. warnings:: Class Method and Private
|
|
|
+ .. seealso:: Trigger
|
|
|
+ .. raises:: SettingNotFound
|
|
|
+ .. warnings:: Class Method and Private
|
|
|
"""
|
|
|
|
|
|
try:
|
|
@@ -339,20 +339,20 @@ class SettingLoader(object):
|
|
|
def _get_random_wake_up_answers(cls, settings):
|
|
|
"""
|
|
|
|
|
|
- Return a list of the wake up answers set up on the settings.yml file
|
|
|
+ Return a list of the wake up answers set up on the settings.yml file
|
|
|
|
|
|
- :param settings: The YAML settings file
|
|
|
- :type settings: String
|
|
|
- :return: List of wake up answers
|
|
|
- :rtype: List of Strings
|
|
|
+ :param settings: The YAML settings file
|
|
|
+ :type settings: String
|
|
|
+ :return: List of wake up answers
|
|
|
+ :rtype: List of Strings
|
|
|
|
|
|
- :Example:
|
|
|
+ :Example:
|
|
|
|
|
|
- wakeup = cls._get_random_wake_up_answers(settings)
|
|
|
+ wakeup = cls._get_random_wake_up_answers(settings)
|
|
|
|
|
|
- .. seealso::
|
|
|
- .. raises:: NullSettingException
|
|
|
- .. warnings:: Class Method and Private
|
|
|
+ .. seealso::
|
|
|
+ .. raises:: NullSettingException
|
|
|
+ .. warnings:: Class Method and Private
|
|
|
"""
|
|
|
|
|
|
try:
|
|
@@ -371,20 +371,20 @@ class SettingLoader(object):
|
|
|
def _get_random_wake_up_sounds(cls, settings):
|
|
|
"""
|
|
|
|
|
|
- Return a list of the wake up sounds set up on the settings.yml file
|
|
|
+ Return a list of the wake up sounds set up on the settings.yml file
|
|
|
|
|
|
- :param settings: The YAML settings file
|
|
|
- :type settings: String
|
|
|
- :return: List of wake up sounds
|
|
|
- :rtype: List of Strings (paths)
|
|
|
+ :param settings: The YAML settings file
|
|
|
+ :type settings: String
|
|
|
+ :return: List of wake up sounds
|
|
|
+ :rtype: List of Strings (paths)
|
|
|
|
|
|
- :Example:
|
|
|
+ :Example:
|
|
|
|
|
|
- wakeup_sounds = cls._get_random_wake_up_sounds(settings)
|
|
|
+ wakeup_sounds = cls._get_random_wake_up_sounds(settings)
|
|
|
|
|
|
- .. seealso::
|
|
|
- .. raises:: NullSettingException
|
|
|
- .. warnings:: Class Method and Private
|
|
|
+ .. seealso::
|
|
|
+ .. raises:: NullSettingException
|
|
|
+ .. warnings:: Class Method and Private
|
|
|
"""
|
|
|
|
|
|
try:
|
|
@@ -403,20 +403,20 @@ class SettingLoader(object):
|
|
|
def _get_rest_api(cls, settings):
|
|
|
"""
|
|
|
|
|
|
- Return the settings of the RestApi
|
|
|
+ Return the settings of the RestApi
|
|
|
|
|
|
- :param settings: The YAML settings file
|
|
|
- :type settings: String
|
|
|
- :return: the RestApi object
|
|
|
- :rtype: RestApi
|
|
|
+ :param settings: The YAML settings file
|
|
|
+ :type settings: String
|
|
|
+ :return: the RestApi object
|
|
|
+ :rtype: RestApi
|
|
|
|
|
|
- :Example:
|
|
|
+ :Example:
|
|
|
|
|
|
- rest_api = cls._get_rest_api(settings)
|
|
|
+ rest_api = cls._get_rest_api(settings)
|
|
|
|
|
|
- .. seealso:: RestApi
|
|
|
- .. raises:: SettingNotFound, NullSettingException, SettingInvalidException
|
|
|
- .. warnings:: Class Method and Private
|
|
|
+ .. seealso:: RestApi
|
|
|
+ .. raises:: SettingNotFound, NullSettingException, SettingInvalidException
|
|
|
+ .. warnings:: Class Method and Private
|
|
|
"""
|
|
|
|
|
|
try:
|
|
@@ -465,20 +465,20 @@ class SettingLoader(object):
|
|
|
def _get_cache_path(cls, settings):
|
|
|
"""
|
|
|
|
|
|
- Return the path where to store the cache
|
|
|
+ Return the path where to store the cache
|
|
|
|
|
|
- :param settings: The YAML settings file
|
|
|
- :type settings: String
|
|
|
- :return: the path to store the cache
|
|
|
- :rtype: String
|
|
|
+ :param settings: The YAML settings file
|
|
|
+ :type settings: String
|
|
|
+ :return: the path to store the cache
|
|
|
+ :rtype: String
|
|
|
|
|
|
- :Example:
|
|
|
+ :Example:
|
|
|
|
|
|
- cache_path = cls._get_cache_path(settings)
|
|
|
+ cache_path = cls._get_cache_path(settings)
|
|
|
|
|
|
- .. seealso::
|
|
|
- .. raises:: SettingNotFound, NullSettingException, SettingInvalidException
|
|
|
- .. warnings:: Class Method and Private
|
|
|
+ .. seealso::
|
|
|
+ .. raises:: SettingNotFound, NullSettingException, SettingInvalidException
|
|
|
+ .. warnings:: Class Method and Private
|
|
|
"""
|
|
|
|
|
|
try:
|