From f8fc31094494eb644c051e26698d10cafdd46bf9 Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Wed, 7 Apr 2021 18:03:35 -0400 Subject: adding passive decorator and annotate Variable class --- python/decorators.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 python/decorators.py (limited to 'python/decorators.py') diff --git a/python/decorators.py b/python/decorators.py new file mode 100644 index 00000000..bd4a82c7 --- /dev/null +++ b/python/decorators.py @@ -0,0 +1,13 @@ +def passive(cls): + passive_note = ''' + + .. note:: This object is a "passive" object. Any changes you make to it will not be reflected in the core and vice-versa. If you wish to update a core version of this object you should use the appropriate API. +''' + + if hasattr(cls, ".__doc__") and cls.__doc__: + cls.__doc__ += passive_note + else: + cls.__doc__ = passive_note + + return cls + -- cgit v1.3.1