mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-16 03:54:27 +05:00
feat: KIAUH v6 - full rewrite of KIAUH in Python (#428)
This commit is contained in:
24
kiauh/core/decorators.py
Normal file
24
kiauh/core/decorators.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# ======================================================================= #
|
||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/dw-0/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
# ======================================================================= #
|
||||
from __future__ import annotations
|
||||
|
||||
import warnings
|
||||
from typing import Callable
|
||||
|
||||
|
||||
def deprecated(info: str = "", replaced_by: Callable | None = None) -> Callable:
|
||||
def decorator(func) -> Callable:
|
||||
def wrapper(*args, **kwargs):
|
||||
msg = f"{info}{replaced_by.__name__ if replaced_by else ''}"
|
||||
warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
|
||||
return func(*args, **kwargs)
|
||||
|
||||
return wrapper
|
||||
|
||||
return decorator
|
||||
Reference in New Issue
Block a user