forked from PyThaiNLP/pythainlp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore.py
30 lines (26 loc) · 938 Bytes
/
core.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# -*- coding: utf-8 -*-
# SPDX-FileCopyrightText: 2016-2024 PyThaiNLP Project
# SPDX-License-Identifier: Apache-2.0
"""
Generic support functions for PyThaiNLP.
"""
import warnings
def warn_deprecation(
deprecated_func: str,
replacing_func: str = "",
version: str = "",
):
"""
Warn about the deprecation of a function.
:param str deprecated_func: Name of the deprecated function.
:param str replacing_func: Name of the function to use instead (optional).
:param str version: PyThaiNLP version in which the function will be deprecated (optional).
"""
if version:
version = f"PyThaiNLP {version}"
else:
version = "a future release"
message = f"The '{deprecated_func}' function is deprecated and will be removed in {version}."
if replacing_func:
message += f" Please use '{replacing_func}' instead."
warnings.warn(message, DeprecationWarning, stacklevel=2)