From 9c502ce5d6673552084598f7af45d35cc03d0b2d Mon Sep 17 00:00:00 2001 From: Sergio Oliveira Date: Fri, 14 Aug 2015 00:30:02 -0300 Subject: [PATCH] Fixed to only call tasks if fetch_data is not abstract --- colab/plugins/data/base_importer.py | 7 ++++++- colab/plugins/data/tasks.py | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/colab/plugins/data/base_importer.py b/colab/plugins/data/base_importer.py index 443e400..e7d7f07 100644 --- a/colab/plugins/data/base_importer.py +++ b/colab/plugins/data/base_importer.py @@ -11,4 +11,9 @@ class PluginDataImporter(object): @abc.abstractmethod def fetch_data(self): - raise NotImplementedError('fetchData not yet implemented') + raise NotImplementedError + fetch_data.is_abstract = True + + @abc.abstractmethod + def app_label(self): + raise NotImplementedError diff --git a/colab/plugins/data/tasks.py b/colab/plugins/data/tasks.py index cf2ef8a..9c65bdd 100644 --- a/colab/plugins/data/tasks.py +++ b/colab/plugins/data/tasks.py @@ -27,10 +27,10 @@ def register_tasks(): for item_name in dir(module): item = getattr(module, item_name) - if item is PluginDataImporter: - continue if callable(getattr(item, 'fetch_data', None)): + if getattr(item.fetch_data, 'is_abstract', False): + continue instance = item() task_name = '{}.{}'.format(module.__name__, item_name) task = app.task(name=task_name, bind=True)(instance.fetch_data) -- libgit2 0.21.2