fix isort

This commit is contained in:
2026-02-01 23:04:32 +03:00
parent f8962225ee
commit 9a6ab9a045
44 changed files with 207 additions and 416 deletions

View File

@@ -4,7 +4,8 @@ from unittest.mock import AsyncMock, MagicMock, Mock, mock_open, patch
import pytest
from helper_bot.handlers.voice.exceptions import DatabaseError, FileOperationError
from helper_bot.handlers.voice.exceptions import (DatabaseError,
FileOperationError)
from helper_bot.handlers.voice.services import AudioFileService

View File

@@ -4,10 +4,8 @@ from unittest.mock import AsyncMock, Mock, patch
import pytest
from helper_bot.utils.auto_unban_scheduler import (
AutoUnbanScheduler,
get_auto_unban_scheduler,
)
from helper_bot.utils.auto_unban_scheduler import (AutoUnbanScheduler,
get_auto_unban_scheduler)
class TestAutoUnbanScheduler:

View File

@@ -5,9 +5,8 @@ from unittest.mock import AsyncMock, Mock, patch
import pytest
from database.models import BlacklistHistoryRecord
from database.repositories.blacklist_history_repository import (
BlacklistHistoryRepository,
)
from database.repositories.blacklist_history_repository import \
BlacklistHistoryRepository
class TestBlacklistHistoryRepository:

View File

@@ -5,9 +5,7 @@ from unittest.mock import AsyncMock, MagicMock, Mock, patch
import pytest
from helper_bot.handlers.callback.callback_handlers import (
delete_voice_message,
save_voice_message,
)
delete_voice_message, save_voice_message)
from helper_bot.handlers.voice.constants import CALLBACK_DELETE, CALLBACK_SAVE

View File

@@ -10,11 +10,8 @@ import pytest
from aiogram import types
from helper_bot.utils.helper_func import (
add_in_db_media,
add_in_db_media_mediagroup,
download_file,
send_media_group_message_to_private_chat,
)
add_in_db_media, add_in_db_media_mediagroup, download_file,
send_media_group_message_to_private_chat)
class TestDownloadFile:

View File

@@ -1,22 +1,16 @@
from unittest.mock import AsyncMock, Mock, patch
import pytest
from aiogram.types import (
InlineKeyboardButton,
InlineKeyboardMarkup,
KeyboardButton,
ReplyKeyboardMarkup,
)
from aiogram.types import (InlineKeyboardButton, InlineKeyboardMarkup,
KeyboardButton, ReplyKeyboardMarkup)
from database.async_db import AsyncBotDB
from helper_bot.filters.main import ChatTypeFilter
from helper_bot.keyboards.keyboards import (
create_keyboard_with_pagination,
get_reply_keyboard,
get_reply_keyboard_admin,
get_reply_keyboard_for_post,
get_reply_keyboard_leave_chat,
)
from helper_bot.keyboards.keyboards import (create_keyboard_with_pagination,
get_reply_keyboard,
get_reply_keyboard_admin,
get_reply_keyboard_for_post,
get_reply_keyboard_leave_chat)
class TestKeyboards:

View File

@@ -8,20 +8,15 @@ from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from helper_bot.config.rate_limit_config import RateLimitSettings, get_rate_limit_config
from helper_bot.utils.rate_limit_monitor import (
RateLimitMonitor,
RateLimitStats,
record_rate_limit_request,
)
from helper_bot.utils.rate_limiter import (
ChatRateLimiter,
GlobalRateLimiter,
RateLimitConfig,
RetryHandler,
TelegramRateLimiter,
send_with_rate_limit,
)
from helper_bot.config.rate_limit_config import (RateLimitSettings,
get_rate_limit_config)
from helper_bot.utils.rate_limit_monitor import (RateLimitMonitor,
RateLimitStats,
record_rate_limit_request)
from helper_bot.utils.rate_limiter import (ChatRateLimiter, GlobalRateLimiter,
RateLimitConfig, RetryHandler,
TelegramRateLimiter,
send_with_rate_limit)
class TestRateLimitConfig:

View File

@@ -4,11 +4,9 @@ import pytest
from aiogram import types
from aiogram.fsm.context import FSMContext
from helper_bot.handlers.admin.exceptions import (
InvalidInputError,
UserAlreadyBannedError,
UserNotFoundError,
)
from helper_bot.handlers.admin.exceptions import (InvalidInputError,
UserAlreadyBannedError,
UserNotFoundError)
from helper_bot.handlers.admin.services import AdminService, BannedUser, User

View File

@@ -7,14 +7,10 @@ from aiogram import types
from aiogram.fsm.context import FSMContext
from helper_bot.handlers.group.constants import ERROR_MESSAGES, FSM_STATES
from helper_bot.handlers.group.exceptions import (
NoReplyToMessageError,
UserNotFoundError,
)
from helper_bot.handlers.group.group_handlers import (
GroupHandlers,
create_group_handlers,
)
from helper_bot.handlers.group.exceptions import (NoReplyToMessageError,
UserNotFoundError)
from helper_bot.handlers.group.group_handlers import (GroupHandlers,
create_group_handlers)
from helper_bot.handlers.group.services import AdminReplyService

View File

@@ -8,9 +8,7 @@ from aiogram.fsm.context import FSMContext
from helper_bot.handlers.private.constants import BUTTON_TEXTS, FSM_STATES
from helper_bot.handlers.private.private_handlers import (
PrivateHandlers,
create_private_handlers,
)
PrivateHandlers, create_private_handlers)
from helper_bot.handlers.private.services import BotSettings

View File

@@ -6,37 +6,18 @@ import pytest
import helper_bot.utils.messages as messages # Import for patching constants
from database.async_db import AsyncBotDB
from helper_bot.utils.base_dependency_factory import (
BaseDependencyFactory,
get_global_instance,
)
from helper_bot.utils.base_dependency_factory import (BaseDependencyFactory,
get_global_instance)
from helper_bot.utils.helper_func import (
add_days_to_date,
add_in_db_media,
add_in_db_media_mediagroup,
check_access,
check_user_emoji,
check_username_and_full_name,
delete_user_blacklist,
determine_anonymity,
download_file,
get_banned_users_buttons,
get_banned_users_list,
get_first_name,
get_random_emoji,
get_text_message,
prepare_media_group_from_middlewares,
safe_html_escape,
send_audio_message,
send_media_group_message_to_private_chat,
send_media_group_to_channel,
send_photo_message,
send_text_message,
send_video_message,
send_video_note_message,
send_voice_message,
update_user_info,
)
add_days_to_date, add_in_db_media, add_in_db_media_mediagroup,
check_access, check_user_emoji, check_username_and_full_name,
delete_user_blacklist, determine_anonymity, download_file,
get_banned_users_buttons, get_banned_users_list, get_first_name,
get_random_emoji, get_text_message, prepare_media_group_from_middlewares,
safe_html_escape, send_audio_message,
send_media_group_message_to_private_chat, send_media_group_to_channel,
send_photo_message, send_text_message, send_video_message,
send_video_note_message, send_voice_message, update_user_info)
from helper_bot.utils.messages import get_message

View File

@@ -4,13 +4,12 @@ from unittest.mock import AsyncMock, Mock, patch
import pytest
from helper_bot.handlers.voice.exceptions import AudioProcessingError, VoiceMessageError
from helper_bot.handlers.voice.exceptions import (AudioProcessingError,
VoiceMessageError)
from helper_bot.handlers.voice.services import VoiceBotService
from helper_bot.handlers.voice.utils import (
get_last_message_text,
get_user_emoji_safe,
validate_voice_message,
)
from helper_bot.handlers.voice.utils import (get_last_message_text,
get_user_emoji_safe,
validate_voice_message)
class TestVoiceBotService:

View File

@@ -1,22 +1,15 @@
import pytest
from helper_bot.handlers.voice.constants import (
BTN_LISTEN,
BTN_SPEAK,
BUTTON_COMMAND_MAPPING,
CALLBACK_COMMAND_MAPPING,
CALLBACK_DELETE,
CALLBACK_SAVE,
CMD_EMOJI,
CMD_HELP,
CMD_REFRESH,
CMD_RESTART,
CMD_START,
COMMAND_MAPPING,
STATE_STANDUP_WRITE,
STATE_START,
VOICE_BOT_NAME,
)
from helper_bot.handlers.voice.constants import (BTN_LISTEN, BTN_SPEAK,
BUTTON_COMMAND_MAPPING,
CALLBACK_COMMAND_MAPPING,
CALLBACK_DELETE,
CALLBACK_SAVE, CMD_EMOJI,
CMD_HELP, CMD_REFRESH,
CMD_RESTART, CMD_START,
COMMAND_MAPPING,
STATE_STANDUP_WRITE,
STATE_START, VOICE_BOT_NAME)
class TestVoiceConstants:

View File

@@ -1,10 +1,8 @@
import pytest
from helper_bot.handlers.voice.exceptions import (
AudioProcessingError,
VoiceBotError,
VoiceMessageError,
)
from helper_bot.handlers.voice.exceptions import (AudioProcessingError,
VoiceBotError,
VoiceMessageError)
class TestVoiceExceptions:

View File

@@ -4,7 +4,8 @@ import pytest
from aiogram import types
from aiogram.fsm.context import FSMContext
from helper_bot.handlers.voice.constants import STATE_STANDUP_WRITE, STATE_START
from helper_bot.handlers.voice.constants import (STATE_STANDUP_WRITE,
STATE_START)
from helper_bot.handlers.voice.voice_handler import VoiceHandlers

View File

@@ -4,7 +4,8 @@ from unittest.mock import AsyncMock, MagicMock, Mock, patch
import pytest
from helper_bot.handlers.voice.exceptions import AudioProcessingError, VoiceMessageError
from helper_bot.handlers.voice.exceptions import (AudioProcessingError,
VoiceMessageError)
from helper_bot.handlers.voice.services import VoiceBotService

View File

@@ -4,13 +4,10 @@ from unittest.mock import Mock, patch
import pytest
from aiogram import types
from helper_bot.handlers.voice.utils import (
format_time_ago,
get_last_message_text,
get_user_emoji_safe,
plural_time,
validate_voice_message,
)
from helper_bot.handlers.voice.utils import (format_time_ago,
get_last_message_text,
get_user_emoji_safe, plural_time,
validate_voice_message)
class TestVoiceUtils: