Skip to content

Commit

Permalink
Fix plugin loading for newer Python versions
Browse files Browse the repository at this point in the history
  • Loading branch information
nunofachada committed Feb 23, 2025
1 parent 6ac64e1 commit f40a5b4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions egrader/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ def _load_plugin_function(plugin_group: str, plugin_name: str) -> Any:
# Obtain the specified plugin entry point
plugins: EntryPoints = entry_points(group=plugin_group, name=plugin_name)

# If plugin no found, raise error
if len(plugins) == 0:
# If plugin not found, raise error
if plugin_name not in plugins.names:
raise PluginLoadError(
f"Plugin {plugin_name!r} not found in {plugin_group!r} group"
f"Plugin {plugin_name!r} not found in {plugin_group!r} group" # noqa: E713
)

# Otherwise, return plugin function
return plugins[0].load()
return plugins[plugin_name].load()


class PluginLoadError(Exception):
Expand Down

0 comments on commit f40a5b4

Please sign in to comment.