MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / DebuggerInstance

Class DebuggerInstance

web/pgadmin/tools/debugger/utils/debugger_instance.py:17–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15
16
17class DebuggerInstance():
18 def __init__(self, trans_id=None):
19 if trans_id is None:
20 self._trans_id = str(secrets.choice(range(1, 9999999)))
21 else:
22 self._trans_id = str(trans_id)
23
24 self._function_data = None
25 self._debugger_data = None
26 self.load_from_session()
27
28 @property
29 def trans_id(self):
30 """
31 trans_id be readonly with no setter
32 """
33 return self._trans_id
34
35 @property
36 def function_data(self):
37 return self._function_data
38
39 @function_data.setter
40 def function_data(self, data):
41 self._function_data = data
42 self.update_session()
43
44 @property
45 def debugger_data(self):
46 return self._debugger_data
47
48 @debugger_data.setter
49 def debugger_data(self, data):
50 self._debugger_data = data
51 self.update_session()
52
53 @staticmethod
54 def get_trans_ids():
55 if '__debugger_sessions' in session:
56 return [trans_id for trans_id in session['__debugger_sessions']]
57 else:
58 return []
59
60 def load_from_session(self):
61 if '__debugger_sessions' in session and \
62 str(self.trans_id) in session['__debugger_sessions']:
63 trans_data = session['__debugger_sessions'][str(self.trans_id)]
64 self.function_data = trans_data.get('function_data', None)
65 self.debugger_data = trans_data.get('debugger_data', None)
66
67 def update_session(self):
68 with debugger_sessions_lock:
69 if '__debugger_sessions' not in session:
70 session['__debugger_sessions'] = dict()
71
72 session['__debugger_sessions'][str(self.trans_id)] = dict(
73 function_data=self.function_data,
74 debugger_data=self.debugger_data

Callers 15

init_functionFunction · 0.90
direct_newFunction · 0.90
initialize_targetFunction · 0.90
restart_debuggingFunction · 0.90
start_debugger_listenerFunction · 0.90
execute_debugger_queryFunction · 0.90
messagesFunction · 0.90
start_executionFunction · 0.90
set_clear_breakpointFunction · 0.90
clear_all_breakpointFunction · 0.90
deposit_parameter_valueFunction · 0.90
select_frameFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected