File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change 1
1
import sys
2
2
import collections
3
3
4
+ from pathlib import Path
4
5
from ..views import RunningObject
5
6
6
7
@@ -10,20 +11,30 @@ class ExceptionWhileTracing(Exception):
10
11
pass
11
12
12
13
13
-
14
-
15
14
class Trace :
16
15
17
16
def __init__ (self ):
18
17
self .detailed_data = collections .defaultdict (
19
- lambda : {"call" : 0 , "return" : 0 , "line" : 0 , "exception" : 0 }
18
+ lambda : {
19
+ "call" : 0 ,
20
+ "return" : 0 ,
21
+ "line" : 0 ,
22
+ "exception" : 0 ,
23
+ "file" : Path (),
24
+ "start_line" : int ,
25
+ }
20
26
)
21
27
self .functions_flow = collections .OrderedDict ()
22
28
23
29
def _trace_function (self , frame , event , arg ):
24
30
self .detailed_data [frame .f_code .co_name ][str (event )] += 1
25
31
self .functions_flow [frame .f_code .co_name ] = None
26
-
32
+ self .detailed_data [frame .f_code .co_name ]["file" ] = Path (
33
+ frame .f_code .co_filename
34
+ )
35
+ self .detailed_data [frame .f_code .co_name ][
36
+ "start_line"
37
+ ] = frame .f_code .co_firstlineno
27
38
if str (event ) == "exception" :
28
39
raise ExceptionWhileTracing ()
29
40
@@ -46,6 +57,9 @@ def trace_obj(self, running_obj: RunningObject):
46
57
raise Exception (f"Given object '{ running_obj } ' is not callable." )
47
58
self ._running_trace (running_obj )
48
59
60
+ def abc (self ):
61
+ print ("" )
62
+
49
63
def __str__ (self ):
50
64
text = "Trace object\n runned objects:\n "
51
65
You can’t perform that action at this time.
0 commit comments