kenenet 0.6.4__py3-none-any.whl → 0.6.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kenenet/__init__.py +17 -14
- {kenenet-0.6.4.dist-info → kenenet-0.6.5.dist-info}/METADATA +1 -1
- kenenet-0.6.5.dist-info/RECORD +5 -0
- kenenet-0.6.4.dist-info/RECORD +0 -5
- {kenenet-0.6.4.dist-info → kenenet-0.6.5.dist-info}/WHEEL +0 -0
- {kenenet-0.6.4.dist-info → kenenet-0.6.5.dist-info}/top_level.txt +0 -0
kenenet/__init__.py
CHANGED
@@ -49,7 +49,7 @@ def timer(clock=1):
|
|
49
49
|
|
50
50
|
class _Config:
|
51
51
|
EXCLUDED_NAMES = {'Config', 'VariableTracker', 'track_variables', 'stop_tracking',
|
52
|
-
'track_frame', 'sys', 'inspect', 'types', 'datetime',
|
52
|
+
'track_frame', 'sys', 'inspect', 'types', 'datetime', 'quick_print',
|
53
53
|
'self', 'cls', 'args', 'kwargs', '__class__'}
|
54
54
|
EXCLUDED_FILES = {'<string>', '<frozen importlib', 'importlib', 'abc.py', 'typing.py', '_collections_abc.py'}
|
55
55
|
SHOW_TIMESTAMPS = True
|
@@ -81,9 +81,7 @@ class _VariableTracker:
|
|
81
81
|
quick_print(f"{scope} '{name}' changed from {self._format_value(old)} -> {self._format_value(new)}", lineno)
|
82
82
|
|
83
83
|
def _should_track(self, name):
|
84
|
-
|
85
|
-
return False
|
86
|
-
return not (name.startswith('_') and name not in ('__name__', '__file__')) and name not in Config.EXCLUDED_NAMES
|
84
|
+
return not (name.startswith('_') and name not in ('__name__', '__file__')) and name not in _Config.EXCLUDED_NAMES
|
87
85
|
|
88
86
|
def _start_tracking(self, module_name):
|
89
87
|
if self.active: return
|
@@ -105,33 +103,38 @@ class _VariableTracker:
|
|
105
103
|
lineno = frame.f_lineno
|
106
104
|
quick_print(f"Stopped debugging", lineno)
|
107
105
|
|
108
|
-
def
|
109
|
-
tracker = _VariableTracker.
|
110
|
-
if not tracker.active or event != 'line': return
|
106
|
+
def track_frame(frame, event, arg):
|
107
|
+
tracker = _VariableTracker.get_instance()
|
108
|
+
if not tracker.active or event != 'line': return track_frame
|
109
|
+
|
110
|
+
# Skip tracking if function name is 'quick_print'
|
111
|
+
if frame.f_code.co_name == 'quick_print':
|
112
|
+
return track_frame
|
113
|
+
|
111
114
|
scope = "Global" if frame.f_code.co_name == '<module>' else f"Local in '{frame.f_code.co_name}'"
|
112
115
|
current_vars = {name: value for name, value in (frame.f_locals if scope != "Global" else frame.f_globals).items() if tracker._should_track(name)}
|
113
|
-
|
116
|
+
|
114
117
|
if scope == "Global":
|
115
118
|
for name, value in current_vars.items():
|
116
119
|
if name not in tracker.global_vars:
|
117
|
-
tracker.
|
120
|
+
tracker.print_change(name, None, value, scope)
|
118
121
|
elif tracker.global_vars[name] != value:
|
119
|
-
tracker.
|
122
|
+
tracker.print_change(name, tracker.global_vars[name], value, scope)
|
120
123
|
tracker.global_vars.update(current_vars)
|
121
124
|
else:
|
122
125
|
frame_id = id(frame)
|
123
126
|
if frame_id not in tracker.frame_locals:
|
124
127
|
for name, value in current_vars.items():
|
125
|
-
tracker.
|
128
|
+
tracker.print_change(name, None, value, scope)
|
126
129
|
else:
|
127
130
|
for name, value in current_vars.items():
|
128
131
|
if name not in tracker.frame_locals[frame_id]:
|
129
|
-
tracker.
|
132
|
+
tracker.print_change(name, None, value, scope)
|
130
133
|
elif tracker.frame_locals[frame_id][name] != value:
|
131
|
-
tracker.
|
134
|
+
tracker.print_change(name, tracker.frame_locals[frame_id][name], value, scope)
|
132
135
|
tracker.frame_locals[frame_id] = current_vars
|
133
136
|
if event == 'return' and scope != "Global": del tracker.frame_locals[id(frame)]
|
134
|
-
return
|
137
|
+
return track_frame
|
135
138
|
|
136
139
|
def debug():
|
137
140
|
global debug_mode
|
@@ -0,0 +1,5 @@
|
|
1
|
+
kenenet/__init__.py,sha256=GX9-JmTxzdj996qm_1fC3z4wHDPWlnZVnmn177T5Jqw,8464
|
2
|
+
kenenet-0.6.5.dist-info/METADATA,sha256=rjKeSqAQLHW8N7weRtaBYjKBO_cMTtGCV3xD43SzymI,633
|
3
|
+
kenenet-0.6.5.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
4
|
+
kenenet-0.6.5.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
|
5
|
+
kenenet-0.6.5.dist-info/RECORD,,
|
kenenet-0.6.4.dist-info/RECORD
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
kenenet/__init__.py,sha256=V_1QkItH8qrNH5crUZdtWQhmF9yAUOcHN_Q_IYUHxKQ,8388
|
2
|
-
kenenet-0.6.4.dist-info/METADATA,sha256=RzhyI7pjum0q09HMHKwXLCc3w_VOjSZiipgaZ1BtqgQ,633
|
3
|
-
kenenet-0.6.4.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
4
|
-
kenenet-0.6.4.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
|
5
|
-
kenenet-0.6.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|