|
@@ -4,7 +4,6 @@ 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
|
|
@@ -14,14 +13,14 @@ from core.Models.Synapse import Synapse
|
|
|
logging.basicConfig()
|
|
|
logger = logging.getLogger("kalliope")
|
|
|
|
|
|
-@Singleton
|
|
|
+
|
|
|
class BrainLoader(object):
|
|
|
|
|
|
def __init__(self):
|
|
|
pass
|
|
|
|
|
|
@classmethod
|
|
|
- def _get_yaml_config(cls, file_path=None):
|
|
|
+ def get_yaml_config(cls, file_path=None):
|
|
|
if file_path is None:
|
|
|
brain_file_path = cls._get_root_brain_path()
|
|
|
else:
|
|
@@ -29,18 +28,19 @@ class BrainLoader(object):
|
|
|
return YAMLLoader.get_config(brain_file_path)
|
|
|
|
|
|
@classmethod
|
|
|
- def _get_brain(cls, file_path=None):
|
|
|
+ def get_brain(cls, file_path=None):
|
|
|
"""
|
|
|
return a brain object from YAML settings
|
|
|
:return: Brain object
|
|
|
:rtype: Brain
|
|
|
"""
|
|
|
- # get the brain with dict
|
|
|
- dict_brain = cls._get_yaml_config(file_path)
|
|
|
+
|
|
|
# create a new brain
|
|
|
brain = Brain.Instance()
|
|
|
-
|
|
|
+ logger.debug("Is brain already loaded ? %r" % brain.is_loaded)
|
|
|
if brain.is_loaded is False:
|
|
|
+ # get the brain with dict
|
|
|
+ dict_brain = cls.get_yaml_config(file_path)
|
|
|
|
|
|
brain.brain_yaml = dict_brain
|
|
|
# create list of Synapse
|