Skip to content

Commit c148b3c

Browse files
committed
Fix docs formatting
1 parent d3db08e commit c148b3c

File tree

2 files changed

+205
-230
lines changed

2 files changed

+205
-230
lines changed

docs/conf.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import os
2020
import sys
2121

22+
import attr
2223
from sphinx.ext.autodoc import ModuleLevelDocumenter, DataDocumenter
2324

2425
sys.path.insert(0, os.path.abspath('../'))
@@ -335,21 +336,29 @@
335336
# texinfo_no_detailmenu = False
336337

337338

339+
autodoc_member_order = 'bysource'
340+
341+
342+
def process_signature(app, what, name, obj, options, signature, annotation):
343+
if isinstance(obj, attr._make.Attribute):
344+
obj.__class__.__repr__ = lambda *a, **k: None
345+
338346
def maybe_skip_member(app, what, name, obj, skip, options):
339-
# print (what, name, obj, skip)
340347
if type(obj) == property:
341348
skip = False
342349
whitelisted_names = []
343350
if name in whitelisted_names:
344351
return False
345352
whitelisted_init_classes = ["GogsApi", "Token", "UsernamePassword", "Builder"]
346353
if name == "__init__":
347-
return obj.im_class.__name__ not in whitelisted_init_classes
354+
if hasattr(obj, 'im_class'):
355+
return obj.im_class.__name__ not in whitelisted_init_classes
348356
blacklisted_names = ["update_kwargs"]
349357
return skip or (name in blacklisted_names)
350358

351359
def setup(app):
352360
app.connect('autodoc-skip-member', maybe_skip_member)
361+
app.connect('autodoc-process-signature', process_signature)
353362

354363
def add_directive_header(self, sig):
355364
ModuleLevelDocumenter.add_directive_header(self, sig)

0 commit comments

Comments
 (0)