From d5ec7185a2f082c4fca0c59bfb2f0e93d949afac Mon Sep 17 00:00:00 2001 From: Ryan Westfall Date: Fri, 31 Jul 2026 06:23:32 -0500 Subject: [PATCH] Move django.conf settings import to module top in quotas --- llm_be/finance/services/quotas.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/llm_be/finance/services/quotas.py b/llm_be/finance/services/quotas.py index 3c8d27b..70ae162 100644 --- a/llm_be/finance/services/quotas.py +++ b/llm_be/finance/services/quotas.py @@ -6,6 +6,7 @@ from dataclasses import dataclass from datetime import timedelta from typing import Any +from django.conf import settings from django.db.models import Count, Q, Sum from django.utils import timezone @@ -165,8 +166,6 @@ def get_usage_snapshot(user) -> UsageSnapshot: def assert_feature_allowed(user, feature: str) -> None: - from django.conf import settings - if not getattr(settings, "ENFORCE_SUBSCRIPTION_GATES", True): return @@ -249,8 +248,6 @@ def assert_within_quotas(user) -> UsageSnapshot: def check_generation_allowed(user, *, feature: str = "text_generation") -> UsageSnapshot: """Combined feature + quota gate for a chat turn.""" - from django.conf import settings - if not getattr(settings, "ENFORCE_SUBSCRIPTION_GATES", True): return get_usage_snapshot(user) assert_feature_allowed(user, feature)