From 7d80372bace5acc0ead76f96a98c37d6e27f4598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=B5=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=20=D0=9E=D0=BB=D1=8C=D0=B3=D0=B0?= Date: Thu, 27 May 2021 17:47:40 +0300 Subject: [PATCH] Add autodoc-process-signature to sphinx.events --- docs/source/conf.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index b4be21c..5a7ba38 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -11,11 +11,15 @@ # documentation root, use os.path.abspath to make it absolute, like shown here. # import os +import sphinx.events import sys import inspect import enchant import django + +sphinx.events.core_events['autodoc-process-signature'] = '' + sys.path.insert(0, os.path.abspath('../../')) os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'access_controller.settings') @@ -47,6 +51,8 @@ author = 'SHP S101, group 2' release = 'v0.01' + + # -- General configuration --------------------------------------------------- def process_django_models(app, what, name, obj, options, lines): @@ -112,8 +118,9 @@ def skip_queryset(app, what, name, obj, skip, options): return skip -def fix_sig(app, what, name, obj, options, signature, return_annotation): - return "", "" +def process_signature(app, what: str, name: str, obj, options, signature, return_annotation): + if not callable(obj): + return def setup(app): @@ -121,7 +128,7 @@ def setup(app): app.connect('autodoc-process-docstring', process_django_models) app.connect('autodoc-skip-member', skip_queryset) app.connect('autodoc-process-docstring', process_modules) - app.connect("autodoc-process-signature", fix_sig) + app.connect("autodoc-process-signature", process_signature) # Add any Sphinx extension module names here, as strings. They can be