1
2 """contains report implementations allowing to analyse the callgraph of """
3 __docformat__ = "restructuredtext"
4
5
7 """Provides main interface for all reports as well as the basic implementation"""
8
9
11 """intiialize the report with the given callgraph"""
12 self._callgraph = callgraph
13
14
15
16
17
19 """:return: report as result of a prior Callgraph analysis"""
20 raise NotImplementedError( "This method needs to be implemented by subclasses" )
21
22
23
24
25 -class Plan( ReportBase ):
26 """Create a plan-like text describing how the target is being made"""
27
29 """Create a list of ProcessData instances that reflects the call order"""
30 kwargs = {}
31 kwargs[ 'reverse' ] = True
32 return self._callgraph.toCallList( **kwargs )
33
34
36 """
37 :return: list of strings ( lines ) resembling a plan-like formatting
38 of the call graph
39 :param headline: line to be given as first line """
40 cl = self._analyseCallgraph( )
41
42 out = []
43 if headline:
44 out.append( headline )
45
46 for i,pedge in enumerate( cl ):
47 sp,ep = pedge
48 i += 1
49
50 if ep:
51 line = "%i. %s provides %r through %s to %s" % ( i, sp.process.id(), sp.result(), sp.plug, ep.process.noun )
52 else:
53
54 line = "%i. %s %s %r when asked for %s" % ( i, sp.process.id(), sp.process.verb, sp.result(), sp.plug )
55 out.append( line )
56
57 return out
58