Resolve ambiguity with apprise.plugins module namespace

While the namespace is physically made of modules, it has been amended
to be the namespace home for the corresponding notifier classes as well.

This turned out to confuse both humans and machines on various ends.

While it has apparently worked for a while, it croaks on Python 3.11
now, and is not considered to have been a good idea in general.
This commit is contained in:
Andreas Motl
2022-10-09 11:28:18 +02:00
parent c797d1e2eb
commit c9f0751b61
88 changed files with 1721 additions and 1688 deletions

View File

@ -23,16 +23,14 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
import re
import os
import sys
from importlib import reload
def module_reload(filename):
def reload_plugin(name):
"""
Reload builtin plugin module, e.g. `NotifyGnome`.
set filename to plugin to be reloaded (for example NotifyGnome.py)
The following libraries need to be reloaded to prevent
@ -44,13 +42,13 @@ def module_reload(filename):
"""
module_name = 'apprise.plugins.{}'.format(
re.match(r'^(.+)(\.py)?$', os.path.basename(filename), re.I).group(1))
module_name = f"apprise.plugins.{name}"
reload(sys.modules['apprise.common'])
reload(sys.modules['apprise.attachment'])
reload(sys.modules['apprise.config'])
reload(sys.modules[module_name])
if module_name in sys.modules:
reload(sys.modules[module_name])
reload(sys.modules['apprise.plugins'])
reload(sys.modules['apprise.Apprise'])
reload(sys.modules['apprise.utils'])