Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plugins): Load default configuration, if nothing else is there. #88

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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={}
)
Loading