Skip to content

Commit f132d3b

Browse files
lpsingerauvipy
authored andcommitted
Strip self from sphinx documentation of bound tasks (celery#4421)
In Sphinx-generated documentation, the `self` argument should be hidden from the signature of a task that was created with `bind=True`. (Sphinx does normally strip the `self` or `cls` argument from method signatures.)
1 parent acf8506 commit f132d3b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

celery/contrib/sphinx.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ def format_args(self):
5454
wrapped = getattr(self.object, '__wrapped__', None)
5555
if wrapped is not None:
5656
argspec = getfullargspec(wrapped)
57+
if argspec[0] and argspec[0][0] in ('cls', 'self'):
58+
del argspec[0][0]
5759
fmt = formatargspec(*argspec)
5860
fmt = fmt.replace('\\', '\\\\')
5961
return fmt

0 commit comments

Comments
 (0)