mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-08 18:44:10 +00:00
blacken autodoc sphinx extension
This commit is contained in:
@@ -7,14 +7,18 @@ from sphinx.ext.autodoc import ClassDocumenter, AttributeDocumenter
|
||||
|
||||
class ConfigurableDocumenter(ClassDocumenter):
|
||||
"""Specialized Documenter subclass for traits with config=True"""
|
||||
|
||||
objtype = 'configurable'
|
||||
directivetype = 'class'
|
||||
|
||||
def get_object_members(self, want_all):
|
||||
"""Add traits with .tag(config=True) to members list"""
|
||||
check, members = super().get_object_members(want_all)
|
||||
get_traits = self.object.class_own_traits if self.options.inherited_members \
|
||||
else self.object.class_traits
|
||||
get_traits = (
|
||||
self.object.class_own_traits
|
||||
if self.options.inherited_members
|
||||
else self.object.class_traits
|
||||
)
|
||||
trait_members = []
|
||||
for name, trait in sorted(get_traits(config=True).items()):
|
||||
# put help in __doc__ where autodoc will look for it
|
||||
@@ -42,10 +46,7 @@ class TraitDocumenter(AttributeDocumenter):
|
||||
default_s = ''
|
||||
else:
|
||||
default_s = repr(default)
|
||||
sig = ' = {}({})'.format(
|
||||
self.object.__class__.__name__,
|
||||
default_s,
|
||||
)
|
||||
sig = ' = {}({})'.format(self.object.__class__.__name__, default_s)
|
||||
return super().add_directive_header(sig)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user