def __init__(self, name, module, class_obj):
super(Class, self).__init__(name, module, inspect.getdoc(class_obj))<EOL>self.cls = class_obj<EOL>"""<STR_LIT>"""<EOL>self.doc = {}<EOL>"""<STR_LIT>"""<EOL>self.doc_init = {}<EOL>"""<STR_LIT>"""<EOL>public = self.__public_objs()<EOL>try:<EOL><INDENT>cls_ast = ast.parse(inspect.getsource(self.cls)).body[<NUM_LIT:0>]<EOL>self.doc = _var_docstrings(cls_ast, self.module, cls=self)<EOL>for n in (cls_ast.body if '<STR_LIT>' in public else []):<EOL><INDENT>if isinstance(n, ast.FunctionDef) and n.name == '<STR_LIT>':<EOL><INDENT>self.doc_init = _var_docstrings(n, self.module,<EOL>cls=self, init=True)<EOL>break<EOL><DEDENT><DEDENT><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT>for name, obj in public.items():<EOL><INDENT>if name in self.doc and not self.doc[name].is_empty():<EOL><INDENT>continue<EOL><DEDENT>if name in self.doc_init:<EOL><INDENT>continue<EOL><DEDENT>if inspect.ismethod(obj):<EOL><INDENT>self.doc[name] = Function(name, self.module, obj.__func__,<EOL>cls=self, method=True)<EOL><DEDENT>elif inspect.isfunction(obj):<EOL><INDENT>self.doc[name] = Function(name, self.module, obj,<EOL>cls=self, method=False)<EOL><DEDENT>elif isinstance(obj, property):<EOL><INDENT>docstring = getattr(obj, '<STR_LIT>', '<STR_LIT>')<EOL>self.doc_init[name] = Variable(name, self.module, docstring,<EOL>cls=self)<EOL><DEDENT>elif not inspect.isbuiltin(obj)and not inspect.isroutine(obj):<EOL><INDENT>if name in getattr(self.cls, '<STR_LIT>', []):<EOL><INDENT>self.doc_init[name] = Variable(name, self.module,<EOL>'<STR_LIT>', cls=self)<EOL><DEDENT>else:<EOL><INDENT>self.doc[name] = Variable(name, self.module, '<STR_LIT>', cls=self)<EOL><DEDENT><DEDENT><DEDENT>
Same as `pydoc.Doc.__init__`, except `class_obj` must be a
Python class object. The docstring is gathered automatically.