From b2afaf305d0b623f33bd36fc62801cfff9aafe1a Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 23 Oct 2019 08:32:58 +0200 Subject: [PATCH] Add @api decorator CURA-6665 --- cura/Utils/Decorators.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 cura/Utils/Decorators.py diff --git a/cura/Utils/Decorators.py b/cura/Utils/Decorators.py new file mode 100644 index 0000000000..0d7065f2f9 --- /dev/null +++ b/cura/Utils/Decorators.py @@ -0,0 +1,19 @@ +# Copyright (c) 2019 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. + +import functools + + +## Decorator for functions that belong to a set of APIs. For now, this should only be used for officially supported +# APIs, meaning that those APIs should be versioned and maintained. +# +# \param since The earliest version since when this API becomes supported. This means that since this version, this +# API function is supposed to behave the same. This parameter is not used. It's just a documentation. +# +def api(since = "Unknown"): + def api_decorator(function): + @functools.wraps(function) + def api_wrapper(*args, **kwargs): + return function(*args, **kwargs) + return api_wrapper + return api_decorator