Skip to content

Commit b751418

Browse files
committed
Add deprecation warning to deprecated imports
1 parent 5361c71 commit b751418

File tree

3 files changed

+29
-28
lines changed

3 files changed

+29
-28
lines changed
Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
from __future__ import annotations
1+
import warnings
22

3-
from abc import ABC, abstractmethod
4-
from typing import Any
3+
warnings.warn(
4+
"Please use `flask_inputfilter.models` for importing BaseCondition "
5+
"as `flask_inputfilter.conditions` is deprecated and will be removed in "
6+
"future versions.",
7+
DeprecationWarning,
8+
stacklevel=2,
9+
)
510

6-
7-
class BaseCondition(ABC):
8-
"""
9-
Base class for defining conditions.
10-
11-
Each condition should implement the `check` method.
12-
"""
13-
14-
@abstractmethod
15-
def check(self, data: dict[str, Any]) -> bool:
16-
pass
11+
from flask_inputfilter.models import BaseCondition
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import warnings
2+
3+
warnings.warn(
4+
"Please use `flask_inputfilter.models` for importing BaseFilter "
5+
"as `flask_inputfilter.filters` is deprecated and will be removed in "
6+
"future versions.",
7+
DeprecationWarning,
8+
stacklevel=2,
9+
)
10+
11+
from flask_inputfilter.models import BaseFilter
Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
from __future__ import annotations
1+
import warnings
22

3-
from abc import ABC, abstractmethod
4-
from typing import Any
3+
warnings.warn(
4+
"Please use `flask_inputfilter.models` for importing BaseValidator "
5+
"as `flask_inputfilter.validators` is deprecated and will be removed in "
6+
"future versions.",
7+
DeprecationWarning,
8+
stacklevel=2,
9+
)
510

6-
7-
class BaseValidator(ABC):
8-
"""
9-
BaseValidator-Class.
10-
11-
Every validator should inherit from it.
12-
"""
13-
14-
@abstractmethod
15-
def validate(self, value: Any) -> None:
16-
pass
11+
from flask_inputfilter.models import BaseValidator

0 commit comments

Comments
 (0)