1
0
mirror of https://github.com/gsi-upm/senpy synced 2025-09-18 04:22:21 +00:00

Converted Ekman2VAD to centroids

* Changed the way modules are imported -> we can now use dotted
  notation (e.g. senpy.plugins.conversion.centroids)
* Refactored ekman2vad's plugin -> generic centroids
* Added some basic tests
This commit is contained in:
J. Fernando Sánchez
2017-02-28 04:28:54 +01:00
parent 453b9f3257
commit d8b59d06a4
7 changed files with 72 additions and 69 deletions

View File

@@ -17,7 +17,7 @@ import copy
import fnmatch
import inspect
import sys
import imp
import importlib
import logging
import traceback
import yaml
@@ -181,7 +181,7 @@ class Senpy(object):
newentries = []
for i in resp.entries:
if output == "full":
newemotions = copy.copy(i.emotions)
newemotions = copy.deepcopy(i.emotions)
else:
newemotions = []
for j in i.emotions:
@@ -303,6 +303,13 @@ class Senpy(object):
logger.info('Installing requirements: ' + str(requirements))
pip.main(pip_args)
@classmethod
def _load_module(cls, name, root):
sys.path.append(root)
tmp = importlib.import_module(name)
sys.path.remove(root)
return tmp
@classmethod
def _load_plugin_from_info(cls, info, root):
if not cls.validate_info(info):
@@ -310,11 +317,10 @@ class Senpy(object):
return None, None
module = info["module"]
name = info["name"]
sys.path.append(root)
(fp, pathname, desc) = imp.find_module(module, [root, ])
cls._install_deps(info)
tmp = imp.load_module(module, fp, pathname, desc)
sys.path.remove(root)
tmp = cls._load_module(module, root)
candidate = None
for _, obj in inspect.getmembers(tmp):
if inspect.isclass(obj) and inspect.getmodule(obj) == tmp: