nico 8 жил өмнө
parent
commit
146f9962b8
2 өөрчлөгдсөн 10 нэмэгдсэн , 3 устгасан
  1. 6 2
      core/OrderAnalyser.py
  2. 4 1
      test.py

+ 6 - 2
core/OrderAnalyser.py

@@ -49,6 +49,7 @@ class OrderAnalyser:
 
                         for neuron in synapse.neurons:
                             if isinstance(neuron.parameters, dict):
+                                print neuron.parameters
                                 if "args" in neuron.parameters:
                                     logger.debug("The neuron wait for parameter")
                                     # check that the user added parameters to his order
@@ -61,19 +62,22 @@ class OrderAnalyser:
                                         # we add wanted arguments the existing neuron parameter dict
                                         for arg in neuron.parameters["args"]:
                                             if arg in params:
-                                                problem_in_neuron_found = True
                                                 logger.debug("Parameter %s added to the current parameter "
                                                              "of the neuron: %s" % (arg, neuron.name))
                                                 neuron.parameters[arg] = params[arg]
                                             else:
                                                 # we don't raise an error and break the program but
                                                 # we don't run the neuron
+                                                problem_in_neuron_found = True
                                                 Utils.print_danger("Error: Argument \"%s\" not found in the"
                                                                    " order" % arg)
 
                             # if no error detected, we run the neuron
-                            if problem_in_neuron_found:
+                            if not problem_in_neuron_found:
                                 NeuroneLauncher.start_neurone(neuron)
+                            else:
+                                Utils.print_danger("A problem has been found in the Synapse.")
+
 
         if not synapses_found:
             Utils.print_info("No synapse match the captured order: %s" % self.order)

+ 4 - 1
test.py

@@ -11,7 +11,10 @@ logger.setLevel(logging.DEBUG)
 
 # This does not work because of different encoding when using accent
 from core import OrderAnalyser
-order = "jarvis régle le réveil pour sept heures et vingt minutes"
+# order = "jarvis régle le réveil pour sept heures et vingt minutes"
+# order = "mais nous de la musique"
+
+order = "arrête la musique"
 # order = order.decode('utf-8')
 # print type(order)
 oa = OrderAnalyser(order)