kenenet 0.9.6__py3-none-any.whl → 0.9.8__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 +19 -20
- {kenenet-0.9.6.dist-info → kenenet-0.9.8.dist-info}/METADATA +1 -1
- kenenet-0.9.8.dist-info/RECORD +5 -0
- kenenet-0.9.6.dist-info/RECORD +0 -5
- {kenenet-0.9.6.dist-info → kenenet-0.9.8.dist-info}/WHEEL +0 -0
- {kenenet-0.9.6.dist-info → kenenet-0.9.8.dist-info}/top_level.txt +0 -0
kenenet/__init__.py
CHANGED
@@ -291,8 +291,7 @@ _ignore_line = {'frame = inspect.currentframe().f_back', 'filename = frame.f_cod
|
|
291
291
|
|
292
292
|
def time_code(label=None):
|
293
293
|
global _current_context, _timings, _line_start_time, _block_timings, _stack, _ignore_line
|
294
|
-
|
295
|
-
chunks = True
|
294
|
+
|
296
295
|
# Get the frame of the caller
|
297
296
|
frame = inspect.currentframe().f_back
|
298
297
|
filename = frame.f_code.co_filename
|
@@ -367,35 +366,35 @@ def time_code(label=None):
|
|
367
366
|
return
|
368
367
|
|
369
368
|
sorted_timings = sorted(_timings[context], key=lambda x: x[2], reverse=True)
|
370
|
-
if details:
|
371
|
-
quick_print(f"\nTime spent on each line: {context}")
|
372
|
-
quick_print("-" * 80)
|
373
|
-
quick_print(f"{'Line':>6} | {'Time':>12} | Code")
|
374
|
-
quick_print("-" * 80)
|
375
369
|
|
376
|
-
|
377
|
-
|
378
|
-
|
370
|
+
quick_print(f"\nTime spent on each line: {context}")
|
371
|
+
quick_print("-" * 80)
|
372
|
+
quick_print(f"{'Line':>6} | {'Time':>12} | Code")
|
373
|
+
quick_print("-" * 80)
|
379
374
|
|
380
|
-
|
375
|
+
for lineno, line_content, elapsed in sorted_timings:
|
376
|
+
if line_content not in _ignore_line:
|
377
|
+
quick_print(f"{lineno:6d} | {elapsed:12.6f} | {line_content}")
|
378
|
+
|
379
|
+
quick_print("-" * 80)
|
381
380
|
total_time = sum(elapsed for _, _, elapsed in _timings[context])
|
382
|
-
|
381
|
+
quick_print(f"Total execution time: {total_time:.6f}")
|
383
382
|
|
384
383
|
if _block_timings:
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
quick_print("-" * 80)
|
384
|
+
quick_print("\nTime spent on chunks of code:")
|
385
|
+
quick_print("-" * 80)
|
386
|
+
quick_print(f"{'Chunks':^40} | {'Time':>12} | {'% of Time Spent':>10}")
|
387
|
+
quick_print("-" * 80)
|
390
388
|
|
391
389
|
# Sort block timings by time
|
392
390
|
sorted_blocks = sorted(_block_timings.items(), key=lambda x: x[1], reverse=True)
|
393
|
-
|
394
|
-
|
391
|
+
|
392
|
+
for block, elapsed in sorted_blocks:
|
393
|
+
if block not in _ignore_line:
|
395
394
|
percentage = (elapsed / total_time) * 100 if total_time > 0 else 0
|
396
395
|
quick_print(f"{block[:40]:40} | {elapsed:12.6f} | {percentage:10.2f}%")
|
397
396
|
|
398
|
-
|
397
|
+
quick_print("-" * 80)
|
399
398
|
|
400
399
|
# Clear the timing data for this context
|
401
400
|
del _timings[context]
|
@@ -0,0 +1,5 @@
|
|
1
|
+
kenenet/__init__.py,sha256=N3-C4X0pHXQJYR_CdbGYpx9Okgd0n-wG4uvp9JGag38,16420
|
2
|
+
kenenet-0.9.8.dist-info/METADATA,sha256=jmDhhRmAEnOONwHDPqo9QEpLUG-7VKOQO1kMN__785M,633
|
3
|
+
kenenet-0.9.8.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
4
|
+
kenenet-0.9.8.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
|
5
|
+
kenenet-0.9.8.dist-info/RECORD,,
|
kenenet-0.9.6.dist-info/RECORD
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
kenenet/__init__.py,sha256=0S9fCg6dyv5mBl-X047iUobXNr1lh15He68gsp89P-I,16526
|
2
|
-
kenenet-0.9.6.dist-info/METADATA,sha256=YGiXaTdiHRFNxB_ljZY58JH7uhzotlbo6Om74XzcCTQ,633
|
3
|
-
kenenet-0.9.6.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
4
|
-
kenenet-0.9.6.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
|
5
|
-
kenenet-0.9.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|