From bfeba3302e995fdba373603533fce54bf788adff Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Fri, 6 May 2022 00:25:41 -0400 Subject: many pydoc formatting cleanups, added deprecated decorator and replaced ad-hoc messages with consistent decorator --- python/decorators.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'python/decorators.py') diff --git a/python/decorators.py b/python/decorators.py index e02829f8..7c7025e3 100644 --- a/python/decorators.py +++ b/python/decorators.py @@ -1,6 +1,6 @@ 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. ''' @@ -10,3 +10,17 @@ def passive(cls): cls.__doc__ = passive_note return cls + + +def deprecated(cls): + deprecated_note = ''' + .. warning:: This object is deprecated. Please migrate code away from using this class or method. + +''' + + if hasattr(cls, "__doc__") and cls.__doc__: + cls.__doc__ = deprecated_note + cls.__doc__ + else: + cls.__doc__ = deprecated_note + + return cls \ No newline at end of file -- cgit v1.3.1