summaryrefslogtreecommitdiff
path: root/docs/ext/docstrings.py
diff options
context:
space:
mode:
authorMax Wittig <max.wittig95@gmail.com>2019-05-16 18:00:34 +0200
committerMax Wittig <max.wittig95@gmail.com>2019-05-16 18:03:56 +0200
commit318d2770cbc90ae4d33170274e214b9d828bca43 (patch)
treec5b6d6d9b57f6642dca83ea33956a4d5ae15e5eb /docs/ext/docstrings.py
parentef32990347d0ab9145b8919d25269766dc2ce445 (diff)
downloadgitlab-refactor/black.tar.gz
refactor: format everything blackrefactor/black
Diffstat (limited to 'docs/ext/docstrings.py')
-rw-r--r--docs/ext/docstrings.py41
1 files changed, 21 insertions, 20 deletions
diff --git a/docs/ext/docstrings.py b/docs/ext/docstrings.py
index 5035f4f..e42bb60 100644
--- a/docs/ext/docstrings.py
+++ b/docs/ext/docstrings.py
@@ -13,46 +13,47 @@ def classref(value, short=True):
return value
if not inspect.isclass(value):
- return ':class:%s' % value
- tilde = '~' if short else ''
- string = '%s.%s' % (value.__module__, value.__name__)
- return ':class:`%sgitlab.objects.%s`' % (tilde, value.__name__)
+ return ":class:%s" % value
+ tilde = "~" if short else ""
+ string = "%s.%s" % (value.__module__, value.__name__)
+ return ":class:`%sgitlab.objects.%s`" % (tilde, value.__name__)
def setup(app):
- app.connect('autodoc-process-docstring', _process_docstring)
- app.connect('autodoc-skip-member', napoleon._skip_member)
+ app.connect("autodoc-process-docstring", _process_docstring)
+ app.connect("autodoc-skip-member", napoleon._skip_member)
conf = napoleon.Config._config_values
for name, (default, rebuild) in six.iteritems(conf):
app.add_config_value(name, default, rebuild)
- return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
+ return {"version": sphinx.__display_version__, "parallel_read_safe": True}
def _process_docstring(app, what, name, obj, options, lines):
result_lines = lines
- docstring = GitlabDocstring(result_lines, app.config, app, what, name, obj,
- options)
+ docstring = GitlabDocstring(result_lines, app.config, app, what, name, obj, options)
result_lines = docstring.lines()
lines[:] = result_lines[:]
class GitlabDocstring(GoogleDocstring):
def _build_doc(self, tmpl, **kwargs):
- env = jinja2.Environment(loader=jinja2.FileSystemLoader(
- os.path.dirname(__file__)), trim_blocks=False)
- env.filters['classref'] = classref
+ env = jinja2.Environment(
+ loader=jinja2.FileSystemLoader(os.path.dirname(__file__)), trim_blocks=False
+ )
+ env.filters["classref"] = classref
template = env.get_template(tmpl)
output = template.render(**kwargs)
- return output.split('\n')
+ return output.split("\n")
- def __init__(self, docstring, config=None, app=None, what='', name='',
- obj=None, options=None):
- super(GitlabDocstring, self).__init__(docstring, config, app, what,
- name, obj, options)
+ def __init__(
+ self, docstring, config=None, app=None, what="", name="", obj=None, options=None
+ ):
+ super(GitlabDocstring, self).__init__(
+ docstring, config, app, what, name, obj, options
+ )
- if name.startswith('gitlab.v4.objects') and name.endswith('Manager'):
- self._parsed_lines.extend(self._build_doc('manager_tmpl.j2',
- cls=self._obj))
+ if name.startswith("gitlab.v4.objects") and name.endswith("Manager"):
+ self._parsed_lines.extend(self._build_doc("manager_tmpl.j2", cls=self._obj))