call site 3 for code.Source.__init__
apigen/testing/test_apigen_example.py - line 179
178
179
180
181
182
183
   def test_build_class_pages(self):
->     self.apb.build_class_pages(['main.SomeClass', 'main.SomeSubClass'])
       clsfile = self.base.join('api/main.SomeClass.html')
       assert clsfile.check()
       html = clsfile.read()
       _checkhtml(html)
apigen/htmlgen.py - line 510
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
   def build_class_pages(self, classes_dotted_names):
       passed = []
       for dotted_name in sorted(classes_dotted_names):
           if self.capture:
               self.capture.err.writeorg('.')
           parent_dotted_name, _ = split_of_last_part(dotted_name)
           try:
               sibling_dotted_names = self.namespace_tree[parent_dotted_name]
           except KeyError:
               # no siblings (built-in module or sth)
               sibling_dotted_names = []
->         tag = H.Content(self.build_class_view(dotted_name))
           nav = self.build_navigation(dotted_name, False)
           reltargetpath = "api/%s.html" % (dotted_name,)
           self.linker.set_link(dotted_name, reltargetpath)
           title = '%s API' % (dotted_name,)
           rev = self.get_revision(dotted_name)
           if rev:
               title += ' [rev. %s]' % (rev,)
           self.write_page(title, reltargetpath, tag, nav)
       return passed
apigen/htmlgen.py - line 420
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
   def build_class_view(self, dotted_name):
       """ build the html for a class """
       cls = get_obj(self.dsa, self.pkg, dotted_name)
       # XXX is this a safe check?
       try:
           sourcefile = inspect.getsourcefile(cls)
       except TypeError:
           sourcefile = None
   
       docstring = cls.__doc__
       if docstring:
           docstring = deindent(docstring)
       if not hasattr(cls, '__name__'):
           clsname = 'instance of %s' % (cls.__class__.__name__,)
       else:
           clsname = cls.__name__
       bases = self.build_bases(dotted_name)
       properties = self.build_properties(cls)
->     methods = self.build_methods(dotted_name)
   
       if sourcefile is None:
           sourcelink = H.div('no source available')
       else:
           if sourcefile[-1] in ['o', 'c']:
               sourcefile = sourcefile[:-1]
           sourcelink = H.div(H.a('view source',
               href=self.linker.get_lazyhref(sourcefile)))
   
       snippet = H.ClassDescription(
           # XXX bases HTML
           H.ClassDef(clsname, bases, docstring, sourcelink,
                      properties, methods),
       )
   
       return snippet
apigen/htmlgen.py - line 474
462
463
464
465
466
467
468
469
470
471
472
473
474
475
   def build_methods(self, dotted_name):
       ret = []
       methods = self.dsa.get_class_methods(dotted_name)
       # move all __*__ methods to the back
       methods = ([m for m in methods if not m.startswith('_')] +
                  [m for m in methods if m.startswith('_')])
       # except for __init__, which should be first
       if '__init__' in methods:
           methods.remove('__init__')
           methods.insert(0, '__init__')
       for method in methods:
           ret += self.build_callable_view('%s.%s' % (dotted_name,
->                                                    method))
       return ret
apigen/htmlgen.py - line 378
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
   def build_callable_view(self, dotted_name):
       """ build the html for a class method """
       # XXX we may want to have seperate
       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)
       # i assume they're both either available or unavailable(XXX ?)
       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
apigen/tracer/docstorage.py - line 261
258
259
260
261
262
263
   def get_function_source(self, name):
       desc = self.ds.descs[name]
       try:
->         return str(py.code.Source(desc.pyobj))
       except IOError:
           return "Cannot get source"