mirror of
https://github.com/caronc/apprise.git
synced 2025-08-13 18:17:12 +02:00
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:
@ -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'])
|
||||
|
Reference in New Issue
Block a user