mirror of
https://github.com/pacnpal/Pac-cogs.git
synced 2025-12-20 02:41:06 -05:00
Adding queue.types to the module reload list in the main init.py
Properly exposing QueueProcessor in processor/init.py Updating queue/init.py to import and expose all necessary types (QueuePriority, ProcessingMetrics) Ensuring consistent import patterns across the codebase The changes maintain the cog's architecture while fixing the import issues: Module reloading system now includes all dependencies Package hierarchy properly exposes all needed types Import structure is consistent across components All necessary types and models are accessible
This commit is contained in:
@@ -3,18 +3,21 @@
|
||||
from typing import Dict, Any, Optional, Union, List, Tuple
|
||||
import discord # type: ignore
|
||||
|
||||
try:
|
||||
# Try relative imports first
|
||||
from .core import VideoProcessor
|
||||
from .constants import (
|
||||
# Import constants first since they have no dependencies
|
||||
from .constants import (
|
||||
REACTIONS,
|
||||
ReactionType,
|
||||
ReactionEmojis,
|
||||
ProgressEmojis,
|
||||
get_reaction,
|
||||
get_progress_emoji,
|
||||
)
|
||||
from .url_extractor import (
|
||||
)
|
||||
|
||||
# Import core components
|
||||
from .core import VideoProcessor
|
||||
|
||||
# Import URL related components
|
||||
from .url_extractor import (
|
||||
URLExtractor,
|
||||
URLMetadata,
|
||||
URLPattern,
|
||||
@@ -22,8 +25,10 @@ try:
|
||||
URLPatternManager,
|
||||
URLValidator,
|
||||
URLMetadataExtractor,
|
||||
)
|
||||
from .message_validator import (
|
||||
)
|
||||
|
||||
# Import validation components
|
||||
from .message_validator import (
|
||||
MessageValidator,
|
||||
ValidationContext,
|
||||
ValidationRule,
|
||||
@@ -33,58 +38,23 @@ try:
|
||||
ValidationStats,
|
||||
ValidationCacheEntry,
|
||||
ValidationError,
|
||||
)
|
||||
from .message_handler import MessageHandler
|
||||
from .queue_handler import QueueHandler
|
||||
from .queue_processor import QueueProcessor # Added import
|
||||
from .reactions import (
|
||||
)
|
||||
|
||||
# Import reaction handlers
|
||||
from .reactions import (
|
||||
handle_archived_reaction,
|
||||
update_queue_position_reaction,
|
||||
update_progress_reaction,
|
||||
update_download_progress_reaction,
|
||||
)
|
||||
from ..utils.progress_tracker import progress_tracker
|
||||
except ImportError:
|
||||
# Fall back to absolute imports if relative imports fail
|
||||
from videoarchiver.processor.core import VideoProcessor
|
||||
from videoarchiver.processor.constants import (
|
||||
REACTIONS,
|
||||
ReactionType,
|
||||
ReactionEmojis,
|
||||
ProgressEmojis,
|
||||
get_reaction,
|
||||
get_progress_emoji,
|
||||
)
|
||||
from videoarchiver.processor.url_extractor import (
|
||||
URLExtractor,
|
||||
URLMetadata,
|
||||
URLPattern,
|
||||
URLType,
|
||||
URLPatternManager,
|
||||
URLValidator,
|
||||
URLMetadataExtractor,
|
||||
)
|
||||
from videoarchiver.processor.message_validator import (
|
||||
MessageValidator,
|
||||
ValidationContext,
|
||||
ValidationRule,
|
||||
ValidationResult,
|
||||
ValidationRuleManager,
|
||||
ValidationCache,
|
||||
ValidationStats,
|
||||
ValidationCacheEntry,
|
||||
ValidationError,
|
||||
)
|
||||
from videoarchiver.processor.message_handler import MessageHandler
|
||||
from videoarchiver.processor.queue_handler import QueueHandler
|
||||
from videoarchiver.processor.queue_processor import QueueProcessor # Added import
|
||||
from videoarchiver.processor.reactions import (
|
||||
handle_archived_reaction,
|
||||
update_queue_position_reaction,
|
||||
update_progress_reaction,
|
||||
update_download_progress_reaction,
|
||||
)
|
||||
from videoarchiver.utils.progress_tracker import progress_tracker
|
||||
)
|
||||
|
||||
# Import progress tracking
|
||||
from ..utils.progress_tracker import progress_tracker
|
||||
|
||||
# Import handlers after other dependencies are loaded
|
||||
from .message_handler import MessageHandler
|
||||
from .queue_handler import QueueHandler
|
||||
from .queue_processor import QueueProcessor
|
||||
|
||||
# Export public classes and constants
|
||||
__all__ = [
|
||||
@@ -92,7 +62,7 @@ __all__ = [
|
||||
"VideoProcessor",
|
||||
"MessageHandler",
|
||||
"QueueHandler",
|
||||
"QueueProcessor", # Added export
|
||||
"QueueProcessor",
|
||||
# URL Extraction
|
||||
"URLExtractor",
|
||||
"URLMetadata",
|
||||
|
||||
@@ -8,24 +8,10 @@ from typing import Any, ClassVar, Dict, List, Optional, Tuple, TYPE_CHECKING
|
||||
import discord # type: ignore
|
||||
from discord.ext import commands # type: ignore
|
||||
|
||||
try:
|
||||
# Try relative imports first
|
||||
from ..core.types import ComponentState, ProcessorState, ComponentStatus
|
||||
from .constants import REACTIONS
|
||||
from ..utils import progress_tracker
|
||||
from ..utils.exceptions import ProcessorError
|
||||
except ImportError:
|
||||
# Fall back to absolute imports if relative imports fail
|
||||
from videoarchiver.core.types import ComponentState, ProcessorState, ComponentStatus
|
||||
from videoarchiver.processor.constants import REACTIONS
|
||||
from videoarchiver.utils import progress_tracker
|
||||
from videoarchiver.utils.exceptions import ProcessorError
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .cleanup_manager import CleanupManager
|
||||
from .message_handler import MessageHandler
|
||||
from .queue_handler import QueueHandler
|
||||
from ..core.types import IComponent, IConfigManager, IQueueManager
|
||||
from videoarchiver.core.types import ComponentState, ProcessorState, ComponentStatus, IComponent, IConfigManager, IQueueManager
|
||||
from videoarchiver.processor.constants import REACTIONS
|
||||
from videoarchiver.utils import progress_tracker
|
||||
from videoarchiver.utils.exceptions import ProcessorError
|
||||
|
||||
logger = logging.getLogger("VideoArchiver")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user