File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change 1212def warn_deprecation (
1313 deprecated_func : str ,
1414 replacing_func : str = "" ,
15- version : str = "" ,
15+ deprecated_version : str = "" ,
16+ removal_version : str = "" ,
1617):
1718 """Warn about the deprecation of a function.
1819
1920 :param str deprecated_func: Name of the deprecated function.
2021 :param str replacing_func: Name of the function to use instead (optional).
21- :param str version: PyThaiNLP version in which the function will be deprecated (optional).
22+ :param str deprecated_version: PyThaiNLP version in which the function will be deprecated (optional).
23+ :param str removal_version: PyThaiNLP version in which the function will be removed (optional).
2224 """
23- if version :
24- version = f"PyThaiNLP { version } "
25- else :
26- version = "a future release"
27- message = f"The '{ deprecated_func } ' function is deprecated and will be removed in { version } ."
25+ message = f"The '{ deprecated_func } ' function is deprecated"
26+ if deprecated_version :
27+ message += f" since { deprecated_version } "
28+ if not removal_version :
29+ removal_version = "a future release"
30+ message += f" and will be removed in { removal_version } ."
2831 if replacing_func :
2932 message += f" Please use '{ replacing_func } ' instead."
3033 warnings .warn (message , DeprecationWarning , stacklevel = 2 )
3134
32-
3335def safe_print (text : str ):
3436 """Print text to console, handling UnicodeEncodeError.
3537
You can’t perform that action at this time.
0 commit comments