def build_callable_view(self, dotted_name): |
""" build the html for a class method """ |
|
func = get_obj(self.dsa, self.pkg, dotted_name) |
docstring = func.__doc__ |
if docstring: |
docstring = deindent(docstring) |
localname = func.__name__ |
argdesc = get_param_htmldesc(self.linker, func) |
valuedesc = self.build_callable_signature_description(dotted_name) |
|
sourcefile = inspect.getsourcefile(func) |
callable_source = self.dsa.get_function_source(dotted_name) |
|
-> is_in_pkg = self.is_in_pkg(sourcefile) |
href = None |
text = 'could not get to source file' |
colored = [] |
if sourcefile and callable_source: |
enc = source_html.get_module_encoding(sourcefile) |
tokenizer = source_color.Tokenizer(source_color.PythonSchema) |
firstlineno = func.func_code.co_firstlineno |
sep = get_linesep(callable_source) |
org = callable_source.split(sep) |
colored = [enumerate_and_color(org, firstlineno, enc)] |
relpath = get_rel_sourcepath(self.projroot, sourcefile, sourcefile) |
text = 'source: %s' % (relpath,) |
if is_in_pkg: |
href = self.linker.get_lazyhref(sourcefile) |
|
csource = H.SourceSnippet(text, href, colored) |
cslinks = self.build_callsites(dotted_name) |
snippet = H.FunctionDescription(localname, argdesc, docstring, |
valuedesc, csource, cslinks) |
return snippet |