From 17225a1b39dfbee8be286d11f713ed220777d6e2 Mon Sep 17 00:00:00 2001 From: novirium Date: Thu, 27 Feb 2020 20:52:57 +0800 Subject: [PATCH] Tidy up dict iter access --- shepherd/agent/plugin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shepherd/agent/plugin.py b/shepherd/agent/plugin.py index 3fa8298..1a218b2 100644 --- a/shepherd/agent/plugin.py +++ b/shepherd/agent/plugin.py @@ -296,7 +296,7 @@ def load_plugin(plugin_name, plugin_dir=None): # Scan module for load markers left by decorators - for name, attr in module.__dict__.items(): + for attr in module.__dict__.values(): if hasattr(attr, "_shepherd_load_marker"): if isinstance(attr._shepherd_load_marker, FunctionMarker): interface.register_function(attr, **attr._shepherd_load_marker._asdict()) @@ -305,7 +305,7 @@ def load_plugin(plugin_name, plugin_dir=None): if interface._plugin_class is not None: # Scan plugin class for marked methods - for name, attr in interface._plugin_class.__dict__.items(): + for attr in interface._plugin_class.__dict__.values(): if hasattr(attr, "_shepherd_load_marker"): if isinstance(attr._shepherd_load_marker, FunctionMarker): # Instance doesn't exist yet, so need to save unbound methods for binding later @@ -339,7 +339,7 @@ def init_plugins(plugin_configs, core_config): # If it has one, instantiate the plugin object and bind functions if interface._plugin_class is not None: interface._plugin_obj = interface._plugin_class() - for funcname, ifunc in interface._functions.items(): + for ifunc in interface._functions.values(): if ifunc._unbound: ifunc._bind(interface._plugin_obj)