@@ -334,7 +334,7 @@ def autosummary_documenter(self):
334334 """Returns the AutosummaryDocumenter subclass that can be used"""
335335 try :
336336 return self ._autosummary_documenter
337- except :
337+ except AttributeError :
338338 pass
339339 objtype = self .name [4 :]
340340 doc_class = self ._registry [objtype ]
@@ -608,16 +608,18 @@ def dont_document_data(config, fullname):
608608 bool
609609 Whether the data of `fullname` should be excluded or not"""
610610 if config .document_data is True :
611- config .document_data = [re .compile ('.*' )]
611+ document_data = [re .compile ('.*' )]
612+ else :
613+ document_data = config .document_data
612614 if config .not_document_data is True :
613- config .not_document_data = [re .compile ('.*' )]
615+ not_document_data = [re .compile ('.*' )]
616+ else :
617+ not_document_data = config .not_document_data
614618 return (
615619 # data should not be documented
616- (config .not_document_data is True or
617- any (re .match (p , fullname ) for p in config .not_document_data )) or
620+ (any (re .match (p , fullname ) for p in not_document_data )) or
618621 # or data is not included in what should be documented
619- (not config .document_data or
620- not any (re .match (p , fullname ) for p in config .document_data )))
622+ (not any (re .match (p , fullname ) for p in document_data )))
621623
622624
623625class NoDataDataDocumenter (CallableDataDocumenter ):
@@ -660,7 +662,12 @@ def setup(app):
660662 CallableAttributeDocumenter , NoDataDataDocumenter ,
661663 NoDataAttributeDocumenter ]:
662664 if not issubclass (AutoDirective ._registry .get (cls .objtype ), cls ):
663- app .add_autodocumenter (cls )
665+ try :
666+ # we use add_documenter because this does not add a new
667+ # directive
668+ ad .add_documenter (cls )
669+ except AttributeError :
670+ app .add_autodocumenter (cls )
664671
665672 # directives
666673 app .add_directive ('automodule' , AutoSummDirective )
0 commit comments