aboutsummaryrefslogtreecommitdiffstats
path: root/bot/seasons/__init__.py
diff options
context:
space:
mode:
authorGravatar kwzrd <[email protected]>2020-03-21 15:34:58 +0100
committerGravatar kwzrd <[email protected]>2020-03-21 15:36:35 +0100
commit5d700cf3b4fabe69010f3e483da7ec1448fde132 (patch)
tree5637306a72a1d23cd75764a633d5e883da63b26b /bot/seasons/__init__.py
parentMerge master into seasonal-purge (diff)
Deseasonify: improve `get_seasons` convenience function
Diffstat (limited to 'bot/seasons/__init__.py')
-rw-r--r--bot/seasons/__init__.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/bot/seasons/__init__.py b/bot/seasons/__init__.py
index f9c89279..8cefd156 100644
--- a/bot/seasons/__init__.py
+++ b/bot/seasons/__init__.py
@@ -14,7 +14,7 @@ __all__ = (
"Pride",
"Valentines",
"Wildcard",
- "get_seasons",
+ "get_season_names",
"get_extensions",
"get_current_season",
"get_season",
@@ -139,13 +139,14 @@ class Wildcard(SeasonBase):
months = {Month.august}
-def get_seasons() -> List[str]:
- """Returns all the Season objects located in /bot/seasons/."""
- seasons = []
+def get_season_names() -> List[str]:
+ """Return names of all packages located in /bot/seasons/."""
+ seasons = [
+ package.name
+ for package in pkgutil.iter_modules(__path__)
+ if package.ispkg
+ ]
- for module in pkgutil.iter_modules([Path("bot/seasons")]):
- if module.ispkg:
- seasons.append(module.name)
return seasons