From 548f90f0c01a46fdcffc0ab876b8852cc3a56a83 Mon Sep 17 00:00:00 2001 From: Logan Fick Date: Wed, 7 Jan 2026 13:21:27 -0500 Subject: [PATCH] Moved inline imports to module level. --- owncastsentry/models.py | 14 ++++++++------ owncastsentry/stream_monitor.py | 2 -- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/owncastsentry/models.py b/owncastsentry/models.py index 60d0cf4..7916f27 100644 --- a/owncastsentry/models.py +++ b/owncastsentry/models.py @@ -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) diff --git a/owncastsentry/stream_monitor.py b/owncastsentry/stream_monitor.py index b6e9bef..143d99d 100644 --- a/owncastsentry/stream_monitor.py +++ b/owncastsentry/stream_monitor.py @@ -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)