Improved type-hinting for loggers and removed legacy

This commit is contained in:
kku 2024-12-27 22:23:41 +01:00
parent 7a64e334d2
commit ce57755eee
6 changed files with 12 additions and 11 deletions

View File

@ -1,4 +1,5 @@
import logging import logging
from logging import Logger
from typing import Any, Dict from typing import Any, Dict
from bson import ObjectId from bson import ObjectId
@ -8,7 +9,7 @@ from libbot.utils import config_get
from errors import UserNotFoundError from errors import UserNotFoundError
from modules.database import col_warnings, sync_col_users, sync_col_warnings, col_users from modules.database import col_warnings, sync_col_users, sync_col_warnings, col_users
logger = logging.getLogger(__name__) logger: Logger = logging.getLogger(__name__)
class HoloUser: class HoloUser:
@ -123,8 +124,3 @@ class HoloUser:
return True return True
return False return False
# def purge(self) -> None:
# """Completely remove data from database. Will not remove transactions logs and warnings."""
# col_users.delete_one(filter={"_id": self.db_id})
# self.unauthorize()

View File

@ -1,5 +1,6 @@
import logging import logging
import sys import sys
from logging import Logger
from discord import ( from discord import (
ApplicationContext, ApplicationContext,
@ -20,7 +21,7 @@ from modules.scheduler import scheduler
from modules.utils_sync import guild_name from modules.utils_sync import guild_name
from modules.waifu_pics import waifu_pics from modules.waifu_pics import waifu_pics
logger = logging.getLogger(__name__) logger: Logger = logging.getLogger(__name__)
class Admin(commands.Cog): class Admin(commands.Cog):

View File

@ -1,4 +1,5 @@
import logging import logging
from logging import Logger
from typing import Dict, List, Any from typing import Dict, List, Any
from discord import Cog, Message from discord import Cog, Message
@ -7,7 +8,7 @@ from discord.ext import commands
from classes.holo_bot import HoloBot from classes.holo_bot import HoloBot
from modules.database import col_analytics from modules.database import col_analytics
logger = logging.getLogger(__name__) logger: Logger = logging.getLogger(__name__)
class Analytics(commands.Cog): class Analytics(commands.Cog):

View File

@ -1,4 +1,5 @@
import logging import logging
from logging import Logger
from typing import Any, Dict from typing import Any, Dict
from discord import ApplicationContext, Embed, option, TextChannel, Role from discord import ApplicationContext, Embed, option, TextChannel, Role
@ -14,7 +15,7 @@ from enums import Color
from modules.database import col_users from modules.database import col_users
from modules.utils_sync import guild_name from modules.utils_sync import guild_name
logger = logging.getLogger(__name__) logger: Logger = logging.getLogger(__name__)
class CustomChannels(commands.Cog): class CustomChannels(commands.Cog):

View File

@ -1,4 +1,5 @@
import logging import logging
from logging import Logger
from discord import ApplicationContext, Embed, User, option, slash_command from discord import ApplicationContext, Embed, User, option, slash_command
from discord.ext import commands from discord.ext import commands
@ -8,7 +9,7 @@ from classes.holo_bot import HoloBot
from modules.utils_sync import guild_name from modules.utils_sync import guild_name
from modules.waifu_pics import waifu_pics from modules.waifu_pics import waifu_pics
logger = logging.getLogger(__name__) logger: Logger = logging.getLogger(__name__)
class Fun(commands.Cog): class Fun(commands.Cog):

View File

@ -1,4 +1,5 @@
import logging import logging
from logging import Logger
from typing import Dict, Any from typing import Dict, Any
from discord import Member, Message, TextChannel, MessageType from discord import Member, Message, TextChannel, MessageType
@ -9,7 +10,7 @@ from libbot.utils import config_get
from classes.holo_bot import HoloBot from classes.holo_bot import HoloBot
from modules.database import col_users from modules.database import col_users
logger = logging.getLogger(__name__) logger: Logger = logging.getLogger(__name__)
class Logger(commands.Cog): class Logger(commands.Cog):