Skip to content

Commit

Permalink
chore: migrate all TimedCache usages to python commons
Browse files Browse the repository at this point in the history
  • Loading branch information
Skelmis committed Feb 4, 2024
1 parent 3de696f commit c2fceb8
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 299 deletions.
5 changes: 1 addition & 4 deletions suggestions/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from bot_base import BotBase, BotContext, PrefixNotFound

from suggestions import State, Colors, Emojis, ErrorCode, Garven
from suggestions.clunk import Clunk
from suggestions.exceptions import (
BetaOnly,
MissingSuggestionsChannel,
Expand All @@ -49,7 +48,7 @@

class SuggestionsBot(commands.AutoShardedInteractionBot, BotBase):
def __init__(self, *args, **kwargs):
self.version: str = "Public Release 3.20"
self.version: str = "Public Release 3.21"
self.main_guild_id: int = 601219766258106399
self.legacy_beta_role_id: int = 995588041991274547
self.automated_beta_role_id: int = 998173237282361425
Expand All @@ -75,7 +74,6 @@ def __init__(self, *args, **kwargs):
self.state: State = State(self.db, self)
self.stats: Stats = Stats(self)
self.garven: Garven = Garven(self)
self.clunk: Clunk = Clunk(self.state)
self.suggestion_emojis: Emojis = Emojis(self)
self.old_prefixed_commands: set[str] = {
"changelog",
Expand Down Expand Up @@ -595,7 +593,6 @@ async def graceful_shutdown(self) -> None:
"""
log.debug("Attempting to shutdown")
self.state.notify_shutdown()
await self.clunk.kill_all()
await self.zonis.client.close()
await asyncio.gather(*self.state.background_tasks)
log.info("Shutting down")
Expand Down
3 changes: 0 additions & 3 deletions suggestions/clunk/__init__.py

This file was deleted.

25 changes: 0 additions & 25 deletions suggestions/clunk/cache.py

This file was deleted.

32 changes: 0 additions & 32 deletions suggestions/clunk/clunk.py

This file was deleted.

124 changes: 0 additions & 124 deletions suggestions/clunk/lock.py

This file was deleted.

3 changes: 1 addition & 2 deletions suggestions/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
from alaric.logical import AND
from alaric.meta import Negate
from alaric.projections import PROJECTION, SHOW
from bot_base import NonExistentEntry
from bot_base.caches import TimedCache
from commons.caching import NonExistentEntry, TimedCache

from suggestions.objects import GuildConfig, UserConfig

Expand Down
6 changes: 2 additions & 4 deletions suggestions/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
import datetime
import logging
from enum import Enum
from typing import TYPE_CHECKING, Optional, Dict, Literal, Union, Type
from typing import TYPE_CHECKING, Optional, Type

import alaric
from alaric import Cursor, AQ
from alaric.comparison import EQ
from alaric.types import ObjectId
from bot_base.caches import TimedCache
from motor.motor_asyncio import AsyncIOMotorCollection
from commons.caching import TimedCache

from suggestions.objects.stats import MemberStats, MemberCommandStats

Expand Down
12 changes: 0 additions & 12 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import os
from unittest.mock import AsyncMock

import disnake
import pytest

from causar import Causar, InjectionMetadata

import suggestions
from suggestions.clunk import ClunkLock, Clunk
from tests.mocks import MockedSuggestionsMongoManager


Expand Down Expand Up @@ -43,13 +41,3 @@ async def injection_metadata(causar: Causar) -> InjectionMetadata:
return InjectionMetadata(
guild_id=881118111967883295, channel_id=causar.faker.generate_snowflake()
)


@pytest.fixture
async def clunk_lock(causar: Causar) -> ClunkLock:
return ClunkLock(causar.bot.state) # type: ignore


@pytest.fixture
async def clunk(causar: Causar) -> Clunk:
return Clunk(causar.bot.state) # type: ignore
93 changes: 0 additions & 93 deletions tests/test_clunk.py

This file was deleted.

0 comments on commit c2fceb8

Please sign in to comment.