aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/evergreen/reddit.py
diff options
context:
space:
mode:
authorGravatar decorator-factory <[email protected]>2021-08-07 05:23:03 +0300
committerGravatar Xithrius <[email protected]>2021-08-31 13:08:51 -0700
commit745cd1d6d3d6227d2a1e82cf25611d76221c40cd (patch)
tree6d653668fe1bbfd237b4c87890e0c67a36e2c7f5 /bot/exts/evergreen/reddit.py
parentMerge pull request #835 from python-discord/discord-2.0 (diff)
Fix type annotations
Diffstat (limited to 'bot/exts/evergreen/reddit.py')
-rw-r--r--bot/exts/evergreen/reddit.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/bot/exts/evergreen/reddit.py b/bot/exts/evergreen/reddit.py
index 4df170c6..e6cb5337 100644
--- a/bot/exts/evergreen/reddit.py
+++ b/bot/exts/evergreen/reddit.py
@@ -4,7 +4,7 @@ import random
import textwrap
from collections import namedtuple
from datetime import datetime, timedelta
-from typing import List, Union
+from typing import Union
from aiohttp import BasicAuth, ClientError
from discord import Colour, Embed, TextChannel
@@ -59,7 +59,7 @@ class Reddit(Cog):
"""Get the #reddit channel object from the bot's cache."""
return self.bot.get_channel(Channels.reddit)
- def build_pagination_pages(self, posts: List[dict], paginate: bool) -> Union[List[tuple], str]:
+ def build_pagination_pages(self, posts: list[dict], paginate: bool) -> Union[list[tuple], str]:
"""Build embed pages required for Paginator."""
pages = []
first_page = ""
@@ -180,7 +180,7 @@ class Reddit(Cog):
else:
log.warning(f"Unable to revoke access token: status {response.status}.")
- async def fetch_posts(self, route: str, *, amount: int = 25, params: dict = None) -> List[dict]:
+ async def fetch_posts(self, route: str, *, amount: int = 25, params: dict = None) -> list[dict]:
"""A helper method to fetch a certain amount of Reddit posts at a given route."""
# Reddit's JSON responses only provide 25 posts at most.
if not 25 >= amount > 0:
@@ -213,7 +213,7 @@ class Reddit(Cog):
async def get_top_posts(
self, subreddit: Subreddit, time: str = "all", amount: int = 5, paginate: bool = False
- ) -> Union[Embed, List[tuple]]:
+ ) -> Union[Embed, list[tuple]]:
"""
Get the top amount of posts for a given subreddit within a specified timeframe.