Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/npm/__init__.py
# Copyright (C) 2019 the Software Heritage developers | |||||
# License: GNU General Public License version 3, or any later version | |||||
# See top-level LICENSE file for more information | |||||
from functools import partial | |||||
from swh.lister.core.models import initialize | |||||
def register(): | |||||
from .models import NpmVisitModel as Model | |||||
anlambert: For npm, there is two models to initialize: `swh.lister.npm.models.NpmModel` and `swh.lister. | |||||
douarddaAuthorUnsubmitted Done Inline Actionsthat's typically why I'm not convinced by the 'API' of the plugin loading mechanism here. The true initialization work is in fact done in the 'init' hook, which is a simple function and thus can initialize as many databases/tables as one wants. douardda: that's typically why I'm not convinced by the 'API' of the plugin loading mechanism here. The… | |||||
from .lister import NpmLister as Lister | |||||
return {'model': Model, | |||||
'lister': Lister, | |||||
'tasks': '%s.tasks' % __name__, | |||||
'init': partial(initialize, Model)} |
For npm, there is two models to initialize: swh.lister.npm.models.NpmModel and swh.lister.npm.models.NpmVisitModel