From 9b0be1ca2b1f8d0efaf9f5acdecaaa2e25faf629 Mon Sep 17 00:00:00 2001 From: nicoco Date: Thu, 23 Feb 2023 06:32:17 +0100 Subject: [PATCH] stop misusing __all__ for default plugin list this fixes tests by renaming the list of default plugins from __all__ (which has a special meaning) to a separate list called PLUGINS no need to put BasePlugin in __all__ after all if we don't use __all__ at all --- slixmpp/basexmpp.py | 4 ++-- slixmpp/plugins/__init__.py | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/slixmpp/basexmpp.py b/slixmpp/basexmpp.py index c54ec63a..c0da516f 100644 --- a/slixmpp/basexmpp.py +++ b/slixmpp/basexmpp.py @@ -279,10 +279,10 @@ class BaseXMPP(XMLStream): if self.plugin_whitelist: plugin_list = self.plugin_whitelist else: - plugin_list = plugins.__all__ + plugin_list = plugins.PLUGINS for plugin in plugin_list: - if plugin in plugins.__all__: + if plugin in plugins.PLUGINS: self.register_plugin(plugin) else: raise NameError("Plugin %s not in plugins.__all__." % plugin) diff --git a/slixmpp/plugins/__init__.py b/slixmpp/plugins/__init__.py index 232f0584..206ac5a7 100644 --- a/slixmpp/plugins/__init__.py +++ b/slixmpp/plugins/__init__.py @@ -6,7 +6,7 @@ from slixmpp.plugins.base import PluginManager, PluginNotFound, BasePlugin from slixmpp.plugins.base import register_plugin, load_plugin -__all__ = [ +PLUGINS = [ # XEPS 'xep_0004', # Data Forms 'xep_0009', # Jabber-RPC @@ -116,5 +116,12 @@ __all__ = [ 'xep_0444', # Message Reactions 'xep_0461', # Message Replies # Meant to be imported by plugins - 'BasePlugin' +] + +__all__ = PLUGINS + [ + 'PluginManager', + 'PluginNotFound', + 'BasePlugin', + 'register_plugin', + 'load_plugin', ]