plugins: dependencies are not required

What, exactly, are you going to do?
This commit is contained in:
dece 2022-11-28 23:29:22 +01:00
parent b19dd155b2
commit 1bef65ea73
9 changed files with 8 additions and 54 deletions

View file

@ -146,10 +146,6 @@ class Bot(irc.client.SimpleIRCClient, Logger):
)
for plugin_name in plugin_names:
module = importlib.import_module(f"edmond.plugins.{plugin_name}")
are_dependencies_ok = getattr(module, "DEPENDENCIES_FOUND", True)
if not are_dependencies_ok:
self.log_e(f"Dependencies not found for plugin {plugin_name}.")
continue
# Get plugin class name from its module name.
class_name = (
"".join(map(lambda w: w.capitalize(), plugin_name.split("_")))

View file

@ -1,12 +1,7 @@
import datetime
from typing import cast
# BS is optional and only for scrapping journee-mondiale.com, thus why we do not
# mark the dependencies flag here.
try:
from bs4 import BeautifulSoup
except ImportError:
BeautifulSoup = None
from bs4 import BeautifulSoup
from edmond.plugin import Plugin
from edmond.plugins.plus import PlusPlugin

View file

@ -1,11 +1,6 @@
import time
try:
import meteofrance_api as mf
DEPENDENCIES_FOUND = True
except ImportError:
DEPENDENCIES_FOUND = False
import meteofrance_api as mf
from edmond.plugin import Plugin

View file

@ -1,11 +1,6 @@
import random
try:
from scaruffi.api import ScaruffiApi
DEPENDENCIES_FOUND = True
except ImportError:
DEPENDENCIES_FOUND = False
from scaruffi.api import ScaruffiApi
from edmond.plugin import Plugin

View file

@ -1,9 +1,4 @@
try:
from translate import Translator
DEPENDENCIES_FOUND = True
except ImportError:
DEPENDENCIES_FOUND = False
from translate import Translator
from edmond.plugin import Plugin

View file

@ -1,10 +1,3 @@
try:
import wolframalpha
DEPENDENCIES_FOUND = True
except ImportError:
DEPENDENCIES_FOUND = False
from edmond.plugin import Plugin

View file

@ -1,12 +1,7 @@
import time
from typing import cast
try:
import wikipedia
DEPENDENCIES_FOUND = True
except ImportError:
DEPENDENCIES_FOUND = False
import wikipedia
from edmond.plugin import Plugin
from edmond.plugins.plus import PlusPlugin

View file

@ -1,12 +1,7 @@
from typing import cast, Optional
try:
from googleapiclient.discovery import build as gapi_discovery_build
from googleapiclient.errors import Error as GoogleApiError
DEPENDENCIES_FOUND = True
except ImportError:
DEPENDENCIES_FOUND = False
from googleapiclient.discovery import build as gapi_discovery_build
from googleapiclient.errors import Error as GoogleApiError
from edmond.plugin import Plugin
from edmond.plugins.playlist_of_the_day import PlaylistOfTheDayPlugin

View file

@ -1,12 +1,7 @@
import re
from typing import cast, Optional
try:
from googleapiclient.errors import Error as GoogleApiError # type: ignore
DEPENDENCIES_FOUND = True
except ImportError:
DEPENDENCIES_FOUND = False
from googleapiclient.errors import Error as GoogleApiError # type: ignore
from edmond.plugin import Plugin
from edmond.plugins.playlist_of_the_day import PlaylistOfTheDayPlugin