def _find_lineno(self, obj, source_lines):
lineno = None<EOL>if inspect.ismodule(obj):<EOL><INDENT>lineno = <NUM_LIT:0><EOL><DEDENT>if inspect.isclass(obj):<EOL><INDENT>if source_lines is None:<EOL><INDENT>return None<EOL><DEDENT>pat = re.compile(r'<STR_LIT>' %<EOL>getattr(obj, '<STR_LIT>', '<STR_LIT:->'))<EOL>for i, line in enumerate(source_lines):<EOL><INDENT>if pat.match(line):<EOL><INDENT>lineno = i<EOL>break<EOL><DEDENT><DEDENT><DEDENT>if inspect.ismethod(obj): obj = obj.__func__<EOL>if inspect.isfunction(obj): obj = obj.__code__<EOL>if inspect.istraceback(obj): obj = obj.tb_frame<EOL>if inspect.isframe(obj): obj = obj.f_code<EOL>if inspect.iscode(obj):<EOL><INDENT>lineno = getattr(obj, '<STR_LIT>', None)-<NUM_LIT:1><EOL><DEDENT>if lineno is not None:<EOL><INDENT>if source_lines is None:<EOL><INDENT>return lineno+<NUM_LIT:1><EOL><DEDENT>pat = re.compile('<STR_LIT>')<EOL>for lineno in range(lineno, len(source_lines)):<EOL><INDENT>if pat.match(source_lines[lineno]):<EOL><INDENT>return lineno<EOL><DEDENT><DEDENT><DEDENT>return None<EOL>
Return a line number of the given object's docstring.  Note:
this method assumes that the object has a docstring.