|
@@ -53,12 +53,12 @@ class ConfigurationChecker:
|
|
|
def check_synape_dict(synape_dict):
|
|
|
"""
|
|
|
|
|
|
- Return True if the provided dict is corresponding to a Synapse
|
|
|
+ Return True if the provided dict is well corresponding to a Synapse
|
|
|
|
|
|
- :param settings: The YAML settings file
|
|
|
- :type settings: String
|
|
|
- :return: the path to store the cache
|
|
|
- :rtype: String
|
|
|
+ :param synape_dict: The synapse Dictionary
|
|
|
+ :type synape_dict: Dict
|
|
|
+ :return: True if synapse are ok
|
|
|
+ :rtype: Boolean
|
|
|
|
|
|
:Example:
|
|
|
|
|
@@ -92,11 +92,24 @@ class ConfigurationChecker:
|
|
|
@staticmethod
|
|
|
def check_neuron_dict(neuron_dict):
|
|
|
"""
|
|
|
+
|
|
|
Check received neuron dict is valid:
|
|
|
- - neuron exist
|
|
|
- :param neuron_dict:
|
|
|
- :return:
|
|
|
+
|
|
|
+ :param neuron_dict: The neuron Dictionary
|
|
|
+ :type neuron_dict: Dict
|
|
|
+ :return: True if neuron is ok
|
|
|
+ :rtype: Boolean
|
|
|
+
|
|
|
+ :Example:
|
|
|
+
|
|
|
+ ConfigurationChecker().check_neuron_dict(neurons_dict):
|
|
|
+
|
|
|
+ .. seealso:: Synapse
|
|
|
+ .. raises:: ModuleNotFoundError
|
|
|
+ .. warnings:: Static and Public
|
|
|
"""
|
|
|
+
|
|
|
+
|
|
|
def check_neuron_exist(neuron_name):
|
|
|
package_name = "neurons"
|
|
|
mod = __import__(package_name, fromlist=[neuron_name])
|
|
@@ -115,12 +128,48 @@ class ConfigurationChecker:
|
|
|
|
|
|
@staticmethod
|
|
|
def check_signal_dict(signal_dict):
|
|
|
+ """
|
|
|
+
|
|
|
+ Check received signal dictionary is valid:
|
|
|
+
|
|
|
+ :param signal_dict: The signal Dictionary
|
|
|
+ :type signal_dict: Dict
|
|
|
+ :return: True if signal are ok
|
|
|
+ :rtype: Boolean
|
|
|
+
|
|
|
+ :Example:
|
|
|
+
|
|
|
+ ConfigurationChecker().check_signal_dict(signal_dict):
|
|
|
+
|
|
|
+ .. seealso:: Order, Event
|
|
|
+ .. raises:: NoValidSignal
|
|
|
+ .. warnings:: Static and Public
|
|
|
+ """
|
|
|
+
|
|
|
if ('event' not in signal_dict) and ('order' not in signal_dict):
|
|
|
raise NoValidSignal("The signal is not an event or an order %s" % signal_dict)
|
|
|
return True
|
|
|
|
|
|
@staticmethod
|
|
|
def check_event_dict(event_dict):
|
|
|
+ """
|
|
|
+
|
|
|
+ Check received event dictionary is valid:
|
|
|
+
|
|
|
+ :param event_dict: The event Dictionary
|
|
|
+ :type event_dict: Dict
|
|
|
+ :return: True if event are ok
|
|
|
+ :rtype: Boolean
|
|
|
+
|
|
|
+ :Example:
|
|
|
+
|
|
|
+ ConfigurationChecker().check_event_dict(event_dict):
|
|
|
+
|
|
|
+ .. seealso:: Event
|
|
|
+ .. raises:: NoEventPeriod
|
|
|
+ .. warnings:: Static and Public
|
|
|
+ """
|
|
|
+
|
|
|
if event_dict is None:
|
|
|
raise NoEventPeriod("Event must contain a period: %s" % event_dict)
|
|
|
|
|
@@ -128,6 +177,24 @@ class ConfigurationChecker:
|
|
|
|
|
|
@staticmethod
|
|
|
def check_order_dict(order_dict):
|
|
|
+ """
|
|
|
+
|
|
|
+ Check received order dictionary is valid:
|
|
|
+
|
|
|
+ :param order_dict: The Order Dict
|
|
|
+ :type order_dict: Dict
|
|
|
+ :return: True if event are ok
|
|
|
+ :rtype: Boolean
|
|
|
+
|
|
|
+ :Example:
|
|
|
+
|
|
|
+ ConfigurationChecker().check_order_dict(order_dict):
|
|
|
+
|
|
|
+ .. seealso:: Order
|
|
|
+ .. raises:: NoEventPeriod
|
|
|
+ .. warnings:: Static and Public
|
|
|
+ """
|
|
|
+
|
|
|
if order_dict is not None:
|
|
|
return True
|
|
|
return False
|
|
@@ -135,12 +202,25 @@ class ConfigurationChecker:
|
|
|
@staticmethod
|
|
|
def check_synapes(synapses_list):
|
|
|
"""
|
|
|
+
|
|
|
Check the synapse list is ok:
|
|
|
- - No double same name
|
|
|
- :param synapses_list:
|
|
|
- :type synapses_list: list of Synapse
|
|
|
- :return:
|
|
|
+ - No double same name
|
|
|
+
|
|
|
+ :param synapses_list: The Synapse List
|
|
|
+ :type synapses_list: List
|
|
|
+ :return: list of Synapse
|
|
|
+ :rtype: List
|
|
|
+
|
|
|
+ :Example:
|
|
|
+
|
|
|
+ ConfigurationChecker().check_synapes(order_dict):
|
|
|
+
|
|
|
+ .. seealso:: Synapse
|
|
|
+ .. raises:: MultipleSameSynapseName
|
|
|
+ .. warnings:: Static and Public
|
|
|
"""
|
|
|
+
|
|
|
+
|
|
|
seen = set()
|
|
|
for synapse in synapses_list:
|
|
|
# convert ascii to UTF-8
|