Coverage for bilby/core/utils/docs.py: 86%
7 statements
« prev ^ index » next coverage.py v7.6.1, created at 2025-05-06 04:57 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2025-05-06 04:57 +0000
1def docstring(docstr, sep="\n"):
2 """
3 Decorator: Append to a function's docstring.
5 This is required for e.g., :code:`classmethods` as the :code:`__doc__`
6 can't be changed after.
8 Parameters
9 ==========
10 docstr: str
11 The docstring
12 sep: str
13 Separation character for appending the existing docstring.
14 """
15 def _decorator(func):
16 if func.__doc__ is None:
17 func.__doc__ = docstr
18 else:
19 func.__doc__ = sep.join([func.__doc__, docstr])
20 return func
21 return _decorator