chore: verify formatting checks

This commit is contained in:
3252a8
2026-05-27 14:29:45 +03:00
parent 4706be53ab
commit fe34edfe73
19 changed files with 44 additions and 98 deletions
@@ -416,9 +416,7 @@ class SubscriptionLifecycleMixin:
"Failed to recalculate active HWID devices for renewal of user %s",
user_id,
)
extra_hwid_devices = int(
getattr(current_active_sub, "extra_hwid_devices", 0) or 0
)
extra_hwid_devices = int(getattr(current_active_sub, "extra_hwid_devices", 0) or 0)
premium_topup_balance_bytes = int(
getattr(current_active_sub, "premium_topup_balance_bytes", 0) or 0
)
@@ -813,9 +811,7 @@ class SubscriptionLifecycleMixin:
subscription_id=local_active_sub.subscription_id,
at=datetime.now(timezone.utc),
)
active_extra_hwid_devices = int(
hwid_entitlement_summary.get("active_devices") or 0
)
active_extra_hwid_devices = int(hwid_entitlement_summary.get("active_devices") or 0)
if active_extra_hwid_devices != int(local_active_sub.extra_hwid_devices or 0):
await subscription_dal.update_subscription(
session,
@@ -901,9 +897,7 @@ class SubscriptionLifecycleMixin:
else None,
"extra_hwid_devices": active_extra_hwid_devices,
"extra_hwid_devices_valid_until": hwid_entitlement_summary.get("active_until"),
"extra_hwid_devices_next_valid_from": hwid_entitlement_summary.get(
"next_valid_from"
),
"extra_hwid_devices_next_valid_from": hwid_entitlement_summary.get("next_valid_from"),
"user_bot_username": db_user.username,
"is_panel_data": True,
"max_devices": hwid_limit,
@@ -441,9 +441,7 @@ class TariffMixin:
if options.get("mode") == "period_to_period":
target_monthly = float(options.get("target_monthly_rub") or 0)
hwid_days = (
math.floor((value_rub / target_monthly) * 30) if target_monthly > 0 else 0
)
hwid_days = math.floor((value_rub / target_monthly) * 30) if target_monthly > 0 else 0
options["converted_hwid_days"] = max(0, hwid_days)
options["recalc_days"] = int(options.get("recalc_days") or 0) + max(0, hwid_days)
options["paid_diff_rub"] = max(
@@ -54,9 +54,7 @@ class TrafficMixin:
purchase_bytes = self.gb_to_bytes(traffic_gb)
extra_hwid_devices = (
await self._active_hwid_extra_devices_for_sub(session, active_sub)
if active_sub
else 0
await self._active_hwid_extra_devices_for_sub(session, active_sub) if active_sub else 0
)
base_hwid_limit = self._base_hwid_limit_for_tariff(tariff)
effective_hwid_limit = self._effective_hwid_limit(base_hwid_limit, extra_hwid_devices)