diff options
author | 2023-06-25 06:43:45 +0000 | |
---|---|---|
committer | 2023-06-25 06:43:45 +0000 | |
commit | 69be426d6c0018026c5bf764819fd25b8cddcf80 (patch) | |
tree | d58d7aa9eec63489ce7ec87a4fa9f13aabc85b74 | |
parent | Bump pytest from 7.3.2 to 7.4.0 (#2656) (diff) |
Bump ruff from 0.0.272 to 0.0.274 (#2651)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Chris Lovering <[email protected]>
-rw-r--r-- | bot/exts/filtering/filtering.py | 5 | ||||
-rw-r--r-- | bot/exts/info/doc/_html.py | 2 | ||||
-rw-r--r-- | bot/exts/info/help.py | 4 | ||||
-rw-r--r-- | bot/exts/info/information.py | 2 | ||||
-rw-r--r-- | bot/exts/info/source.py | 7 | ||||
-rw-r--r-- | bot/exts/moderation/clean.py | 20 | ||||
-rw-r--r-- | bot/exts/moderation/infraction/management.py | 6 | ||||
-rw-r--r-- | bot/exts/moderation/silence.py | 4 | ||||
-rw-r--r-- | bot/exts/moderation/stream.py | 7 | ||||
-rw-r--r-- | bot/pagination.py | 6 | ||||
-rw-r--r-- | bot/utils/function.py | 2 | ||||
-rw-r--r-- | bot/utils/lock.py | 2 | ||||
-rw-r--r-- | bot/utils/messages.py | 6 | ||||
-rw-r--r-- | poetry.lock | 52 | ||||
-rw-r--r-- | pyproject.toml | 4 |
15 files changed, 76 insertions, 53 deletions
diff --git a/bot/exts/filtering/filtering.py b/bot/exts/filtering/filtering.py index cd6af09a8..d69bd9644 100644 --- a/bot/exts/filtering/filtering.py +++ b/bot/exts/filtering/filtering.py @@ -1402,7 +1402,10 @@ class Filtering(Cog): await self.send_weekly_auto_infraction_report() - async def send_weekly_auto_infraction_report(self, channel: discord.TextChannel | discord.Thread = None) -> None: + async def send_weekly_auto_infraction_report( + self, + channel: discord.TextChannel | discord.Thread | None = None, + ) -> None: """ Send a list of auto-infractions added in the last 7 days to the specified channel. diff --git a/bot/exts/info/doc/_html.py b/bot/exts/info/doc/_html.py index 062d1bb05..2ef1328f1 100644 --- a/bot/exts/info/doc/_html.py +++ b/bot/exts/info/doc/_html.py @@ -50,7 +50,7 @@ def _find_elements_until_tag( *, func: Callable, include_strings: bool = False, - limit: int = None, + limit: int | None = None, ) -> list[Tag | NavigableString]: """ Get all elements up to `limit` or until a tag matching `end_tag_filter` is found. diff --git a/bot/exts/info/help.py b/bot/exts/info/help.py index d4e0a133f..c560d0489 100644 --- a/bot/exts/info/help.py +++ b/bot/exts/info/help.py @@ -159,7 +159,7 @@ class HelpQueryNotFoundError(ValueError): query, where keys are the possible matched command names and values are the likeness match scores. """ - def __init__(self, arg: str, possible_matches: dict = None): + def __init__(self, arg: str, possible_matches: dict | None = None): super().__init__(arg) self.possible_matches = possible_matches @@ -179,7 +179,7 @@ class CustomHelpCommand(HelpCommand): super().__init__(command_attrs={"help": "Shows help for bot commands"}) @redirect_output(destination_channel=Channels.bot_commands, bypass_roles=STAFF_PARTNERS_COMMUNITY_ROLES) - async def command_callback(self, ctx: Context, *, command: str = None) -> None: + async def command_callback(self, ctx: Context, *, command: str | None = None) -> None: """Attempts to match the provided query with a valid command or cog.""" # the only reason we need to tamper with this is because d.py does not support "categories", # so we need to deal with them ourselves. diff --git a/bot/exts/info/information.py b/bot/exts/info/information.py index ab9185867..fe39d86fc 100644 --- a/bot/exts/info/information.py +++ b/bot/exts/info/information.py @@ -238,7 +238,7 @@ class Information(Cog): await ctx.send(embed=embed) @command(name="user", aliases=["user_info", "member", "member_info", "u"]) - async def user_info(self, ctx: Context, user_or_message: MemberOrUser | Message = None) -> None: + async def user_info(self, ctx: Context, user_or_message: MemberOrUser | Message = None) -> None: # noqa: RUF013 """Returns info about a user.""" if passed_as_message := isinstance(user_or_message, Message): user = user_or_message.author diff --git a/bot/exts/info/source.py b/bot/exts/info/source.py index 4514a3d77..a0b2d5535 100644 --- a/bot/exts/info/source.py +++ b/bot/exts/info/source.py @@ -19,7 +19,12 @@ class BotSource(commands.Cog): self.bot = bot @commands.command(name="source", aliases=("src",)) - async def source_command(self, ctx: commands.Context, *, source_item: SourceConverter = None) -> None: + async def source_command( + self, + ctx: commands.Context, + *, + source_item: SourceConverter = None, # noqa: RUF013 + ) -> None: """Display information and a GitHub link to the source code of a command, tag, or cog.""" if not source_item: embed = Embed(title="Bot's GitHub Repository") diff --git a/bot/exts/moderation/clean.py b/bot/exts/moderation/clean.py index 22a38a647..731c52300 100644 --- a/bot/exts/moderation/clean.py +++ b/bot/exts/moderation/clean.py @@ -464,13 +464,13 @@ class Clean(Cog): async def clean_group( self, ctx: Context, - users: Greedy[User] = None, + users: Greedy[User] = None, # noqa: RUF013 first_limit: CleanLimit | None = None, second_limit: CleanLimit | None = None, regex: Regex | None = None, bots_only: bool | None = False, *, - channels: CleanChannels = None # "Optional" with discord.py silently ignores incorrect input. + channels: CleanChannels = None # noqa: RUF013 "Optional" with discord.py silently ignores incorrect input. ) -> None: """ Commands for cleaning messages in channels. @@ -501,7 +501,7 @@ class Clean(Cog): users: Greedy[User], message_or_time: CleanLimit, *, - channels: CleanChannels = None + channels: CleanChannels = None # noqa: RUF013 ) -> None: """ Delete messages posted by the provided users, stop cleaning after reaching `message_or_time`. @@ -517,7 +517,13 @@ class Clean(Cog): await self._clean_messages(ctx, users=users, channels=channels, first_limit=message_or_time) @clean_group.command(name="bots", aliases=["bot"]) - async def clean_bots(self, ctx: Context, message_or_time: CleanLimit, *, channels: CleanChannels = None) -> None: + async def clean_bots( + self, + ctx: Context, + message_or_time: CleanLimit, + *, + channels: CleanChannels = None, # noqa: RUF013 + ) -> None: """ Delete all messages posted by a bot, stop cleaning after reaching `message_or_time`. @@ -538,7 +544,7 @@ class Clean(Cog): regex: Regex, message_or_time: CleanLimit, *, - channels: CleanChannels = None + channels: CleanChannels = None # noqa: RUF013 ) -> None: """ Delete all messages that match a certain regex, stop cleaning after reaching `message_or_time`. @@ -566,7 +572,7 @@ class Clean(Cog): self, ctx: Context, until: CleanLimit, - channel: TextChannel = None + channel: TextChannel = None # noqa: RUF013 ) -> None: """ Delete all messages until a certain limit. @@ -592,7 +598,7 @@ class Clean(Cog): ctx: Context, first_limit: CleanLimit, second_limit: CleanLimit, - channel: TextChannel = None + channel: TextChannel = None # noqa: RUF013 ) -> None: """ Delete all messages within range. diff --git a/bot/exts/moderation/infraction/management.py b/bot/exts/moderation/infraction/management.py index b07745118..9fc0722ce 100644 --- a/bot/exts/moderation/infraction/management.py +++ b/bot/exts/moderation/infraction/management.py @@ -68,7 +68,7 @@ class ModManagement(commands.Cog): return self.bot.get_cog("Infractions") @commands.group(name="infraction", aliases=("infr", "infractions", "inf", "i"), invoke_without_command=True) - async def infraction_group(self, ctx: Context, infraction: Infraction = None) -> None: + async def infraction_group(self, ctx: Context, infraction: Infraction = None) -> None: # noqa: RUF013 """ Infraction management commands. @@ -116,7 +116,7 @@ class ModManagement(commands.Cog): infraction: Infraction, duration: DurationOrExpiry | t.Literal["p", "permanent"] | None, *, - reason: str = None + reason: str = None # noqa: RUF013 ) -> None: """ Append text and/or edit the duration of an infraction. @@ -156,7 +156,7 @@ class ModManagement(commands.Cog): infraction: Infraction, duration: DurationOrExpiry | t.Literal["p", "permanent"] | None, *, - reason: str = None + reason: str = None # noqa: RUF013 ) -> None: """ Edit the duration and/or the reason of an infraction. diff --git a/bot/exts/moderation/silence.py b/bot/exts/moderation/silence.py index 2852598ca..a7151aaa1 100644 --- a/bot/exts/moderation/silence.py +++ b/bot/exts/moderation/silence.py @@ -158,7 +158,7 @@ class Silence(commands.Cog): async def silence( self, ctx: Context, - duration_or_channel: TextOrVoiceChannel | HushDurationConverter = None, + duration_or_channel: TextOrVoiceChannel | HushDurationConverter = None, # noqa: RUF013 duration: HushDurationConverter = 10, *, kick: bool = False @@ -269,7 +269,7 @@ class Silence(commands.Cog): await self.unsilence_timestamps.set(channel.id, unsilence_time.timestamp()) @commands.command(aliases=("unhush",)) - async def unsilence(self, ctx: Context, *, channel: TextOrVoiceChannel = None) -> None: + async def unsilence(self, ctx: Context, *, channel: TextOrVoiceChannel = None) -> None: # noqa: RUF013 """ Unsilence the given channel if given, else the current one. diff --git a/bot/exts/moderation/stream.py b/bot/exts/moderation/stream.py index cb03c00e1..ddfdd0a45 100644 --- a/bot/exts/moderation/stream.py +++ b/bot/exts/moderation/stream.py @@ -85,7 +85,12 @@ class Stream(commands.Cog): @commands.command(aliases=("streaming",)) @commands.has_any_role(*MODERATION_ROLES) - async def stream(self, ctx: commands.Context, member: discord.Member, duration: Expiry = None) -> None: + async def stream( + self, + ctx: commands.Context, + member: discord.Member, + duration: Expiry = None, # noqa: RUF013 + ) -> None: """ Temporarily grant streaming permissions to a member for a given duration. diff --git a/bot/pagination.py b/bot/pagination.py index e0f40add8..fd9dd8af6 100644 --- a/bot/pagination.py +++ b/bot/pagination.py @@ -197,10 +197,10 @@ class LinePaginator(Paginator): max_size: int = 500, scale_to_size: int = 4000, empty: bool = True, - restrict_to_user: User = None, + restrict_to_user: User | None = None, timeout: int = 300, - footer_text: str = None, - url: str = None, + footer_text: str | None = None, + url: str | None = None, exception_on_empty_embed: bool = False, reply: bool = False, ) -> discord.Message | None: diff --git a/bot/utils/function.py b/bot/utils/function.py index 912dfb711..1ca973790 100644 --- a/bot/utils/function.py +++ b/bot/utils/function.py @@ -51,7 +51,7 @@ def get_arg_value(name_or_pos: Argument, arguments: BoundArgs) -> t.Any: def get_arg_value_wrapper( decorator_func: t.Callable[[ArgValGetter], Decorator], name_or_pos: Argument, - func: t.Callable[[t.Any], t.Any] = None, + func: t.Callable[[t.Any], t.Any] | None = None, ) -> Decorator: """ Call `decorator_func` with the value of the arg at the given name/position. diff --git a/bot/utils/lock.py b/bot/utils/lock.py index a5f442b78..2c8420a58 100644 --- a/bot/utils/lock.py +++ b/bot/utils/lock.py @@ -120,7 +120,7 @@ def lock( def lock_arg( namespace: Hashable, name_or_pos: function.Argument, - func: Callable[[Any], _IdCallableReturn] = None, + func: Callable[[Any], _IdCallableReturn] | None = None, *, raise_error: bool = False, wait: bool = False, diff --git a/bot/utils/messages.py b/bot/utils/messages.py index da4a5a300..175d4d4b8 100644 --- a/bot/utils/messages.py +++ b/bot/utils/messages.py @@ -259,7 +259,11 @@ def format_channel(channel: discord.abc.Messageable) -> str: return formatted -async def upload_log(messages: Iterable[Message], actor_id: int, attachments: dict[int, list[str]] = None) -> str: +async def upload_log( + messages: Iterable[Message], + actor_id: int, + attachments: dict[int, list[str]] | None = None, +) -> str: """Upload message logs to the database and return a URL to a page for viewing the logs.""" if attachments is None: attachments = [] diff --git a/poetry.lock b/poetry.lock index ff7764968..512645697 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1204,13 +1204,13 @@ test = ["docutils", "mypy", "pytest-cov", "pytest-pycodestyle", "pytest-runner"] [[package]] name = "platformdirs" -version = "3.6.0" +version = "3.8.0" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." optional = false python-versions = ">=3.7" files = [ - {file = "platformdirs-3.6.0-py3-none-any.whl", hash = "sha256:ffa199e3fbab8365778c4a10e1fbf1b9cd50707de826eb304b50e57ec0cc8d38"}, - {file = "platformdirs-3.6.0.tar.gz", hash = "sha256:57e28820ca8094678b807ff529196506d7a21e17156cb1cddb3e74cebce54640"}, + {file = "platformdirs-3.8.0-py3-none-any.whl", hash = "sha256:ca9ed98ce73076ba72e092b23d3c93ea6c4e186b3f1c3dad6edd98ff6ffcca2e"}, + {file = "platformdirs-3.8.0.tar.gz", hash = "sha256:b0cabcb11063d21a0b261d557acb0a9d2126350e63b70cdf7db6347baea456dc"}, ] [package.extras] @@ -1219,13 +1219,13 @@ test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest- [[package]] name = "pluggy" -version = "1.0.0" +version = "1.2.0" description = "plugin and hook calling mechanisms for python" optional = false -python-versions = ">=3.6" +python-versions = ">=3.7" files = [ - {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, - {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, + {file = "pluggy-1.2.0-py3-none-any.whl", hash = "sha256:c2fd55a7d7a3863cba1a013e4e2414658b1d07b6bc57b3919e0c63c9abb99849"}, + {file = "pluggy-1.2.0.tar.gz", hash = "sha256:d12f0c4b579b15f5e054301bb226ee85eeeba08ffec228092f8defbaa3a4c4b3"}, ] [package.extras] @@ -1880,28 +1880,28 @@ six = "*" [[package]] name = "ruff" -version = "0.0.272" +version = "0.0.275" description = "An extremely fast Python linter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.0.272-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:ae9b57546e118660175d45d264b87e9b4c19405c75b587b6e4d21e6a17bf4fdf"}, - {file = "ruff-0.0.272-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:1609b864a8d7ee75a8c07578bdea0a7db75a144404e75ef3162e0042bfdc100d"}, - {file = "ruff-0.0.272-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ee76b4f05fcfff37bd6ac209d1370520d509ea70b5a637bdf0a04d0c99e13dff"}, - {file = "ruff-0.0.272-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:48eccf225615e106341a641f826b15224b8a4240b84269ead62f0afd6d7e2d95"}, - {file = "ruff-0.0.272-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:677284430ac539bb23421a2b431b4ebc588097ef3ef918d0e0a8d8ed31fea216"}, - {file = "ruff-0.0.272-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:9c4bfb75456a8e1efe14c52fcefb89cfb8f2a0d31ed8d804b82c6cf2dc29c42c"}, - {file = "ruff-0.0.272-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:86bc788245361a8148ff98667da938a01e1606b28a45e50ac977b09d3ad2c538"}, - {file = "ruff-0.0.272-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:27b2ea68d2aa69fff1b20b67636b1e3e22a6a39e476c880da1282c3e4bf6ee5a"}, - {file = "ruff-0.0.272-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bd2bbe337a3f84958f796c77820d55ac2db1e6753f39d1d1baed44e07f13f96d"}, - {file = "ruff-0.0.272-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:d5a208f8ef0e51d4746930589f54f9f92f84bb69a7d15b1de34ce80a7681bc00"}, - {file = "ruff-0.0.272-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:905ff8f3d6206ad56fcd70674453527b9011c8b0dc73ead27618426feff6908e"}, - {file = "ruff-0.0.272-py3-none-musllinux_1_2_i686.whl", hash = "sha256:19643d448f76b1eb8a764719072e9c885968971bfba872e14e7257e08bc2f2b7"}, - {file = "ruff-0.0.272-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:691d72a00a99707a4e0b2846690961157aef7b17b6b884f6b4420a9f25cd39b5"}, - {file = "ruff-0.0.272-py3-none-win32.whl", hash = "sha256:dc406e5d756d932da95f3af082814d2467943631a587339ee65e5a4f4fbe83eb"}, - {file = "ruff-0.0.272-py3-none-win_amd64.whl", hash = "sha256:a37ec80e238ead2969b746d7d1b6b0d31aa799498e9ba4281ab505b93e1f4b28"}, - {file = "ruff-0.0.272-py3-none-win_arm64.whl", hash = "sha256:06b8ee4eb8711ab119db51028dd9f5384b44728c23586424fd6e241a5b9c4a3b"}, - {file = "ruff-0.0.272.tar.gz", hash = "sha256:273a01dc8c3c4fd4c2af7ea7a67c8d39bb09bce466e640dd170034da75d14cab"}, + {file = "ruff-0.0.275-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:5e6554a072e7ce81eb6f0bec1cebd3dcb0e358652c0f4900d7d630d61691e914"}, + {file = "ruff-0.0.275-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:1cc599022fe5ffb143a965b8d659eb64161ab8ab4433d208777eab018a1aab67"}, + {file = "ruff-0.0.275-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5206fc1cd8c1c1deadd2e6360c0dbcd690f1c845da588ca9d32e4a764a402c60"}, + {file = "ruff-0.0.275-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:0c4e6468da26f77b90cae35319d310999f471a8c352998e9b39937a23750149e"}, + {file = "ruff-0.0.275-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0dbdea02942131dbc15dd45f431d152224f15e1dd1859fcd0c0487b658f60f1a"}, + {file = "ruff-0.0.275-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:22efd9f41af27ef8fb9779462c46c35c89134d33e326c889971e10b2eaf50c63"}, + {file = "ruff-0.0.275-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2c09662112cfa22d7467a19252a546291fd0eae4f423e52b75a7a2000a1894db"}, + {file = "ruff-0.0.275-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:80043726662144876a381efaab88841c88e8df8baa69559f96b22d4fa216bef1"}, + {file = "ruff-0.0.275-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5859ee543b01b7eb67835dfd505faa8bb7cc1550f0295c92c1401b45b42be399"}, + {file = "ruff-0.0.275-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:c8ace4d40a57b5ea3c16555f25a6b16bc5d8b2779ae1912ce2633543d4e9b1da"}, + {file = "ruff-0.0.275-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:8347fc16aa185aae275906c4ac5b770e00c896b6a0acd5ba521f158801911998"}, + {file = "ruff-0.0.275-py3-none-musllinux_1_2_i686.whl", hash = "sha256:ec43658c64bfda44fd84bbea9da8c7a3b34f65448192d1c4dd63e9f4e7abfdd4"}, + {file = "ruff-0.0.275-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:508b13f7ca37274cceaba4fb3ea5da6ca192356323d92acf39462337c33ad14e"}, + {file = "ruff-0.0.275-py3-none-win32.whl", hash = "sha256:6afb1c4422f24f361e877937e2a44b3f8176774a476f5e33845ebfe887dd5ec2"}, + {file = "ruff-0.0.275-py3-none-win_amd64.whl", hash = "sha256:d9b264d78621bf7b698b6755d4913ab52c19bd28bee1a16001f954d64c1a1220"}, + {file = "ruff-0.0.275-py3-none-win_arm64.whl", hash = "sha256:a19ce3bea71023eee5f0f089dde4a4272d088d5ac0b675867e074983238ccc65"}, + {file = "ruff-0.0.275.tar.gz", hash = "sha256:a63a0b645da699ae5c758fce19188e901b3033ec54d862d93fcd042addf7f38d"}, ] [[package]] @@ -2221,4 +2221,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "3.11.*" -content-hash = "36e21a1c9cc502e42203f34349fef1a40ae051eac244cf7946749a05d309eac2" +content-hash = "b653e414a4cd6acaab88109fab675c4fcec597e27db24f631811ff25d4df517d" diff --git a/pyproject.toml b/pyproject.toml index a23664635..9dd17d7db 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ pytest = "7.4.0" pytest-cov = "4.1.0" pytest-subtests = "0.11.0" pytest-xdist = "3.3.1" -ruff = "0.0.272" +ruff = "0.0.275" taskipy = "1.11.0" @@ -87,7 +87,7 @@ ignore = [ "D400", "D401", "D402", "D404", "D405", "D406", "D407", "D408", "D409", "D410", "D411", "D412", "D413", "D414", "D416", "D417", "E731", "RET504", - "RUF005", + "RUF005", "RUF012", "S311", "SIM102", "SIM108", ] |