kenenet 0.3.1__py3-none-any.whl → 0.3.3__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
@@ -1,10 +1,11 @@
1
1
  import inspect, sys, zhmiscellany, keyboard, mss, time, linecache, types, os
2
2
  import numpy as np
3
3
  from PIL import Image
4
- global timings
4
+ global timings, ospid
5
+ ospid = None
5
6
  timings = {}
6
7
 
7
- def _quick_print(message, l=None):
8
+ def quick_print(message, l=None):
8
9
  if l: sys.stdout.write(f"\033[38;2;0;255;26m{l} || {message}\033[0m\n")
9
10
  else: sys.stdout.write(f"\033[38;2;0;255;26m {message}\033[0m\n")
10
11
 
@@ -20,9 +21,9 @@ def get_pos(key='f10', kill=False):
20
21
  rgb = screenshot.pixel(0, 0)
21
22
  color = f"\033[38;2;{rgb[0]};{rgb[1]};{rgb[2]}m"
22
23
  reset = "\033[0m"
23
- _quick_print(f"Coordinates: ({x}, {y}), RGB: {rgb} {color}████████{reset}", lineno)
24
+ quick_print(f"Coordinates: ({x}, {y}), RGB: {rgb} {color}████████{reset}", lineno)
24
25
  if kill:
25
- _quick_print('killing process')
26
+ quick_print('killing process')
26
27
  zhmiscellany.misc.die()
27
28
  frame = inspect.currentframe().f_back
28
29
  lineno = frame.f_lineno
@@ -33,8 +34,9 @@ def timer(clock=1):
33
34
  elapsed = time.time() - timings[clock]
34
35
  frame = inspect.currentframe().f_back
35
36
  lineno = frame.f_lineno
36
- _quick_print(f'Timer {clock} took \033[97m{elapsed}\033[0m seconds', lineno)
37
+ quick_print(f'Timer {clock} took \033[97m{elapsed}\033[0m seconds', lineno)
37
38
  del timings[clock]
39
+ return elapsed
38
40
  else:
39
41
  timings[clock] = time.time()
40
42
 
@@ -56,11 +58,11 @@ def make_trace_function(ignore_special_vars=True, ignore_functions=True, ignore_
56
58
  return trace_lines
57
59
 
58
60
  header = f"Executing line {lineno}:" if ignore_file_path else f"Executing {filename}:{lineno}:"
59
- _quick_print("=" * 60)
60
- _quick_print(header, lineno)
61
- _quick_print(f" {code_line}", lineno)
62
- _quick_print("-" * 60, lineno)
63
- _quick_print("Local Variables:", lineno)
61
+ quick_print("=" * 60)
62
+ quick_print(header, lineno)
63
+ quick_print(f" {code_line}", lineno)
64
+ quick_print("-" * 60, lineno)
65
+ quick_print("Local Variables:", lineno)
64
66
 
65
67
  for var, value in frame.f_locals.items():
66
68
  if ignore_special_vars and var in special_vars:
@@ -72,11 +74,11 @@ def make_trace_function(ignore_special_vars=True, ignore_functions=True, ignore_
72
74
  if ignore_classes and isinstance(value, type):
73
75
  continue
74
76
  try:
75
- _quick_print(f" {var} = {repr(value)}", lineno)
77
+ quick_print(f" {var} = {repr(value)}", lineno)
76
78
  except (AttributeError, TypeError, Exception):
77
- _quick_print(f" {var} = [unreadable]", lineno)
79
+ quick_print(f" {var} = [unreadable]", lineno)
78
80
 
79
- _quick_print("=" * 60, lineno)
81
+ quick_print("=" * 60, lineno)
80
82
 
81
83
  return trace_lines
82
84
 
@@ -93,12 +95,12 @@ def activate_tracing(ignore_special_vars=True, ignore_functions=True, ignore_cla
93
95
  )
94
96
  sys.settrace(trace_func)
95
97
  sys._getframe().f_trace = trace_func
96
- _quick_print("Tracing activated.")
98
+ quick_print("Tracing activated.")
97
99
 
98
100
 
99
101
  def deactivate_tracing():
100
102
  sys.settrace(None)
101
- _quick_print("Tracing deactivated.")
103
+ quick_print("Tracing deactivated.")
102
104
 
103
105
  def pp(msg='caca', subdir=None, pps=3):
104
106
  import os, subprocess
@@ -118,21 +120,29 @@ def pp(msg='caca', subdir=None, pps=3):
118
120
  result = int(result.stdout.strip()) + 1
119
121
  for i in range(pps):
120
122
  push_pull(msg)
121
- _quick_print('PP finished B======D')
123
+ quick_print('PP finished B======D')
122
124
  os.chdir(os_current)
123
125
 
124
- def save_img(img, name='', file='temp_screenshots'):
125
- if os.path.exists(file): zhmiscellany.fileio.empty_directory(file)
126
- else: zhmiscellany.fileio.create_folder(file)
126
+ def save_img(img, name='', reset=True, file='temp_screenshots'):
127
+ global ospid
128
+ if ospid is None:
129
+ if os.path.exists(file):
130
+ if reset:
131
+ zhmiscellany.fileio.empty_directory(file)
132
+ quick_print(f'Cleaned folder {file}')
133
+ else:
134
+ quick_print(f'New folder created {file}')
135
+ zhmiscellany.fileio.create_folder(file)
136
+ ospid = True
127
137
  frame = inspect.currentframe().f_back
128
138
  lineno = frame.f_lineno
129
139
  if isinstance(img, np.ndarray):
130
140
  save_name = name + f'{time.time()}'
131
141
  img = Image.fromarray(img)
132
142
  img.save(f'{file}/{save_name}.png')
133
- _quick_print(f'Saved image as {save_name}', lineno)
143
+ quick_print(f'Saved image as {save_name}', lineno)
134
144
  else:
135
- _quick_print(f"Your img is not a fucking numpy array you twat, couldn't save {name}", lineno)
145
+ quick_print(f"Your img is not a fucking numpy array you twat, couldn't save {name}", lineno)
136
146
 
137
147
  class k:
138
148
  pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: kenenet
3
- Version: 0.3.1
3
+ Version: 0.3.3
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=mh1DTHPUVh0xeqNA5W7-1jp84afONMmtT861ND8vna4,5897
2
+ kenenet-0.3.3.dist-info/METADATA,sha256=dQS4Hcqff-vLrAUu7Ql_FMjWETliqn_jH3nEKO-C4xU,513
3
+ kenenet-0.3.3.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
4
+ kenenet-0.3.3.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
5
+ kenenet-0.3.3.dist-info/RECORD,,
@@ -1,5 +0,0 @@
1
- kenenet/__init__.py,sha256=LkhSQnZjdtyGRvOVAPP_-vEX8fHZnyFh4hGgruVKg-E,5627
2
- kenenet-0.3.1.dist-info/METADATA,sha256=JZ846mPc_CN1nitMKhai6IpbaD4DhseHoNg0lPT5UkA,513
3
- kenenet-0.3.1.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
4
- kenenet-0.3.1.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
5
- kenenet-0.3.1.dist-info/RECORD,,