diff options
author | 2019-09-19 06:02:07 -0700 | |
---|---|---|
committer | 2019-09-19 06:02:07 -0700 | |
commit | 67c84ade355802e00691f6fea712711bf41e5892 (patch) | |
tree | 5870084dcf17b9b6636bb5772c17b74f26ba6c3b | |
parent | Update paginator defs for correct Optional return (diff) |
Use Optional typing shorthand rather than Union w/None
-rw-r--r-- | bot/cogs/bot.py | 4 | ||||
-rw-r--r-- | bot/cogs/eval.py | 4 | ||||
-rw-r--r-- | bot/cogs/security.py | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/bot/cogs/bot.py b/bot/cogs/bot.py index 585be5a42..7be04693c 100644 --- a/bot/cogs/bot.py +++ b/bot/cogs/bot.py @@ -2,7 +2,7 @@ import ast import logging import re import time -from typing import Optional, Tuple, Union +from typing import Optional, Tuple from discord import Embed, Message, RawMessageUpdateEvent from discord.ext.commands import Bot, Cog, Context, command, group @@ -82,7 +82,7 @@ class Bot(Cog): embed = Embed(description=text) await ctx.send(embed=embed) - def codeblock_stripping(self, msg: str, bad_ticks: bool) -> Union[Tuple[Tuple[str, Optional[str]], str], None]: + def codeblock_stripping(self, msg: str, bad_ticks: bool) -> Optional[Tuple[Tuple[str, Optional[str]], str]]: """ Strip msg in order to find Python code. diff --git a/bot/cogs/eval.py b/bot/cogs/eval.py index 578a494e7..2ae543d83 100644 --- a/bot/cogs/eval.py +++ b/bot/cogs/eval.py @@ -6,7 +6,7 @@ import re import textwrap import traceback from io import StringIO -from typing import Any, Tuple, Union +from typing import Any, Optional, Tuple import discord from discord.ext.commands import Bot, Cog, group @@ -29,7 +29,7 @@ class CodeEval(Cog): self.interpreter = Interpreter(bot) - def _format(self, inp: str, out: Any) -> Tuple[str, Union[discord.embed, None]]: + def _format(self, inp: str, out: Any) -> Tuple[str, Optional[discord.embed]]: """Format the eval output into a string & attempt to format it into an Embed.""" self._ = out diff --git a/bot/cogs/security.py b/bot/cogs/security.py index c2c6356d3..a04c18289 100644 --- a/bot/cogs/security.py +++ b/bot/cogs/security.py @@ -1,5 +1,5 @@ import logging -from typing import Union +from typing import Optional from discord.ext.commands import Bot, Cog, Context, NoPrivateMessage @@ -18,7 +18,7 @@ class Security(Cog): """Check if Context instance author is not a bot.""" return not ctx.author.bot - def check_on_guild(self, ctx: Context) -> Union[bool, None]: + def check_on_guild(self, ctx: Context) -> Optional[bool]: """Check if Context instance has a guild attribute.""" if ctx.guild is None: raise NoPrivateMessage("This command cannot be used in private messages.") |