Prechádzať zdrojové kódy

Merge branch 'dev' into tests_monf

monf 8 rokov pred
rodič
commit
19ecad7021
100 zmenil súbory, kde vykonal 303 pridanie a 217 odobranie
  1. 1 1
      Docs/rest_api.md
  2. 0 6
      core/__init__.py
  3. 2 113
      kalliope.py
  4. 0 0
      kalliope/Tests/__init__.py
  5. 0 0
      kalliope/Tests/brains/brain_test.yml
  6. 0 0
      kalliope/Tests/brains/included_brain_test.yml
  7. 0 0
      kalliope/Tests/settings/settings_test.yml
  8. 6 6
      kalliope/Tests/test_brain_loader.py
  9. 3 3
      kalliope/Tests/test_configuration_checker.py
  10. 1 1
      kalliope/Tests/test_dynamic_loading.py
  11. 4 4
      kalliope/Tests/test_order_analyser.py
  12. 84 4
      kalliope/Tests/test_rest_api.py
  13. 5 5
      kalliope/Tests/test_settings_loader.py
  14. 3 3
      kalliope/Tests/test_tts_module.py
  15. 1 1
      kalliope/Tests/test_yaml_loader.py
  16. 114 0
      kalliope/__init__.py
  17. 3 0
      kalliope/_version.py
  18. 0 0
      kalliope/brain.yml
  19. 0 0
      kalliope/brains/ansible_playbook.yml
  20. 0 0
      kalliope/brains/gmail_checker.yml
  21. 0 0
      kalliope/brains/kill_switch.yml
  22. 0 0
      kalliope/brains/neurotransmitter.yml
  23. 0 0
      kalliope/brains/openweathermap.yml
  24. 0 0
      kalliope/brains/push_message.yml
  25. 0 0
      kalliope/brains/say.yml
  26. 0 0
      kalliope/brains/script.yml
  27. 0 0
      kalliope/brains/shell.yml
  28. 0 0
      kalliope/brains/systemdate.yml
  29. 0 0
      kalliope/brains/tasker_autoremote.yml
  30. 0 0
      kalliope/brains/twitter.yml
  31. 0 0
      kalliope/brains/wake_on_lan.yml
  32. 0 0
      kalliope/brains/wikipedia.yml
  33. 7 7
      kalliope/core/ConfigurationManager/BrainLoader.py
  34. 2 2
      kalliope/core/ConfigurationManager/ConfigurationChecker.py
  35. 7 7
      kalliope/core/ConfigurationManager/SettingLoader.py
  36. 0 0
      kalliope/core/ConfigurationManager/YAMLLoader.py
  37. 0 0
      kalliope/core/ConfigurationManager/__init__.py
  38. 3 3
      kalliope/core/CrontabManager.py
  39. 0 0
      kalliope/core/FileManager.py
  40. 8 8
      kalliope/core/MainController.py
  41. 0 0
      kalliope/core/Models/Brain.py
  42. 0 0
      kalliope/core/Models/Event.py
  43. 0 0
      kalliope/core/Models/Neuron.py
  44. 0 0
      kalliope/core/Models/Order.py
  45. 0 0
      kalliope/core/Models/RestAPI.py
  46. 0 0
      kalliope/core/Models/Settings.py
  47. 0 0
      kalliope/core/Models/Singleton.py
  48. 0 0
      kalliope/core/Models/Stt.py
  49. 0 0
      kalliope/core/Models/Synapse.py
  50. 0 0
      kalliope/core/Models/Trigger.py
  51. 0 0
      kalliope/core/Models/Tts.py
  52. 0 0
      kalliope/core/Models/__init__.py
  53. 4 4
      kalliope/core/NeuronModule.py
  54. 1 1
      kalliope/core/NeuroneLauncher.py
  55. 3 3
      kalliope/core/OrderAnalyser.py
  56. 2 2
      kalliope/core/OrderListener.py
  57. 0 0
      kalliope/core/Players/Mplayer.py
  58. 0 0
      kalliope/core/Players/__init__.py
  59. 3 3
      kalliope/core/RestAPI/FlaskAPI.py
  60. 0 0
      kalliope/core/RestAPI/__init__.py
  61. 1 1
      kalliope/core/RestAPI/utils.py
  62. 5 5
      kalliope/core/ShellGui.py
  63. 1 1
      kalliope/core/SynapseLauncher.py
  64. 1 1
      kalliope/core/TTS/TTSLauncher.py
  65. 3 3
      kalliope/core/TTS/TTSModule.py
  66. 0 0
      kalliope/core/TTS/__init__.py
  67. 1 1
      kalliope/core/TriggerLauncher.py
  68. 1 1
      kalliope/core/Utils.py
  69. 6 0
      kalliope/core/__init__.py
  70. 3 3
      kalliope/manual_testing.py
  71. 0 0
      kalliope/neurons/__init__.py
  72. 0 0
      kalliope/neurons/ansible_playbook/README.md
  73. 0 0
      kalliope/neurons/ansible_playbook/__init__.py
  74. 1 1
      kalliope/neurons/ansible_playbook/ansible_playbook.py
  75. 0 0
      kalliope/neurons/ansible_playbook/tests/__init__.py
  76. 2 2
      kalliope/neurons/ansible_playbook/tests/test_ansible_playbook.py
  77. 0 0
      kalliope/neurons/gmail_checker/README.md
  78. 0 0
      kalliope/neurons/gmail_checker/__init__.py
  79. 1 1
      kalliope/neurons/gmail_checker/gmail_checker.py
  80. 0 0
      kalliope/neurons/gmail_checker/tests/__init__.py
  81. 2 2
      kalliope/neurons/gmail_checker/tests/test_gmail_checker.py
  82. 0 0
      kalliope/neurons/kill_switch/README.md
  83. 0 0
      kalliope/neurons/kill_switch/__init__.py
  84. 1 1
      kalliope/neurons/kill_switch/kill_switch.py
  85. 0 0
      kalliope/neurons/neurotransmitter/README.md
  86. 0 0
      kalliope/neurons/neurotransmitter/__init__.py
  87. 1 1
      kalliope/neurons/neurotransmitter/neurotransmitter.py
  88. 0 0
      kalliope/neurons/neurotransmitter/tests/__init__.py
  89. 0 0
      kalliope/neurons/neurotransmitter/tests/neurotransmitter_test_brain.yml
  90. 0 0
      kalliope/neurons/openweathermap/README.md
  91. 0 0
      kalliope/neurons/openweathermap/__init__.py
  92. 1 1
      kalliope/neurons/openweathermap/openweathermap.py
  93. 0 0
      kalliope/neurons/openweathermap/tests/__init__.py
  94. 2 2
      kalliope/neurons/openweathermap/tests/test_openweathermap.py
  95. 0 0
      kalliope/neurons/push_message/Readme.md
  96. 0 0
      kalliope/neurons/push_message/__init__.py
  97. 1 1
      kalliope/neurons/push_message/push_message.py
  98. 0 0
      kalliope/neurons/push_message/tests/__init__.py
  99. 2 2
      kalliope/neurons/push_message/tests/test_push_message.py
  100. 0 0
      kalliope/neurons/say/README.md

+ 1 - 1
Docs/rest_api.md

@@ -134,7 +134,7 @@ Output example:
 ```
 
 
-Run a synapse from an order
+### Run a synapse from an order
 
 Normal response codes: 201
 Error response codes: unauthorized(401), itemNotFound(404)

+ 0 - 6
core/__init__.py

@@ -1,6 +0,0 @@
-from core.OrderAnalyser import OrderAnalyser
-from core.OrderListener import OrderListener
-from core.ShellGui import ShellGui
-from core.FileManager import FileManager
-from core.Utils import Utils
-

+ 2 - 113
kalliope.py

@@ -1,117 +1,6 @@
 #!/usr/bin/env python
 # coding: utf8
-import argparse
-import logging
-
-from core import ShellGui
-from core import Utils
-from core.ConfigurationManager.BrainLoader import BrainLoader
-from core.CrontabManager import CrontabManager
-from core.MainController import MainController
-import signal
-import sys
-
-from core.SynapseLauncher import SynapseLauncher
-
-logging.basicConfig()
-logger = logging.getLogger("kalliope")
-
-
-def signal_handler(signal, frame):
-    """
-    Used to catch a keyboard signal like Ctrl+C in order to kill the kalliope program
-    :param signal: signal handler
-    :param frame: execution frame
-    """
-    print "\n"
-    Utils.print_info("Ctrl+C pressed. Killing Kalliope")
-    sys.exit(0)
-
-# actions available
-ACTION_LIST = ["start", "gui"]
-
-
-def main():
-    """
-    Entry point of Kalliope program
-    """
-    # create arguments
-    parser = argparse.ArgumentParser(description='Kalliope')
-    parser.add_argument("action", help="[start|gui]")
-    parser.add_argument("--run-synapse", help="Name of a synapse to load surrounded by quote")
-    parser.add_argument("--brain-file", help="Full path of a brain file")
-    parser.add_argument("--debug", action='store_true', help="Show debug output")
-
-    # parse arguments from script parameters
-    args = parser.parse_args()
-
-    # require at least one parameter, the action
-    if len(sys.argv[1:]) == 0:
-        parser.print_usage()
-        sys.exit(1)
-
-    # check if we want debug
-    configure_logging(debug=args.debug)
-
-    logger.debug("kalliope args: %s" % args)
-
-    # by default, no brain file is set. Use the default one: brain.yml in the root path
-    brain_file = None
-    # check if user set a brain.yml file
-    if args.brain_file:
-        brain_file = args.brain_file
-    # load the brain once
-    brain_loader = BrainLoader.Instance(file_path=brain_file)
-    brain = brain_loader.brain
-
-    # check the user provide a valid action
-    if args.action not in ACTION_LIST:
-        Utils.print_warning("%s is not a recognised action\n" % args.action)
-        parser.print_help()
-
-    if args.action == "start":
-        # user set a synapse to start
-        if args.run_synapse is not None:
-            SynapseLauncher.start_synapse(args.run_synapse, brain=brain)
-
-        if args.run_synapse is None:
-            # first, load events in crontab
-            crontab_manager = CrontabManager(brain=brain)
-            crontab_manager.load_events_in_crontab()
-            Utils.print_success("Events loaded in crontab")
-            # then start kalliope
-            Utils.print_success("Starting Kalliope")
-            Utils.print_info("Press Ctrl+C for stopping")
-            # catch signal for killing on Ctrl+C pressed
-            signal.signal(signal.SIGINT, signal_handler)
-            # start the main controller
-            MainController(brain=brain)
-
-    if args.action == "gui":
-        ShellGui(brain=brain)
-
-
-def configure_logging(debug=None):
-    """
-    Prepare log folder in current home directory
-    :param debug: If true, set the lof level to debug
-    """
-    logger = logging.getLogger("kalliope")
-    logger.propagate = False
-    ch = logging.StreamHandler()
-    ch.setLevel(logging.DEBUG)
-    formatter = logging.Formatter('%(asctime)s :: %(levelname)s :: %(message)s')
-    ch.setFormatter(formatter)
-
-    # add the handlers to logger
-    logger.addHandler(ch)
-
-    if debug:
-        logger.setLevel(logging.DEBUG)
-    else:
-        logger.setLevel(logging.INFO)
-
-    logger.debug("Logger ready")
+import kalliope
 
 if __name__ == '__main__':
-    main()
+    kalliope.main()

+ 0 - 0
Tests/__init__.py → kalliope/Tests/__init__.py


+ 0 - 0
Tests/brains/brain_test.yml → kalliope/Tests/brains/brain_test.yml


+ 0 - 0
Tests/brains/included_brain_test.yml → kalliope/Tests/brains/included_brain_test.yml


+ 0 - 0
Tests/settings/settings_test.yml → kalliope/Tests/settings/settings_test.yml


+ 6 - 6
Tests/test_brain_loader.py → kalliope/Tests/test_brain_loader.py

@@ -1,11 +1,11 @@
 import unittest
 
-from core.ConfigurationManager import BrainLoader
-from core.Models import Event
-from core.Models import Neuron
-from core.Models import Synapse
-from core.Models import Order
-from core.Models.Brain import Brain
+from kalliope.core.ConfigurationManager import BrainLoader
+from kalliope.core.Models import Event
+from kalliope.core.Models import Neuron
+from kalliope.core.Models import Synapse
+from kalliope.core.Models import Order
+from kalliope.core.Models.Brain import Brain
 
 
 class TestBrainLoader(unittest.TestCase):

+ 3 - 3
Tests/test_configuration_checker.py → kalliope/Tests/test_configuration_checker.py

@@ -1,9 +1,9 @@
 import unittest
 
-from core.ConfigurationManager.ConfigurationChecker import ConfigurationChecker, NoSynapeName, NoSynapeNeurons, \
+from kalliope.core.ConfigurationManager.ConfigurationChecker import ConfigurationChecker, NoSynapeName, NoSynapeNeurons, \
     NoSynapeSignals, NoValidSignal, NoEventPeriod, NoValidOrder, MultipleSameSynapseName
-from core.Models import Synapse
-from core.Utils import ModuleNotFoundError
+from kalliope.core.Models import Synapse
+from kalliope.core.Utils import ModuleNotFoundError
 
 
 class TestConfigurationChecker(unittest.TestCase):

+ 1 - 1
Tests/test_dynamic_loading.py → kalliope/Tests/test_dynamic_loading.py

@@ -114,7 +114,7 @@ class TestDynamicLoading(unittest.TestCase):
         :param module_name: module name to load
         :return:
         """
-        module_name_with_path = package_name + "." + module_name.lower() + "." + module_name.lower()
+        module_name_with_path = "kalliope." + package_name + "." + module_name.lower() + "." + module_name.lower()
         mod = __import__(module_name_with_path, fromlist=[module_name])
         try:
             getattr(mod, module_name)

+ 4 - 4
Tests/test_order_analyser.py → kalliope/Tests/test_order_analyser.py

@@ -1,10 +1,10 @@
 import unittest
 
 
-from core.OrderAnalyser import OrderAnalyser
-from core.Models.Neuron import Neuron
-from core.Models.Synapse import Synapse
-from core.Models.Order import Order
+from kalliope.core.OrderAnalyser import OrderAnalyser
+from kalliope.core.Models.Neuron import Neuron
+from kalliope.core.Models.Synapse import Synapse
+from kalliope.core.Models.Order import Order
 
 
 class TestOrderAnalyser(unittest.TestCase):

+ 84 - 4
Tests/test_rest_api.py → kalliope/Tests/test_rest_api.py

@@ -5,9 +5,9 @@ import requests
 import time
 from flask import Flask
 
-from core.ConfigurationManager import BrainLoader
-from core.ConfigurationManager import SettingLoader
-from core.RestAPI.FlaskAPI import FlaskAPI
+from kalliope.core.ConfigurationManager import BrainLoader
+from kalliope.core.ConfigurationManager import SettingLoader
+from kalliope.core.RestAPI.FlaskAPI import FlaskAPI
 
 
 class TestRestAPI(unittest.TestCase):
@@ -136,7 +136,7 @@ class TestRestAPI(unittest.TestCase):
 
         self.assertEqual(expected_content, json.loads(result.content))
 
-    def test_synapse_not_found(self):
+    def test_get_synapse_not_found(self):
         url = self.base_url + "/synapses/test-none"
         result = requests.get(url=url)
 
@@ -147,6 +147,86 @@ class TestRestAPI(unittest.TestCase):
         }
 
         self.assertEqual(expected_content, json.loads(result.content))
+        self.assertEqual(result.status_code, 404)
+
+    def test_run_synapse_by_name(self):
+        url = self.base_url + "/synapses/test"
+        result = requests.post(url=url)
+
+        expected_content = {
+            "synapses": {
+                "name": "test",
+                "neurons": [
+                    {
+                        "say": {
+                            "message": [
+                                "test message"
+                            ]
+                        }
+                    }
+                ],
+                "signals": [
+                    {
+                        "order": "test_order"
+                    }
+                ]
+            }
+        }
+
+        self.assertEqual(expected_content, json.loads(result.content))
+        self.assertEqual(result.status_code, 201)
+
+    def test_post_synapse_not_found(self):
+        url = self.base_url + "/synapses/test-none"
+        result = requests.post(url=url)
+
+        expected_content = {
+            "error": {
+                "synapse name not found": "test-none"
+            }
+        }
+
+        self.assertEqual(expected_content, json.loads(result.content))
+        self.assertEqual(result.status_code, 404)
+
+    def test_run_synapse_with_order(self):
+        url = self.base_url + "/order/"
+        headers = {"Content-Type": "application/json"}
+        data = {"order": "test_order"}
+        result = requests.post(url=url, headers=headers, json=data)
+
+        expected_content = {
+            "synapses": [
+                {
+                    "name": "test",
+                    "neurons": [
+                        {
+                            "name": "say",
+                            "parameters": "{'message': ['test message']}"
+                        }
+                    ],
+                    "signals": [
+                        {
+                            "order": "test_order"
+                        }
+                    ]
+                }
+            ]
+        }
+
+        self.assertEqual(expected_content, json.loads(result.content))
+        self.assertEqual(result.status_code, 201)
+
+    def test_post_synapse_by_order_not_found(self):
+        url = self.base_url + "/order/"
+        data = {"order": "non existing order"}
+        headers = {"Content-Type": "application/json"}
+        result = requests.post(url=url, headers=headers, json=data)
+
+        expected_content = {'error': {'error': "The given order doesn't match any synapses"}}
+
+        self.assertEqual(expected_content, json.loads(result.content))
+        self.assertEqual(result.status_code, 400)
 
 if __name__ == '__main__':
     unittest.main()

+ 5 - 5
Tests/test_settings_loader.py → kalliope/Tests/test_settings_loader.py

@@ -1,10 +1,10 @@
 import unittest
 
-from core.ConfigurationManager import SettingLoader
-from core.Models.RestAPI import RestAPI
-from core.Models.Stt import Stt
-from core.Models.Trigger import Trigger
-from core.Models.Tts import Tts
+from kalliope.core.ConfigurationManager import SettingLoader
+from kalliope.core.Models.RestAPI import RestAPI
+from kalliope.core.Models.Stt import Stt
+from kalliope.core.Models.Trigger import Trigger
+from kalliope.core.Models.Tts import Tts
 
 
 class TestSettingLoader(unittest.TestCase):

+ 3 - 3
Tests/test_tts_module.py → kalliope/Tests/test_tts_module.py

@@ -2,9 +2,9 @@ import unittest
 import mock
 import os
 
-from core.TTS.TTSModule import TTSModule, TtsGenerateAudioFunctionNotFound
-from core.Models.Settings import Settings
-from core.FileManager import FileManager
+from kalliope.core.TTS.TTSModule import TTSModule, TtsGenerateAudioFunctionNotFound
+from kalliope.core.Models.Settings import Settings
+from kalliope.core.FileManager import FileManager
 
 
 class TestTTSModule(unittest.TestCase):

+ 1 - 1
Tests/test_yaml_loader.py → kalliope/Tests/test_yaml_loader.py

@@ -1,6 +1,6 @@
 import unittest
 
-from core.ConfigurationManager.YAMLLoader import YAMLFileNotFound, YAMLLoader
+from kalliope.core.ConfigurationManager.YAMLLoader import YAMLFileNotFound, YAMLLoader
 
 
 class TestYAMLLoader(unittest.TestCase):

+ 114 - 0
kalliope/__init__.py

@@ -0,0 +1,114 @@
+#!/usr/bin/env python
+# coding: utf8
+import argparse
+import logging
+
+from kalliope.core import ShellGui
+from kalliope.core import Utils
+from kalliope.core.ConfigurationManager.BrainLoader import BrainLoader
+from kalliope.core.CrontabManager import CrontabManager
+from kalliope.core.MainController import MainController
+import signal
+import sys
+
+from kalliope.core.SynapseLauncher import SynapseLauncher
+
+logging.basicConfig()
+logger = logging.getLogger("kalliope")
+
+
+def signal_handler(signal, frame):
+    """
+    Used to catch a keyboard signal like Ctrl+C in order to kill the kalliope program
+    :param signal: signal handler
+    :param frame: execution frame
+    """
+    print "\n"
+    Utils.print_info("Ctrl+C pressed. Killing Kalliope")
+    sys.exit(0)
+
+# actions available
+ACTION_LIST = ["start", "gui"]
+
+
+def main():
+    """
+    Entry point of Kalliope program
+    """
+    # create arguments
+    parser = argparse.ArgumentParser(description='Kalliope')
+    parser.add_argument("action", help="[start|gui]")
+    parser.add_argument("--run-synapse", help="Name of a synapse to load surrounded by quote")
+    parser.add_argument("--brain-file", help="Full path of a brain file")
+    parser.add_argument("--debug", action='store_true', help="Show debug output")
+
+    # parse arguments from script parameters
+    args = parser.parse_args()
+
+    # require at least one parameter, the action
+    if len(sys.argv[1:]) == 0:
+        parser.print_usage()
+        sys.exit(1)
+
+    # check if we want debug
+    configure_logging(debug=args.debug)
+
+    logger.debug("kalliope args: %s" % args)
+
+    # by default, no brain file is set. Use the default one: brain.yml in the root path
+    brain_file = None
+    # check if user set a brain.yml file
+    if args.brain_file:
+        brain_file = args.brain_file
+    # load the brain once
+    brain_loader = BrainLoader.Instance(file_path=brain_file)
+    brain = brain_loader.brain
+
+    # check the user provide a valid action
+    if args.action not in ACTION_LIST:
+        Utils.print_warning("%s is not a recognised action\n" % args.action)
+        parser.print_help()
+
+    if args.action == "start":
+        # user set a synapse to start
+        if args.run_synapse is not None:
+            SynapseLauncher.start_synapse(args.run_synapse, brain=brain)
+
+        if args.run_synapse is None:
+            # first, load events in crontab
+            crontab_manager = CrontabManager(brain=brain)
+            crontab_manager.load_events_in_crontab()
+            Utils.print_success("Events loaded in crontab")
+            # then start kalliope
+            Utils.print_success("Starting Kalliope")
+            Utils.print_info("Press Ctrl+C for stopping")
+            # catch signal for killing on Ctrl+C pressed
+            signal.signal(signal.SIGINT, signal_handler)
+            # start the main controller
+            MainController(brain=brain)
+
+    if args.action == "gui":
+        ShellGui(brain=brain)
+
+
+def configure_logging(debug=None):
+    """
+    Prepare log folder in current home directory
+    :param debug: If true, set the lof level to debug
+    """
+    logger = logging.getLogger("kalliope")
+    logger.propagate = False
+    ch = logging.StreamHandler()
+    ch.setLevel(logging.DEBUG)
+    formatter = logging.Formatter('%(asctime)s :: %(levelname)s :: %(message)s')
+    ch.setFormatter(formatter)
+
+    # add the handlers to logger
+    logger.addHandler(ch)
+
+    if debug:
+        logger.setLevel(logging.DEBUG)
+    else:
+        logger.setLevel(logging.INFO)
+
+    logger.debug("Logger ready")

+ 3 - 0
kalliope/_version.py

@@ -0,0 +1,3 @@
+# https://www.python.org/dev/peps/pep-0440/
+# version based on epoch
+version_str = "2016.11.20"

+ 0 - 0
brain.yml → kalliope/brain.yml


+ 0 - 0
brains/ansible_playbook.yml → kalliope/brains/ansible_playbook.yml


+ 0 - 0
brains/gmail_checker.yml → kalliope/brains/gmail_checker.yml


+ 0 - 0
brains/kill_switch.yml → kalliope/brains/kill_switch.yml


+ 0 - 0
brains/neurotransmitter.yml → kalliope/brains/neurotransmitter.yml


+ 0 - 0
brains/openweathermap.yml → kalliope/brains/openweathermap.yml


+ 0 - 0
brains/push_message.yml → kalliope/brains/push_message.yml


+ 0 - 0
brains/say.yml → kalliope/brains/say.yml


+ 0 - 0
brains/script.yml → kalliope/brains/script.yml


+ 0 - 0
brains/shell.yml → kalliope/brains/shell.yml


+ 0 - 0
brains/systemdate.yml → kalliope/brains/systemdate.yml


+ 0 - 0
brains/tasker_autoremote.yml → kalliope/brains/tasker_autoremote.yml


+ 0 - 0
brains/twitter.yml → kalliope/brains/twitter.yml


+ 0 - 0
brains/wake_on_lan.yml → kalliope/brains/wake_on_lan.yml


+ 0 - 0
brains/wikipedia.yml → kalliope/brains/wikipedia.yml


+ 7 - 7
core/ConfigurationManager/BrainLoader.py → kalliope/core/ConfigurationManager/BrainLoader.py

@@ -3,13 +3,13 @@ import logging
 import os
 
 from YAMLLoader import YAMLLoader
-from core.ConfigurationManager.ConfigurationChecker import ConfigurationChecker
-from core.Models import Singleton
-from core.Models.Brain import Brain
-from core.Models.Event import Event
-from core.Models.Neuron import Neuron
-from core.Models.Order import Order
-from core.Models.Synapse import Synapse
+from kalliope.core.ConfigurationManager.ConfigurationChecker import ConfigurationChecker
+from kalliope.core.Models import Singleton
+from kalliope.core.Models.Brain import Brain
+from kalliope.core.Models.Event import Event
+from kalliope.core.Models.Neuron import Neuron
+from kalliope.core.Models.Order import Order
+from kalliope.core.Models.Synapse import Synapse
 
 logging.basicConfig()
 logger = logging.getLogger("kalliope")

+ 2 - 2
core/ConfigurationManager/ConfigurationChecker.py → kalliope/core/ConfigurationManager/ConfigurationChecker.py

@@ -1,6 +1,6 @@
 import re
 
-from core.Utils import ModuleNotFoundError
+from kalliope.core.Utils import ModuleNotFoundError
 
 
 class InvalidSynapeName(Exception):
@@ -139,7 +139,7 @@ class ConfigurationChecker:
             :type neuron_module_name: str
             :return:
             """
-            package_name = "neurons"
+            package_name = "kalliope.neurons"
             mod = __import__(package_name, fromlist=[neuron_module_name])
             try:
                 getattr(mod, neuron_module_name)

+ 7 - 7
core/ConfigurationManager/SettingLoader.py → kalliope/core/ConfigurationManager/SettingLoader.py

@@ -1,13 +1,13 @@
 import logging
 
 from YAMLLoader import YAMLLoader
-from core.FileManager import FileManager
-from core.Models import Singleton
-from core.Models.RestAPI import RestAPI
-from core.Models.Settings import Settings
-from core.Models.Stt import Stt
-from core.Models.Trigger import Trigger
-from core.Models.Tts import Tts
+from kalliope.core.FileManager import FileManager
+from kalliope.core.Models import Singleton
+from kalliope.core.Models.RestAPI import RestAPI
+from kalliope.core.Models.Settings import Settings
+from kalliope.core.Models.Stt import Stt
+from kalliope.core.Models.Trigger import Trigger
+from kalliope.core.Models.Tts import Tts
 
 FILE_NAME = "settings.yml"
 

+ 0 - 0
core/ConfigurationManager/YAMLLoader.py → kalliope/core/ConfigurationManager/YAMLLoader.py


+ 0 - 0
core/ConfigurationManager/__init__.py → kalliope/core/ConfigurationManager/__init__.py


+ 3 - 3
core/CrontabManager.py → kalliope/core/CrontabManager.py

@@ -3,8 +3,8 @@ import logging
 from crontab import CronSlices
 from crontab import CronTab
 
-from core import Utils
-from core.Models import Event
+from kalliope.core import Utils
+from kalliope.core.Models import Event
 
 logging.basicConfig()
 logger = logging.getLogger("kalliope")
@@ -18,7 +18,7 @@ class InvalidCrontabPeriod(Exception):
     pass
 
 CRONTAB_COMMENT = "KALLIOPE"
-KALLIOPE_ENTRY_POINT_SCRIPT = "kalliope.py"
+KALLIOPE_ENTRY_POINT_SCRIPT = "__init__.py"
 
 
 class CrontabManager:

+ 0 - 0
core/FileManager.py → kalliope/core/FileManager.py


+ 8 - 8
core/MainController.py → kalliope/core/MainController.py

@@ -4,14 +4,14 @@ import random
 
 from flask import Flask
 
-from core import Utils
-from core.ConfigurationManager import SettingLoader
-from core.OrderAnalyser import OrderAnalyser
-from core.OrderListener import OrderListener
-from core.Players import Mplayer
-from core.RestAPI.FlaskAPI import FlaskAPI
-from core.TriggerLauncher import TriggerLauncher
-from neurons.say.say import Say
+from kalliope.core import Utils
+from kalliope.core.ConfigurationManager import SettingLoader
+from kalliope.core.OrderAnalyser import OrderAnalyser
+from kalliope.core.OrderListener import OrderListener
+from kalliope.core.Players import Mplayer
+from kalliope.core.RestAPI.FlaskAPI import FlaskAPI
+from kalliope.core.TriggerLauncher import TriggerLauncher
+from kalliope.neurons.say.say import Say
 
 logging.basicConfig()
 logger = logging.getLogger("kalliope")

+ 0 - 0
core/Models/Brain.py → kalliope/core/Models/Brain.py


+ 0 - 0
core/Models/Event.py → kalliope/core/Models/Event.py


+ 0 - 0
core/Models/Neuron.py → kalliope/core/Models/Neuron.py


+ 0 - 0
core/Models/Order.py → kalliope/core/Models/Order.py


+ 0 - 0
core/Models/RestAPI.py → kalliope/core/Models/RestAPI.py


+ 0 - 0
core/Models/Settings.py → kalliope/core/Models/Settings.py


+ 0 - 0
core/Models/Singleton.py → kalliope/core/Models/Singleton.py


+ 0 - 0
core/Models/Stt.py → kalliope/core/Models/Stt.py


+ 0 - 0
core/Models/Synapse.py → kalliope/core/Models/Synapse.py


+ 0 - 0
core/Models/Trigger.py → kalliope/core/Models/Trigger.py


+ 0 - 0
core/Models/Tts.py → kalliope/core/Models/Tts.py


+ 0 - 0
core/Models/__init__.py → kalliope/core/Models/__init__.py


+ 4 - 4
core/NeuronModule.py → kalliope/core/NeuronModule.py

@@ -6,10 +6,10 @@ import random
 import sys
 from jinja2 import Template
 
-from core import OrderListener
-from core.SynapseLauncher import SynapseLauncher
-from core.Utils import Utils
-from core.ConfigurationManager import SettingLoader, BrainLoader
+from kalliope.core import OrderListener
+from kalliope.core.SynapseLauncher import SynapseLauncher
+from kalliope.core.Utils import Utils
+from kalliope.core.ConfigurationManager import SettingLoader, BrainLoader
 
 logging.basicConfig()
 logger = logging.getLogger("kalliope")

+ 1 - 1
core/NeuroneLauncher.py → kalliope/core/NeuroneLauncher.py

@@ -1,6 +1,6 @@
 import logging
 
-from core.Utils import Utils
+from kalliope.core.Utils import Utils
 
 logging.basicConfig()
 logger = logging.getLogger("kalliope")

+ 3 - 3
core/OrderAnalyser.py → kalliope/core/OrderAnalyser.py

@@ -2,9 +2,9 @@
 import re
 from collections import Counter
 
-from core.Utils import Utils
-from core.Models import Order
-from core.NeuroneLauncher import NeuroneLauncher
+from kalliope.core.Utils import Utils
+from kalliope.core.Models import Order
+from kalliope.core.NeuroneLauncher import NeuroneLauncher
 
 import logging
 

+ 2 - 2
core/OrderListener.py → kalliope/core/OrderListener.py

@@ -4,8 +4,8 @@ from threading import Thread
 
 from cffi import FFI as _FFI
 
-from core.Utils import Utils
-from core.ConfigurationManager import SettingLoader
+from kalliope.core.Utils import Utils
+from kalliope.core.ConfigurationManager import SettingLoader
 
 logging.basicConfig()
 logger = logging.getLogger("kalliope")

+ 0 - 0
core/Players/Mplayer.py → kalliope/core/Players/Mplayer.py


+ 0 - 0
core/Players/__init__.py → kalliope/core/Players/__init__.py


+ 3 - 3
core/RestAPI/FlaskAPI.py → kalliope/core/RestAPI/FlaskAPI.py

@@ -4,9 +4,9 @@ from flask import jsonify
 from flask import request
 from flask_restful import abort
 
-from core import OrderAnalyser
-from core.RestAPI.utils import requires_auth
-from core.SynapseLauncher import SynapseLauncher
+from kalliope.core import OrderAnalyser
+from kalliope.core.RestAPI.utils import requires_auth
+from kalliope.core.SynapseLauncher import SynapseLauncher
 
 
 class FlaskAPI(threading.Thread):

+ 0 - 0
tts/__init__.py → kalliope/core/RestAPI/__init__.py


+ 1 - 1
core/RestAPI/utils.py → kalliope/core/RestAPI/utils.py

@@ -1,7 +1,7 @@
 from functools import wraps
 from flask import request, Response
 
-from core.ConfigurationManager import SettingLoader
+from kalliope.core.ConfigurationManager import SettingLoader
 
 
 def check_auth(username, password):

+ 5 - 5
core/ShellGui.py → kalliope/core/ShellGui.py

@@ -7,11 +7,11 @@ import sys
 
 from dialog import Dialog
 
-from core import OrderListener
-from core.ConfigurationManager import SettingLoader
-from core.SynapseLauncher import SynapseLauncher
-from core.Utils import Utils
-from neurons.say.say import Say
+from kalliope.core import OrderListener
+from kalliope.core.ConfigurationManager import SettingLoader
+from kalliope.core.SynapseLauncher import SynapseLauncher
+from kalliope.core.Utils import Utils
+from kalliope.neurons.say.say import Say
 
 logging.basicConfig()
 logger = logging.getLogger("kalliope")

+ 1 - 1
core/SynapseLauncher.py → kalliope/core/SynapseLauncher.py

@@ -1,4 +1,4 @@
-from core.NeuroneLauncher import NeuroneLauncher
+from kalliope.core.NeuroneLauncher import NeuroneLauncher
 
 
 class SynapseNameNotFound(Exception):

+ 1 - 1
core/TTS/TTSLauncher.py → kalliope/core/TTS/TTSLauncher.py

@@ -1,6 +1,6 @@
 import logging
 
-from core import Utils
+from kalliope.core import Utils
 
 logging.basicConfig()
 logger = logging.getLogger("kalliope")

+ 3 - 3
core/TTS/TTSModule.py → kalliope/core/TTS/TTSModule.py

@@ -3,9 +3,9 @@ import hashlib
 import logging
 import os
 
-from core.FileManager import FileManager
-from core.ConfigurationManager import SettingLoader
-from core.Players import Mplayer
+from kalliope.core.FileManager import FileManager
+from kalliope.core.ConfigurationManager import SettingLoader
+from kalliope.core.Players import Mplayer
 
 logging.basicConfig()
 logger = logging.getLogger("kalliope")

+ 0 - 0
trigger/__init__.py → kalliope/core/TTS/__init__.py


+ 1 - 1
core/TriggerLauncher.py → kalliope/core/TriggerLauncher.py

@@ -1,6 +1,6 @@
 import logging
 
-from core import Utils
+from kalliope.core import Utils
 
 logging.basicConfig()
 logger = logging.getLogger("kalliope")

+ 1 - 1
core/Utils.py → kalliope/core/Utils.py

@@ -73,7 +73,7 @@ class Utils(object):
         :return:
         """
         logger.debug("Run plugin %s with parameter %s" % (module_name, parameters))
-        module_name_with_path = package_name + "." + module_name.lower() + "." + module_name.lower()
+        module_name_with_path = "kalliope." + package_name + "." + module_name.lower() + "." + module_name.lower()
         mod = __import__(module_name_with_path, fromlist=[module_name])
         try:
             klass = getattr(mod, module_name)

+ 6 - 0
kalliope/core/__init__.py

@@ -0,0 +1,6 @@
+from kalliope.core.OrderAnalyser import OrderAnalyser
+from kalliope.core.OrderListener import OrderListener
+from kalliope.core.ShellGui import ShellGui
+from kalliope.core.FileManager import FileManager
+from kalliope.core.Utils import Utils
+

+ 3 - 3
manual_testing.py → kalliope/manual_testing.py

@@ -1,9 +1,9 @@
 # coding: utf8
 import logging
 
-from core import OrderAnalyser
-from core.ConfigurationManager import BrainLoader
-from core.ConfigurationManager.SettingLoader import SettingLoader
+from kalliope.core import OrderAnalyser
+from kalliope.core.ConfigurationManager import BrainLoader
+from kalliope.core.ConfigurationManager.SettingLoader import SettingLoader
 
 logging.basicConfig()
 logger = logging.getLogger("kalliope")

+ 0 - 0
stt/__init__.py → kalliope/neurons/__init__.py


+ 0 - 0
neurons/ansible_playbook/README.md → kalliope/neurons/ansible_playbook/README.md


+ 0 - 0
neurons/ansible_playbook/__init__.py → kalliope/neurons/ansible_playbook/__init__.py


+ 1 - 1
neurons/ansible_playbook/ansible_playbook.py → kalliope/neurons/ansible_playbook/ansible_playbook.py

@@ -4,7 +4,7 @@ from ansible.vars import VariableManager
 from ansible.inventory import Inventory
 from ansible.executor.playbook_executor import PlaybookExecutor
 
-from core.NeuronModule import NeuronModule, MissingParameterException
+from kalliope.core.NeuronModule import NeuronModule, MissingParameterException
 
 
 class Ansible_playbook(NeuronModule):

+ 0 - 0
neurons/wikipedia_searcher/tests/__init__.py → kalliope/neurons/ansible_playbook/tests/__init__.py


+ 2 - 2
neurons/ansible_playbook/tests/test_ansible_playbook.py → kalliope/neurons/ansible_playbook/tests/test_ansible_playbook.py

@@ -1,7 +1,7 @@
 import unittest
 
-from core.NeuronModule import MissingParameterException
-from neurons.ansible_playbook.ansible_playbook import Ansible_playbook
+from kalliope.core.NeuronModule import MissingParameterException
+from kalliope.neurons.ansible_playbook.ansible_playbook import Ansible_playbook
 
 
 class TestAnsible_Playbook(unittest.TestCase):

+ 0 - 0
neurons/gmail_checker/README.md → kalliope/neurons/gmail_checker/README.md


+ 0 - 0
neurons/gmail_checker/__init__.py → kalliope/neurons/gmail_checker/__init__.py


+ 1 - 1
neurons/gmail_checker/gmail_checker.py → kalliope/neurons/gmail_checker/gmail_checker.py

@@ -3,7 +3,7 @@ import logging
 
 from gmail import Gmail
 from email.header import decode_header
-from core.NeuronModule import NeuronModule, MissingParameterException
+from kalliope.core.NeuronModule import NeuronModule, MissingParameterException
 
 logging.basicConfig()
 logger = logging.getLogger("kalliope")

+ 0 - 0
neurons/wake_on_lan/tests/__init__.py → kalliope/neurons/gmail_checker/tests/__init__.py


+ 2 - 2
neurons/gmail_checker/tests/test_gmail_checker.py → kalliope/neurons/gmail_checker/tests/test_gmail_checker.py

@@ -1,7 +1,7 @@
 import unittest
 
-from core.NeuronModule import MissingParameterException
-from neurons.gmail_checker.gmail_checker import Gmail_checker
+from kalliope.core.NeuronModule import MissingParameterException
+from kalliope.neurons.gmail_checker.gmail_checker import Gmail_checker
 
 
 class TestGmail_Checker(unittest.TestCase):

+ 0 - 0
neurons/kill_switch/README.md → kalliope/neurons/kill_switch/README.md


+ 0 - 0
neurons/kill_switch/__init__.py → kalliope/neurons/kill_switch/__init__.py


+ 1 - 1
neurons/kill_switch/kill_switch.py → kalliope/neurons/kill_switch/kill_switch.py

@@ -1,6 +1,6 @@
 import sys
 
-from core.NeuronModule import NeuronModule
+from kalliope.core.NeuronModule import NeuronModule
 
 
 class Kill_switch(NeuronModule):

+ 0 - 0
neurons/neurotransmitter/README.md → kalliope/neurons/neurotransmitter/README.md


+ 0 - 0
neurons/neurotransmitter/__init__.py → kalliope/neurons/neurotransmitter/__init__.py


+ 1 - 1
neurons/neurotransmitter/neurotransmitter.py → kalliope/neurons/neurotransmitter/neurotransmitter.py

@@ -1,6 +1,6 @@
 import logging
 
-from core.NeuronModule import NeuronModule, InvalidParameterException
+from kalliope.core.NeuronModule import NeuronModule, InvalidParameterException
 
 logging.basicConfig()
 logger = logging.getLogger("kalliope")

+ 0 - 0
neurons/uri/tests/__init__.py → kalliope/neurons/neurotransmitter/tests/__init__.py


+ 0 - 0
neurons/neurotransmitter/tests/neurotransmitter_test_brain.yml → kalliope/neurons/neurotransmitter/tests/neurotransmitter_test_brain.yml


+ 0 - 0
neurons/openweathermap/README.md → kalliope/neurons/openweathermap/README.md


+ 0 - 0
neurons/openweathermap/__init__.py → kalliope/neurons/openweathermap/__init__.py


+ 1 - 1
neurons/openweathermap/openweathermap.py → kalliope/neurons/openweathermap/openweathermap.py

@@ -1,6 +1,6 @@
 import pyowm
 
-from core.NeuronModule import NeuronModule, MissingParameterException
+from kalliope.core.NeuronModule import NeuronModule, MissingParameterException
 
 
 class Openweathermap(NeuronModule):

+ 0 - 0
neurons/uri/__init__.py → kalliope/neurons/openweathermap/tests/__init__.py


+ 2 - 2
neurons/openweathermap/tests/test_openweathermap.py → kalliope/neurons/openweathermap/tests/test_openweathermap.py

@@ -1,7 +1,7 @@
 import unittest
 
-from core.NeuronModule import MissingParameterException
-from neurons.openweathermap.openweathermap import Openweathermap
+from kalliope.core.NeuronModule import MissingParameterException
+from kalliope.neurons.openweathermap.openweathermap import Openweathermap
 
 
 class TestOpenWeatherMap(unittest.TestCase):

+ 0 - 0
neurons/push_message/Readme.md → kalliope/neurons/push_message/Readme.md


+ 0 - 0
neurons/push_message/__init__.py → kalliope/neurons/push_message/__init__.py


+ 1 - 1
neurons/push_message/push_message.py → kalliope/neurons/push_message/push_message.py

@@ -1,7 +1,7 @@
 from __future__ import absolute_import
 from pushetta import Pushetta
 
-from core.NeuronModule import NeuronModule, MissingParameterException
+from kalliope.core.NeuronModule import NeuronModule, MissingParameterException
 
 
 class Push_message(NeuronModule):

+ 0 - 0
neurons/twitter/tests/__init__.py → kalliope/neurons/push_message/tests/__init__.py


+ 2 - 2
neurons/push_message/tests/test_push_message.py → kalliope/neurons/push_message/tests/test_push_message.py

@@ -1,7 +1,7 @@
 import unittest
 
-from core.NeuronModule import MissingParameterException
-from neurons.push_message.push_message import Push_message
+from kalliope.core.NeuronModule import MissingParameterException
+from kalliope.neurons.push_message.push_message import Push_message
 
 
 class TestPush_Message(unittest.TestCase):

+ 0 - 0
neurons/say/README.md → kalliope/neurons/say/README.md


Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov