Fix model docs and enchant spelling tokenizer

This commit is contained in:
Andrew Smirnov
2021-04-29 21:08:11 +03:00
parent 3155374185
commit 010dff2f9d
2 changed files with 26 additions and 26 deletions

View File

@@ -16,10 +16,8 @@ import inspect
import enchant
import django
sys.path.insert(0, os.path.abspath('../../'))
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'access_controller.settings')
os.environ.setdefault('DJANGO_CONFIGURATION', 'Dev')
@@ -37,7 +35,6 @@ from django.db.models.query import QuerySet
QuerySet.__repr__ = lambda self: self.__class__.__name__
django.setup()
# -- Project information -----------------------------------------------------
@@ -87,6 +84,7 @@ def process_django_models(app, what, name, obj, options, lines):
lines.append(':type %s: %s.%s' % (field.attname, module, field_type.__name__))
if enchant is not None:
lines += spelling_white_list
lines.append('')
return lines
@@ -113,15 +111,17 @@ def skip_queryset(app, what, name, obj, skip, options):
return True
return skip
def fix_sig(app, what, name, obj, options, signature, return_annotation):
return ("", "")
# def setup(app):
# # Register the docstring processor with sphinx
# 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)
def fix_sig(app, what, name, obj, options, signature, return_annotation):
return "", ""
def setup(app):
# Register the docstring processor with sphinx
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)
# Add any Sphinx extension module names here, as strings. They can be
@@ -139,7 +139,6 @@ extensions = {
'sphinxcontrib.spelling',
}
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@@ -186,17 +185,17 @@ autodoc_typehints = "description"
# spell checking
spelling_lang = 'ru_RU'
tokenizer_lang = 'ru_RU'
spelling_exclude_patterns=['ignored_*', '../../main/models.py']
tokenizer_lang = 'en_US'
spelling_exclude_patterns = ['ignored_*', '../../main/models.py']
spelling_show_suggestions = True
spelling_show_whole_line=True
spelling_warning=True
spelling_show_whole_line = True
spelling_warning = True
spelling_ignore_pypi_package_names = True
spelling_ignore_wiki_words=True
spelling_ignore_acronyms=True
spelling_ignore_python_builtins=True
spelling_ignore_importable_modules=True
spelling_ignore_contributor_names=True
spelling_ignore_wiki_words = True
spelling_ignore_acronyms = True
spelling_ignore_python_builtins = True
spelling_ignore_importable_modules = True
spelling_ignore_contributor_names = True
# -- Options for todo extension ----------------------------------------------
@@ -206,6 +205,3 @@ set_type_checking_flag = True
typehints_fully_qualified = True
always_document_param_types = True
typehints_document_rtype = True