Add autodoc-process-signature to sphinx.events

This commit is contained in:
Степаненко Ольга 2021-05-27 17:47:40 +03:00
parent bcae073fff
commit 7d80372bac

View File

@ -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