diff options
-rw-r--r-- | bot/seasons/__init__.py | 19 | ||||
-rw-r--r-- | bot/seasons/season.py | 10 | ||||
-rw-r--r-- | bot/utils/persist.py | 2 |
3 files changed, 16 insertions, 15 deletions
diff --git a/bot/seasons/__init__.py b/bot/seasons/__init__.py index ffbf8add..4f091116 100644 --- a/bot/seasons/__init__.py +++ b/bot/seasons/__init__.py @@ -1,9 +1,20 @@ import logging +import pkgutil +from pathlib import Path +from typing import List -from discord.ext import commands +from bot.seasons.season import SeasonBase -from bot.seasons.season import SeasonBase, get_season - -__all__ = ("SeasonBase", "get_season") +__all__ = ("SeasonBase", "get_seasons") log = logging.getLogger(__name__) + + +def get_seasons() -> List[str]: + """Returns all the Season objects located in /bot/seasons/.""" + seasons = [] + + for module in pkgutil.iter_modules([Path("bot/seasons")]): + if module.ispkg: + seasons.append(module.name) + return seasons diff --git a/bot/seasons/season.py b/bot/seasons/season.py index c5009d6b..cc2c1251 100644 --- a/bot/seasons/season.py +++ b/bot/seasons/season.py @@ -19,16 +19,6 @@ log = logging.getLogger(__name__) ICON_BASE_URL = "https://raw.githubusercontent.com/python-discord/branding/master" -def get_seasons() -> List[str]: - """Returns all the Season objects located in /bot/seasons/.""" - seasons = [] - - for module in pkgutil.iter_modules([Path("bot/seasons")]): - if module.ispkg: - seasons.append(module.name) - return seasons - - class SeasonBase: """Base class for Seasonal classes.""" diff --git a/bot/utils/persist.py b/bot/utils/persist.py index a60a1219..3539375a 100644 --- a/bot/utils/persist.py +++ b/bot/utils/persist.py @@ -2,7 +2,7 @@ import sqlite3 from pathlib import Path from shutil import copyfile -from bot.seasons.season import get_seasons +from bot.seasons import get_seasons DIRECTORY = Path("data") # directory that has a persistent volume mapped to it |