Moved inline imports to module level.

This commit is contained in:
2026-01-07 13:21:27 -05:00
parent f62764a2b2
commit 548f90f0c0
2 changed files with 8 additions and 8 deletions

View File

@@ -8,6 +8,14 @@ from dataclasses import dataclass
from enum import Enum
from typing import Optional, List
from .utils import (
MAX_INSTANCE_TITLE_LENGTH,
MAX_STREAM_TITLE_LENGTH,
MAX_TAG_LENGTH,
UNKNOWN_STATUS_THRESHOLD,
truncate,
)
class StreamStatus(Enum):
"""Represents the status of a stream."""
@@ -31,8 +39,6 @@ class StreamState:
@property
def status(self) -> StreamStatus:
"""Returns the stream status considering failure_counter."""
from .utils import UNKNOWN_STATUS_THRESHOLD
if self.failure_counter > UNKNOWN_STATUS_THRESHOLD:
return StreamStatus.UNKNOWN
elif self.last_connect_time is not None:
@@ -49,8 +55,6 @@ class StreamState:
:param domain: The stream domain
:return: StreamState instance
"""
from .utils import truncate, MAX_STREAM_TITLE_LENGTH
return cls(
domain=domain,
title=truncate(response.get("streamTitle", ""), MAX_STREAM_TITLE_LENGTH),
@@ -96,8 +100,6 @@ class StreamConfig:
:param response: API response as a dictionary
:return: StreamConfig instance
"""
from .utils import truncate, MAX_INSTANCE_TITLE_LENGTH, MAX_TAG_LENGTH
# Truncate instance name to max length
name = truncate(response.get("name", ""), MAX_INSTANCE_TITLE_LENGTH)

View File

@@ -284,8 +284,6 @@ class StreamMonitor:
await self.notification_service.send_cleanup_deletion(domain)
# Delete all subscriptions for this domain
from .database import SubscriptionRepository
subscription_repo = SubscriptionRepository(self.stream_repo.db)
deleted_count = await subscription_repo.delete_all_for_domain(domain)