Skip to content

Commit

Permalink
A few things:
Browse files Browse the repository at this point in the history
- Retire ai_generation cog.
 - Move inspire_me command to misc cog.
- Upgrade python-requires, linting checks, and typing checks to >=3.11.
- Change version to CalVer for convenience.
  • Loading branch information
Sachaa-Thanasius committed Apr 15, 2024
1 parent 532de02 commit 33c7286
Show file tree
Hide file tree
Showing 18 changed files with 89 additions and 631 deletions.
6 changes: 2 additions & 4 deletions core/utils/custom_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,15 @@
import logging
from logging.handlers import RotatingFileHandler
from pathlib import Path
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING, Any, Self

from discord.utils import _ColourFormatter as ColourFormatter, stream_supports_colour # type: ignore # Because color.


if TYPE_CHECKING:
from types import TracebackType

from typing_extensions import Self
else:
TracebackType = Self = object
TracebackType = object


__all__ = ("LoggingManager",)
Expand Down
7 changes: 1 addition & 6 deletions core/utils/embeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,11 @@
import itertools
import logging
from collections.abc import Iterable, Sequence
from typing import TYPE_CHECKING, TypeAlias
from typing import Self, TypeAlias

import discord


if TYPE_CHECKING:
from typing_extensions import Self
else:
Self = object

AnyEmoji: TypeAlias = discord.Emoji | discord.PartialEmoji | str


Expand Down
29 changes: 2 additions & 27 deletions core/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,11 @@

import logging
import time
from asyncio import iscoroutinefunction
from collections.abc import Awaitable, Callable, Coroutine
from typing import TYPE_CHECKING, Any, ParamSpec, TypeGuard, TypeVar


if TYPE_CHECKING:
from typing_extensions import Self
else:
Self = object

T = TypeVar("T")
P = ParamSpec("P")
Coro = Coroutine[Any, Any, T]


__all__ = ("catchtime",)


def is_awaitable_func(func: Callable[P, T] | Callable[P, Awaitable[T]]) -> TypeGuard[Callable[P, Awaitable[T]]]:
return iscoroutinefunction(func)


def is_coroutine_func(func: Callable[P, T] | Callable[P, Coro[T]]) -> TypeGuard[Callable[P, Coro[T]]]:
return iscoroutinefunction(func)


def is_not_coroutine_func(func: Callable[P, T] | Callable[P, Coro[T]]) -> TypeGuard[Callable[P, T]]:
return not iscoroutinefunction(func)


class catchtime:
"""A context manager class that times what happens within it.
Expand All @@ -47,10 +22,10 @@ class catchtime:
The logging channel to send the time to, if relevant. Optional.
"""

def __init__(self, logger: logging.Logger | None = None) -> None:
def __init__(self, logger: logging.Logger | None = None):
self.logger = logger

def __enter__(self) -> Self:
def __enter__(self):
self.total_time = time.perf_counter()
return self

Expand Down
7 changes: 1 addition & 6 deletions core/utils/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@
import asyncio
from abc import ABC, abstractmethod
from collections.abc import Sequence
from typing import TYPE_CHECKING, Any, Generic, TypeVar
from typing import Any, Generic, Self, TypeVar

import discord


if TYPE_CHECKING:
from typing_extensions import Self
else:
Self = object

_LT = TypeVar("_LT")


Expand Down
15 changes: 0 additions & 15 deletions exts/ai_generation/__init__.py

This file was deleted.

270 changes: 0 additions & 270 deletions exts/ai_generation/ai_generation.py

This file was deleted.

Loading

0 comments on commit 33c7286

Please sign in to comment.