kenenet 0.9.4__py3-none-any.whl → 0.9.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 CHANGED
@@ -289,7 +289,7 @@ _line_start_time = None
289
289
  _stack = []
290
290
  _ignore_line = {'frame = inspect.currentframe().f_back', 'filename = frame.f_code.co_filename', 'if _current_context is None:', 'sys.settrace(None)', 'currentframe'}
291
291
 
292
- def time_code(label=None):
292
+ def time_code(details=True, chunks=True, label=None):
293
293
  global _current_context, _timings, _line_start_time, _block_timings, _stack, _ignore_line
294
294
 
295
295
  # Get the frame of the caller
@@ -366,34 +366,35 @@ def time_code(label=None):
366
366
  return
367
367
 
368
368
  sorted_timings = sorted(_timings[context], key=lambda x: x[2], reverse=True)
369
+ if details:
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)
369
374
 
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)
374
-
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}")
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
378
 
379
- quick_print("-" * 80)
379
+ quick_print("-" * 80)
380
380
  total_time = sum(elapsed for _, _, elapsed in _timings[context])
381
- quick_print(f"Total execution time: {total_time:.6f}")
381
+ if details: quick_print(f"Total execution time: {total_time:.6f}")
382
382
 
383
383
  if _block_timings:
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)
384
+ if chunks:
385
+ quick_print("\nTime spent on chunks of code:")
386
+ quick_print("-" * 80)
387
+ quick_print(f"{'Chunks':^40} | {'Time':>12} | {'% of Time Spent':>10}")
388
+ quick_print("-" * 80)
388
389
 
389
390
  # Sort block timings by time
390
391
  sorted_blocks = sorted(_block_timings.items(), key=lambda x: x[1], reverse=True)
392
+ if chunks:
393
+ for block, elapsed in sorted_blocks:
394
+ percentage = (elapsed / total_time) * 100 if total_time > 0 else 0
395
+ quick_print(f"{block[:40]:40} | {elapsed:12.6f} | {percentage:10.2f}%")
391
396
 
392
- for block, elapsed in sorted_blocks:
393
- percentage = (elapsed / total_time) * 100 if total_time > 0 else 0
394
- quick_print(f"{block[:40]:40} | {elapsed:12.6f} | {percentage:10.2f}%")
395
-
396
- quick_print("-" * 80)
397
+ if chunks: quick_print("-" * 80)
397
398
 
398
399
  # Clear the timing data for this context
399
400
  del _timings[context]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kenenet
3
- Version: 0.9.4
3
+ Version: 0.9.5
4
4
  Summary: dude what the fuck even is this package
5
5
  Home-page: https://www.youtube.com/@KiddyKene
6
6
  Author: kiddykene
@@ -0,0 +1,5 @@
1
+ kenenet/__init__.py,sha256=GBgXUBDyYUIZOEc6S-N7AymUAA1YZBUvkRRuG8paV78,16520
2
+ kenenet-0.9.5.dist-info/METADATA,sha256=eV_WXprch9sJIqtwJNYOoXWUefVZldqV-4nc6A86Hck,633
3
+ kenenet-0.9.5.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
4
+ kenenet-0.9.5.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
5
+ kenenet-0.9.5.dist-info/RECORD,,
@@ -1,5 +0,0 @@
1
- kenenet/__init__.py,sha256=Nipv-MgQBf0nS11_zniIR6ScarwbZhSO31rhyqo3IR0,16365
2
- kenenet-0.9.4.dist-info/METADATA,sha256=Q8xIFxvP_u9nBAsK0nkjOx7xmfC70xjc7UCqrfZHnfE,633
3
- kenenet-0.9.4.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
4
- kenenet-0.9.4.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
5
- kenenet-0.9.4.dist-info/RECORD,,