From f59aa18c2dee0b16700bfb44a49ba33477e222fa Mon Sep 17 00:00:00 2001 From: Johannes Koester Date: Tue, 23 Jan 2024 10:32:55 +0100 Subject: [PATCH] fix: properly handle tagged storage if only default settings are provided --- snakemake_interface_common/exceptions.py | 2 +- snakemake_interface_common/plugin_registry/plugin.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/snakemake_interface_common/exceptions.py b/snakemake_interface_common/exceptions.py index 8d52ec3..2d9260c 100644 --- a/snakemake_interface_common/exceptions.py +++ b/snakemake_interface_common/exceptions.py @@ -67,4 +67,4 @@ def _get_spec(cls, exc): class InvalidPluginException(ApiError): def __init__(self, plugin_name: str, message: str): - super().__init__(f"Snakemake plugin {plugin_name} is invalid: {message}") + super().__init__(f"Error loading Snakemake plugin {plugin_name}: {message}") diff --git a/snakemake_interface_common/plugin_registry/plugin.py b/snakemake_interface_common/plugin_registry/plugin.py index 57893e1..f52b3b6 100644 --- a/snakemake_interface_common/plugin_registry/plugin.py +++ b/snakemake_interface_common/plugin_registry/plugin.py @@ -40,7 +40,11 @@ def register_settings(self, settings: SettingsBase, tag: Optional[str] = None): self._inner[tag] = settings def get_settings(self, tag: Optional[str] = None) -> Optional[SettingsBase]: - return self._inner.get(tag) + settings = self._inner.get(tag) + if tag is not None and settings is None: + # no settings specifically for this tag, just use untagged defaults + settings = self._inner.get(None) + return settings def get_field_settings(self, field_name: str) -> Dict[str, Sequence[Any]]: """Return a dictionary of tag -> value for the given field name."""