Browse Source

[Doc] Docstrings Indent is better :)

monf 8 years ago
parent
commit
2f4fb252a7

+ 49 - 49
core/ConfigurationManager/BrainLoader.py

@@ -28,17 +28,17 @@ class BrainLoader(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 brain file path to load
-        :type file_path: String
-        :return: The loaded brain YAML
-        :rtype: String
+            :param file_path: the brain file path to load
+            :type file_path: String
+            :return: The loaded brain YAML
+            :rtype: String
 
-        :Example:
-            brain_yaml = BrainLoader.get_yaml_config(/var/tmp/brain.yml)
+            :Example:
+                brain_yaml = BrainLoader.get_yaml_config(/var/tmp/brain.yml)
 
-        .. warnings:: Class Method
+            .. warnings:: Class Method
         """
         if file_path is None:
             brain_file_path = cls._get_root_brain_path()
@@ -50,19 +50,19 @@ class BrainLoader(object):
     def get_brain(cls, file_path=None):
         """
 
-        Class Methods which loads default or the provided YAML file and return a Brain
+            Class Methods which loads default or the provided YAML file and return a Brain
 
-        :param file_path: the brain file path to load
-        :type file_path: String
-        :return: The loaded Brain
-        :rtype: Brain
+            :param file_path: the brain file path to load
+            :type file_path: String
+            :return: The loaded Brain
+            :rtype: Brain
 
-        :Example:
+            :Example:
 
-            brain = BrainLoader.get_brain(file_path="/var/tmp/brain.yml")
+                brain = BrainLoader.get_brain(file_path="/var/tmp/brain.yml")
 
-        .. seealso:: Brain
-        .. warnings:: Class Method
+            .. seealso:: Brain
+            .. warnings:: Class Method
         """
 
         # Instantiate a brain
@@ -101,19 +101,19 @@ class BrainLoader(object):
     def _get_neurons(neurons_dict):
         """
 
-        Get a list of Neuron object from a neuron dict
+            Get a list of Neuron object from a neuron dict
 
-        :param neurons_dict: Neuron name or dictionary of Neuron_name/Neuron_parameters
-        :type neurons_dict: String or dict
-        :return: A list of Neurons
-        :rtype: List
+            :param neurons_dict: Neuron name or dictionary of Neuron_name/Neuron_parameters
+            :type neurons_dict: String or dict
+            :return: A list of Neurons
+            :rtype: List
 
-        :Example:
+            :Example:
 
-            neurons = cls._get_neurons(synapses_dict["neurons"])
+                neurons = cls._get_neurons(synapses_dict["neurons"])
 
-        .. seealso:: Neuron
-        .. warnings:: Static and Private
+            .. seealso:: Neuron
+            .. warnings:: Static and Private
         """
 
         neurons = list()
@@ -140,19 +140,19 @@ class BrainLoader(object):
     def _get_signals(cls, signals_dict):
         """
 
-        Get a list of Signal object from a signals dict
+            Get a list of Signal object from a signals dict
 
-        :param signals_dict: Signal name or dictionary of Signal_name/Signal_parameters
-        :type signals_dict: String or dict
-        :return: A list of Event and/or Order
-        :rtype: List
+            :param signals_dict: Signal name or dictionary of Signal_name/Signal_parameters
+            :type signals_dict: String or dict
+            :return: A list of Event and/or Order
+            :rtype: List
 
-        :Example:
+            :Example:
 
-            signals = cls._get_signals(synapses_dict["signals"])
+                signals = cls._get_signals(synapses_dict["signals"])
 
-        .. seealso:: Event, Order
-        .. warnings:: Class method and Private
+            .. seealso:: Event, Order
+            .. warnings:: Class method and Private
         """
         # print signals_dict
         signals = list()
@@ -168,19 +168,19 @@ class BrainLoader(object):
     def _get_event_or_order_from_dict(signal_or_event_dict):
         """
 
-        The signal is either an Event or an Order
+            The signal is either an Event or an Order
 
-        :param signal_or_event_dict: A dict of event or signal
-        :type signal_or_event_dict: dict
-        :return: The object corresponding to An Order or an Event
-        :rtype: An Order or an Event
+            :param signal_or_event_dict: A dict of event or signal
+            :type signal_or_event_dict: dict
+            :return: The object corresponding to An Order or an Event
+            :rtype: An Order or an Event
 
-        :Example:
+            :Example:
 
-            event_or_order = cls._get_event_or_order_from_dict(signal_dict)
+                event_or_order = cls._get_event_or_order_from_dict(signal_dict)
 
-        .. seealso:: Event, Order
-        .. warnings:: Static method and Private
+            .. seealso:: Event, Order
+            .. warnings:: Static method and Private
         """
         if 'event' in signal_or_event_dict:
             # print "is event"
@@ -197,14 +197,14 @@ class BrainLoader(object):
     def _get_root_brain_path():
         """
 
-        Return the full path of the default brain file
+            Return the full path of the default brain file
 
-        :Example:
+            :Example:
 
-            brain.brain_file = cls._get_root_brain_path()
+                brain.brain_file = cls._get_root_brain_path()
 
-        .. raises:: IOError
-        .. warnings:: Static method and Private
+            .. raises:: IOError
+            .. warnings:: Static method and Private
         """
 
         # get current script directory path. We are in /an/unknown/path/kalliope/core/ConfigurationManager

+ 60 - 60
core/ConfigurationManager/ConfigurationChecker.py

@@ -79,20 +79,20 @@ class ConfigurationChecker:
     def check_synape_dict(synape_dict):
         """
 
-        Return True if the provided dict is well corresponding to a Synapse
+            Return True if the provided dict is well corresponding to a Synapse
 
-        :param synape_dict: The synapse Dictionary
-        :type synape_dict: Dict
-        :return: True if synapse are ok
-        :rtype: Boolean
+            :param synape_dict: The synapse Dictionary
+            :type synape_dict: Dict
+            :return: True if synapse are ok
+            :rtype: Boolean
 
-        :Example:
+            :Example:
 
-            ConfigurationChecker().check_synape_dict(synapses_dict):
+                ConfigurationChecker().check_synape_dict(synapses_dict):
 
-        .. seealso:: Synapse
-        .. raises:: NoSynapeName, InvalidSynapeName, NoSynapeNeurons, NoSynapeSignals
-        .. warnings:: Static and Public
+            .. seealso:: Synapse
+            .. raises:: NoSynapeName, InvalidSynapeName, NoSynapeNeurons, NoSynapeSignals
+            .. warnings:: Static and Public
         """
 
         if 'name' not in synape_dict:
@@ -119,20 +119,20 @@ class ConfigurationChecker:
     def check_neuron_dict(neuron_dict):
         """
 
-        Check received neuron dict is valid:
+            Check received neuron dict is valid:
 
-        :param neuron_dict: The neuron Dictionary
-        :type neuron_dict: Dict
-        :return: True if neuron is ok
-        :rtype: Boolean
+            :param neuron_dict: The neuron Dictionary
+            :type neuron_dict: Dict
+            :return: True if neuron is ok
+            :rtype: Boolean
 
-        :Example:
+            :Example:
 
-            ConfigurationChecker().check_neuron_dict(neurons_dict):
+                ConfigurationChecker().check_neuron_dict(neurons_dict):
 
-        .. seealso:: Synapse
-        .. raises:: ModuleNotFoundError
-        .. warnings:: Static and Public
+            .. seealso:: Synapse
+            .. raises:: ModuleNotFoundError
+            .. warnings:: Static and Public
         """
 
 
@@ -156,20 +156,20 @@ class ConfigurationChecker:
     def check_signal_dict(signal_dict):
         """
 
-        Check received signal dictionary is valid:
+            Check received signal dictionary is valid:
 
-        :param signal_dict: The signal Dictionary
-        :type signal_dict: Dict
-        :return: True if signal are ok
-        :rtype: Boolean
+            :param signal_dict: The signal Dictionary
+            :type signal_dict: Dict
+            :return: True if signal are ok
+            :rtype: Boolean
 
-        :Example:
+            :Example:
 
-            ConfigurationChecker().check_signal_dict(signal_dict):
+                ConfigurationChecker().check_signal_dict(signal_dict):
 
-        .. seealso:: Order, Event
-        .. raises:: NoValidSignal
-        .. warnings:: Static and Public
+            .. seealso:: Order, Event
+            .. raises:: NoValidSignal
+            .. warnings:: Static and Public
         """
 
         if ('event' not in signal_dict) and ('order' not in signal_dict):
@@ -180,20 +180,20 @@ class ConfigurationChecker:
     def check_event_dict(event_dict):
         """
 
-        Check received event dictionary is valid:
+            Check received event dictionary is valid:
 
-        :param event_dict: The event Dictionary
-        :type event_dict: Dict
-        :return: True if event are ok
-        :rtype: Boolean
+            :param event_dict: The event Dictionary
+            :type event_dict: Dict
+            :return: True if event are ok
+            :rtype: Boolean
 
-        :Example:
+            :Example:
 
-            ConfigurationChecker().check_event_dict(event_dict):
+                ConfigurationChecker().check_event_dict(event_dict):
 
-        .. seealso::  Event
-        .. raises:: NoEventPeriod
-        .. warnings:: Static and Public
+            .. seealso::  Event
+            .. raises:: NoEventPeriod
+            .. warnings:: Static and Public
         """
 
         if event_dict is None:
@@ -205,20 +205,20 @@ class ConfigurationChecker:
     def check_order_dict(order_dict):
         """
 
-        Check received order dictionary is valid:
+            Check received order dictionary is valid:
 
-        :param order_dict: The Order Dict
-        :type order_dict: Dict
-        :return: True if event are ok
-        :rtype: Boolean
+            :param order_dict: The Order Dict
+            :type order_dict: Dict
+            :return: True if event are ok
+            :rtype: Boolean
 
-        :Example:
+            :Example:
 
-            ConfigurationChecker().check_order_dict(order_dict):
+                ConfigurationChecker().check_order_dict(order_dict):
 
-        .. seealso::  Order
-        .. raises:: NoEventPeriod
-        .. warnings:: Static and Public
+            .. seealso::  Order
+            .. raises:: NoEventPeriod
+            .. warnings:: Static and Public
         """
 
         if order_dict is not None:
@@ -230,20 +230,20 @@ class ConfigurationChecker:
         """
 
         Check the synapse list is ok:
-            - No double same name
+                - No double same name
 
-        :param synapses_list: The Synapse List
-        :type synapses_list: List
-        :return: list of Synapse
-        :rtype: List
+            :param synapses_list: The Synapse List
+            :type synapses_list: List
+            :return: list of Synapse
+            :rtype: List
 
-        :Example:
+            :Example:
 
-            ConfigurationChecker().check_synapes(order_dict):
+                ConfigurationChecker().check_synapes(order_dict):
 
-        .. seealso::  Synapse
-        .. raises:: MultipleSameSynapseName
-        .. warnings:: Static and Public
+            .. seealso::  Synapse
+            .. raises:: MultipleSameSynapseName
+            .. warnings:: Static and Public
         """
 
 

+ 117 - 117
core/ConfigurationManager/SettingLoader.py

@@ -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:

+ 12 - 12
core/ConfigurationManager/YAMLLoader.py

@@ -28,20 +28,20 @@ class YAMLLoader:
     def get_config(cls, yaml_file):
         """
 
-        Return the provided YAML configuration file
+            Return the provided YAML configuration file
 
-        :param yaml_file: The path of the configuration file
-        :type yaml_file: String
-        :return: the configuration file
-        :rtype: String
+            :param yaml_file: The path of the configuration file
+            :type yaml_file: String
+            :return: the configuration file
+            :rtype: String
 
-        :Example:
+            :Example:
 
-            YAMLLoader.get_config(brain_file_path)
+                YAMLLoader.get_config(brain_file_path)
 
-        .. seealso::  SettingLoader, BrainLoader
-        .. raises:: YAMLFileNotFound
-        .. warnings:: Class Method and Public
+            .. seealso::  SettingLoader, BrainLoader
+            .. raises:: YAMLFileNotFound
+            .. warnings:: Class Method and Public
         """
 
         current_dir = os.path.dirname(os.path.abspath(__file__))
@@ -94,7 +94,7 @@ class IncludeImport(object):
     def get_data(self):
         """
 
-        :return: the data for the IncludeImport
+            :return: the data for the IncludeImport
         """
         return self.data
 
@@ -103,7 +103,7 @@ class IncludeImport(object):
         """
             Method to Add an other Include statement to the original brain.yml file
 
-        :param data_to_add: the data to add to the current brain.yml, provided by an Include Statement
+            :param data_to_add: the data to add to the current brain.yml, provided by an Include Statement
 
         """