summaryrefslogtreecommitdiff
path: root/venv/lib/python3.11/site-packages/faker/sphinx/autodoc.py
blob: 8e7154eef983b1611fa15ace334fbb6e0c5fca90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# coding=utf-8
from faker.sphinx.docstring import ProviderMethodDocstring
from faker.sphinx.documentor import write_provider_docs


def _create_source_files(app):
    write_provider_docs()


def _process_docstring(app, what, name, obj, options, lines):
    docstring = ProviderMethodDocstring(app, what, name, obj, options, lines)
    if not docstring.skipped:
        lines[:] = docstring.lines[:]


def setup(app):
    app.setup_extension("sphinx.ext.autodoc")
    app.connect("builder-inited", _create_source_files)
    app.connect("autodoc-process-docstring", _process_docstring)