File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change 1616from importlib import import_module
1717import inspect
1818import io
19+ import types
1920import token
2021import tokenize
2122import traceback
@@ -114,14 +115,17 @@ def add_directive_header(self, sig):
114115
115116 """
116117 ClassLevelDocumenter .add_directive_header (self , sig )
117- try :
118- definition = trait_definition (
119- cls = self .parent ,
120- trait_name = self .object_name ,
121- )
122- except ValueError :
123- # Without this, a failure to find the trait definition aborts
124- # the whole documentation build.
118+ # Look into the class and parent classes:
119+ classes = [self .parent ] + list (types .resolve_bases (self .parent .__bases__ ))
120+ for cls in classes :
121+ try :
122+ definition = trait_definition (
123+ cls = cls , trait_name = self .object_name )
124+ except ValueError :
125+ continue
126+ else :
127+ break
128+ else :
125129 logger .warning (
126130 "No definition for the trait {!r} could be found in "
127131 "class {!r}." .format (self .object_name , self .parent ),
You can’t perform that action at this time.
0 commit comments