Skip to content

Commit

Permalink
Move private things in modlog and redbot.core.errors (Cog-Creators#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackenmen authored Jan 26, 2025
1 parent dcdef9d commit 8b1daf1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions redbot/core/_drivers/_mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
pymongo = None

from .. import errors
from .base import BaseDriver, IdentifierData
from .base import BaseDriver, IdentifierData, MissingExtraRequirements

__all__ = ["MongoDriver"]

Expand All @@ -33,7 +33,7 @@ class MongoDriver(BaseDriver):
@classmethod
async def initialize(cls, **storage_details) -> None:
if motor is None:
raise errors.MissingExtraRequirements(
raise MissingExtraRequirements(
"Red must be installed with the [mongo] extra to use the MongoDB driver"
)
uri = storage_details.get("URI", "mongodb")
Expand Down
6 changes: 5 additions & 1 deletion redbot/core/_drivers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@

from redbot.core.utils._internal_utils import RichIndefiniteBarColumn

__all__ = ["BaseDriver", "IdentifierData", "ConfigCategory"]
__all__ = ("BaseDriver", "IdentifierData", "ConfigCategory", "MissingExtraRequirements")


class MissingExtraRequirements(Exception):
"""Raised when an extra requirement is missing but required."""


class ConfigCategory(str, enum.Enum):
Expand Down
4 changes: 2 additions & 2 deletions redbot/core/_drivers/postgres/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
asyncpg = None

from ... import data_manager, errors
from ..base import BaseDriver, IdentifierData, ConfigCategory
from ..base import BaseDriver, IdentifierData, ConfigCategory, MissingExtraRequirements
from ..log import log

__all__ = ["PostgresDriver"]
Expand Down Expand Up @@ -41,7 +41,7 @@ class PostgresDriver(BaseDriver):
@classmethod
async def initialize(cls, **storage_details) -> None:
if asyncpg is None:
raise errors.MissingExtraRequirements(
raise MissingExtraRequirements(
"Red must be installed with the [postgres] extra to use the PostgreSQL driver"
)
cls._pool = await asyncpg.create_pool(**storage_details)
Expand Down
2 changes: 1 addition & 1 deletion redbot/core/core_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2757,7 +2757,7 @@ async def modlogset(self, ctx: commands.Context):
@modlogset.command(hidden=True, name="fixcasetypes")
async def modlogset_fixcasetypes(self, ctx: commands.Context):
"""Command to fix misbehaving casetypes."""
await modlog.handle_auditype_key()
await modlog._handle_audit_type_key()
await ctx.tick()

@modlogset.command(aliases=["channel"], name="modlog")
Expand Down
4 changes: 0 additions & 4 deletions redbot/core/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ class BankPruneError(BankError):
"""Raised when trying to prune a local bank and no server is specified."""


class MissingExtraRequirements(RedError):
"""Raised when an extra requirement is missing but required."""


class ConfigError(RedError):
"""Error in a Config operation."""

Expand Down
4 changes: 2 additions & 2 deletions redbot/core/modlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ async def on_audit_log_entry_create(entry: discord.AuditLogEntry):
bot.add_listener(on_audit_log_entry_create)


async def handle_auditype_key():
async def _handle_audit_type_key():
all_casetypes = {
casetype_name: {
inner_key: inner_value
Expand Down Expand Up @@ -162,7 +162,7 @@ async def _migrate_config(from_version: int, to_version: int):
)

if from_version < 3 <= to_version:
await handle_auditype_key()
await _handle_audit_type_key()
await _config.schema_version.set(3)

if from_version < 4 <= to_version:
Expand Down

0 comments on commit 8b1daf1

Please sign in to comment.