Skip to content

Commit ae00f6d

Browse files
committed
Tweaked autodoc to skip :internal: methods.
1 parent 02a1317 commit ae00f6d

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

docs/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# add these directories to sys.path here. If the directory is relative to the
1818
# documentation root, use os.path.abspath to make it absolute, like shown here.
1919
sys.path.append(os.path.abspath('_themes'))
20+
sys.path.append(os.path.abspath('.'))
2021

2122
# -- General configuration -----------------------------------------------------
2223

@@ -25,7 +26,8 @@
2526

2627
# Add any Sphinx extension module names here, as strings. They can be extensions
2728
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
28-
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx']
29+
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx',
30+
'flaskdocext']
2931

3032
# Add any paths that contain templates here, relative to this directory.
3133
templates_path = ['_templates']

docs/flaskdocext.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import re
2+
import inspect
3+
4+
5+
_internal_mark_re = re.compile(r'^\s*:internal:\s*$(?m)')
6+
7+
8+
def skip_member(app, what, name, obj, skip, options):
9+
docstring = inspect.getdoc(obj)
10+
if skip:
11+
return True
12+
return _internal_mark_re.search(docstring or '') is not None
13+
14+
15+
def setup(app):
16+
app.connect('autodoc-skip-member', skip_member)

flask/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def __init__(self, import_name, static_path=None, static_url_path=None,
257257
#: to load a config from files.
258258
self.config = Config(self.root_path, self.default_config)
259259

260-
#: Prepare the deferred setup of the logger.
260+
# Prepare the deferred setup of the logger.
261261
self._logger = None
262262
self.logger_name = self.import_name
263263

@@ -1181,7 +1181,7 @@ def try_trigger_before_first_request_functions(self):
11811181
the :attr:`before_first_request_funcs` and only exactly once per
11821182
application instance (which means process usually).
11831183
1184-
.. versionadded:: 0.8
1184+
:internal:
11851185
"""
11861186
if self._got_first_request:
11871187
return

0 commit comments

Comments
 (0)