Skip to content

Commit

Permalink
Merge pull request #88 from Leibniz-HBI/87-fixplugins-pass-in-default…
Browse files Browse the repository at this point in the history
…-configuration-dict-if-no-overriding-values-are-set

fix(plugins): Load default configuration, if nothing else is there.
  • Loading branch information
pekasen authored Sep 10, 2024
2 parents a3714d2 + 3626717 commit 78bd0ee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion spiderexpress/plugin_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Manages access and information about spiderexpress' plug-in system."""

import functools
import importlib.metadata as mt
import sys
Expand Down Expand Up @@ -46,7 +47,9 @@ def _(spec: str, group: str) -> Callable:
plugin = _access_entry_point(spec, group)
if not plugin:
raise ValueError(f"{ spec } could not be found in { group }")
return plugin.callable
return functools.partial(
plugin.callable, configuration=plugin.default_configuration
)


@get_plugin.register(dict)
Expand Down
5 changes: 3 additions & 2 deletions spiderexpress/strategies/snowball.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Snowball sampling strategy."""

from typing import List
from typing import Any, Dict, List, Optional

import pandas as pd

Expand All @@ -11,6 +11,7 @@ def snowball_strategy(
edges: pd.DataFrame,
nodes: pd.DataFrame,
known_nodes: List[str],
configuration: Optional[Dict[str, Any]] = None, # pylint: disable=unused-argument
):
"""Random sampling strategy."""
# split the edges table into edges _inside_ and _outside_ of the known network
Expand All @@ -34,5 +35,5 @@ def snowball_strategy(


snowball = PlugIn(
callable=snowball_strategy, default_configuration=None, metadata={}, tables={}
callable=snowball_strategy, default_configuration={}, metadata={}, tables={}
)

0 comments on commit 78bd0ee

Please sign in to comment.