Skip to content

Commit

Permalink
Allow plugins to call parent class with any number of input args
Browse files Browse the repository at this point in the history
  • Loading branch information
orviz committed Oct 18, 2024
1 parent d2ae47f commit 00fa1c8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion api/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ class EvaluatorBase(ABC):
lang : Language
"""

def __init__(self, item_id, oai_base=None, lang="en", config=None, name=None):
def __init__(
self, item_id, oai_base=None, lang="en", config=None, name=None, **kwargs
):
self.item_id = item_id
self.oai_base = oai_base
self.lang = lang
Expand Down
2 changes: 1 addition & 1 deletion api/rda.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def wrapper(body, **kwargs):
result = {}
exit_code = 200
for item_id in ids:
eva = plugin.Plugin(item_id, oai_base, lang, config=config_data)
eva = plugin.Plugin(item_id, oai_base, lang, name=repo, config=config_data)
_result, _exit_code = wrapped_func(body, eva=eva)
logger.debug(
"Raw result returned for indicator ID '%s': %s" % (item_id, _result)
Expand Down
5 changes: 3 additions & 2 deletions plugins/epos/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ class Plugin(EvaluatorBase):
"""

def __init__(self, item_id, oai_base=None, lang="en", config=None, name="epos"):
def __init__(self, *args, **kwargs):
super().__init__(
item_id, oai_base=oai_base, lang=lang, config=config, name=name
*args,
**kwargs,
)

self.api_endpoint = self.oai_base
Expand Down

0 comments on commit 00fa1c8

Please sign in to comment.