fix mypy error

This commit is contained in:
Dulmandakh 2024-07-06 10:49:31 +08:00
parent c23ff11220
commit 0cc7bb7748

View File

@ -24,12 +24,13 @@ def deprecated(reason):
# @deprecated("please, use another function") # @deprecated("please, use another function")
# def old_function(x, y): # def old_function(x, y):
# pass # pass
reason = reason.decode() if isinstance(reason, bytes) else reason
def decorator(func1): def decorator(func1):
if inspect.isclass(func1): if inspect.isclass(func1):
fmt1 = f"Call to deprecated class {func1.__name__} ({reason.decode()})." fmt1 = f"Call to deprecated class {func1.__name__} ({reason})."
else: else:
fmt1 = f"Call to deprecated function {func1.__name__} ({reason.decode()})." fmt1 = f"Call to deprecated function {func1.__name__} ({reason})."
@functools.wraps(func1) @functools.wraps(func1)
def new_func1(*args, **kwargs): def new_func1(*args, **kwargs):