diff options
| -rw-r--r-- | docs/changelog.rst | 1 | ||||
| -rw-r--r-- | pydis_core/utils/_monkey_patches.py | 6 | ||||
| -rw-r--r-- | pydis_core/utils/cooldown.py | 2 | ||||
| -rw-r--r-- | pydis_core/utils/pagination.py | 5 | ||||
| -rw-r--r-- | pydis_core/utils/scheduling.py | 4 | ||||
| -rw-r--r-- | pyproject.toml | 2 | 
6 files changed, 10 insertions, 10 deletions
diff --git a/docs/changelog.rst b/docs/changelog.rst index 505d6251..43088f33 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -9,6 +9,7 @@ Changelog  - :breaking:`208` Drop support for Python 3.10  - :breaking:`208` Drop support for Pydantic 1.X  - :breaking:`207` Enable more ruff linting rules. See :literal-url:`GitHub release notes <https://github.com/python-discord/bot-core/releases/tag/v11.0.0>` for breaking changes. +- :support:`208` Bump ruff to 0.3.0 and target Python 3.11 now that 3.10 isn't supported.  - :support:`206` Bump ruff from 0.1.15 to 0.2.2, using the new lint config namespace, and linting with the new rules.  - :support:`204` Document the instance attributes of :obj:`pydis_core.BotBase`. diff --git a/pydis_core/utils/_monkey_patches.py b/pydis_core/utils/_monkey_patches.py index 2df56039..f17aecce 100644 --- a/pydis_core/utils/_monkey_patches.py +++ b/pydis_core/utils/_monkey_patches.py @@ -1,7 +1,7 @@  """Contains all common monkey patches, used to alter discord to fit our needs."""  import logging -from datetime import datetime, timedelta, timezone +from datetime import UTC, datetime, timedelta  from functools import partial, partialmethod  from discord import Forbidden, http @@ -50,13 +50,13 @@ def _patch_typing() -> None:      async def honeybadger_type(self: http.HTTPClient, channel_id: int) -> None:          nonlocal last_403 -        if last_403 and (datetime.now(tz=timezone.utc) - last_403) < timedelta(minutes=5): +        if last_403 and (datetime.now(tz=UTC) - last_403) < timedelta(minutes=5):              log.warning("Not sending typing event, we got a 403 less than 5 minutes ago.")              return          try:              await original(self, channel_id)          except Forbidden: -            last_403 = datetime.now(tz=timezone.utc) +            last_403 = datetime.now(tz=UTC)              log.warning("Got a 403 from typing event!")      http.HTTPClient.send_typing = honeybadger_type diff --git a/pydis_core/utils/cooldown.py b/pydis_core/utils/cooldown.py index 91b9c5f3..d25d4507 100644 --- a/pydis_core/utils/cooldown.py +++ b/pydis_core/utils/cooldown.py @@ -81,7 +81,7 @@ class _SeparatedArguments:          for item in call_arguments:              try:                  hash(item) -            except TypeError:  # noqa: PERF203 +            except TypeError:                  non_hashable.append(item)              else:                  hashable.append(item) diff --git a/pydis_core/utils/pagination.py b/pydis_core/utils/pagination.py index 1d2b32c3..8282a930 100644 --- a/pydis_core/utils/pagination.py +++ b/pydis_core/utils/pagination.py @@ -1,4 +1,3 @@ -import asyncio  from collections.abc import Sequence  from contextlib import suppress  from functools import partial @@ -267,7 +266,7 @@ class LinePaginator(Paginator):          for line in lines:              try:                  paginator.add_line(line, empty=empty) -            except Exception:  # noqa: PERF203 +            except Exception:                  log.exception(f"Failed to add line to paginator: '{line}'")                  raise  # Should propagate              else: @@ -336,7 +335,7 @@ class LinePaginator(Paginator):                  else:                      reaction, user = await ctx.bot.wait_for("reaction_add", timeout=timeout, check=check)                  log.trace(f"Got reaction: {reaction}") -            except asyncio.TimeoutError: +            except TimeoutError:                  log.debug("Timed out waiting for a reaction")                  break  # We're done, no reactions for the last 5 minutes diff --git a/pydis_core/utils/scheduling.py b/pydis_core/utils/scheduling.py index 621fdd81..a3a5c8a0 100644 --- a/pydis_core/utils/scheduling.py +++ b/pydis_core/utils/scheduling.py @@ -5,7 +5,7 @@ import contextlib  import inspect  import typing  from collections import abc -from datetime import datetime, timezone +from datetime import UTC, datetime  from functools import partial  from discord.errors import Forbidden @@ -103,7 +103,7 @@ class Scheduler:              task_id: A unique ID to create the task with.              coroutine: The function to be called.          """ -        now_datetime = datetime.now(time.tzinfo) if time.tzinfo else datetime.now(tz=timezone.utc) +        now_datetime = datetime.now(time.tzinfo) if time.tzinfo else datetime.now(tz=UTC)          delay = (time - now_datetime).total_seconds()          if delay > 0:              coroutine = self._await_later(delay, task_id, coroutine) diff --git a/pyproject.toml b/pyproject.toml index 23f70e2d..812de4aa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -78,7 +78,7 @@ source_pkgs = ["pydis_core"]  source = ["tests"]  [tool.ruff] -target-version = "py310" +target-version = "py311"  extend-exclude = [".cache"]  output-format = "concise"  line-length = 120  |