Skip to content

Commit

Permalink
chore: move deprecation warning to constructor
Browse files Browse the repository at this point in the history
The class is always defined and that is not really reason to emit the warning.
  • Loading branch information
nijel committed Dec 17, 2024
1 parent 03d447b commit 27cd03f
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions weblate/addons/consistency.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# Copyright © Michal Čihař <[email protected]>
#
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import annotations

import warnings
from typing import TYPE_CHECKING

from django.utils.translation import gettext_lazy

from weblate.addons.base import BaseAddon
from weblate.addons.events import AddonEvent
from weblate.addons.tasks import language_consistency

if TYPE_CHECKING:
from weblate.addons.models import Addon


class LanguageConsistencyAddon(BaseAddon):
events: set[AddonEvent] = {AddonEvent.EVENT_DAILY, AddonEvent.EVENT_POST_ADD}
Expand Down Expand Up @@ -40,8 +45,10 @@ def post_add(self, translation) -> None:


class LangaugeConsistencyAddon(LanguageConsistencyAddon):
warnings.warn(
"LangaugeConsistencyAddon is deprecated, use LanguageConsistencyAddon",
DeprecationWarning,
stacklevel=1,
)
def __init__(self, storage: Addon) -> None:
super().__init__(storage)
warnings.warn(
"LangaugeConsistencyAddon is deprecated, use LanguageConsistencyAddon",
DeprecationWarning,
stacklevel=1,
)

0 comments on commit 27cd03f

Please sign in to comment.