def generate_class_autodoc(app, cls): ad = AutoDirective( name="autoclass", arguments=[FULL_NAMES[cls]], options={"noindex": True}, content=StringList([], items=[]), lineno=0, content_offset=1, block_text="", state=None, state_machine=None, ) ad.env = BuildEnvironment(app) ad.genopt = Options(noindex=True) ad.filename_set = set() ad.result = ViewList() documenter = ClassDocumenter(ad, ad.arguments[0]) documenter.generate(all_members=True) with open(OUTPUT_FILES[cls], "w") as fid: fid.write(cls + '\n') fid.write(''.join(['='] * len(cls)) + '\n') for line in ad.result: fid.write(line + "\n")
def generate(self, more_content=None, real_modname=None, check_module=False, all_members=False): """Patch to add a header.""" # Get object if not self.parse_name() or not self.import_object(): return # Add header if all_members: self.indent, temp = '', self.indent section = self.section.format(self.object.__name__) self.add_line(section, '<autodoc>') self.add_line("*" * len(section), '<autodoc>') self.indent = temp # Generate documentation ClassDocumenter.generate(self, more_content, real_modname, check_module, all_members)