kenenet 0.3.2__py3-none-any.whl → 0.3.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 +37 -21
- {kenenet-0.3.2.dist-info → kenenet-0.3.5.dist-info}/METADATA +1 -1
- kenenet-0.3.5.dist-info/RECORD +5 -0
- kenenet-0.3.2.dist-info/RECORD +0 -5
- {kenenet-0.3.2.dist-info → kenenet-0.3.5.dist-info}/WHEEL +0 -0
- {kenenet-0.3.2.dist-info → kenenet-0.3.5.dist-info}/top_level.txt +0 -0
kenenet/__init__.py
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
-
import inspect, sys, zhmiscellany, keyboard, mss, time, linecache, types, os
|
1
|
+
import inspect, sys, zhmiscellany, keyboard, mss, time, linecache, types, os, random
|
2
2
|
import numpy as np
|
3
3
|
from PIL import Image
|
4
4
|
global timings, ospid
|
5
|
+
from pydub import AudioSegment
|
6
|
+
from pydub.playback import play
|
5
7
|
ospid = None
|
6
8
|
timings = {}
|
7
9
|
|
8
|
-
def
|
10
|
+
def quick_print(message, l=None):
|
9
11
|
if l: sys.stdout.write(f"\033[38;2;0;255;26m{l} || {message}\033[0m\n")
|
10
12
|
else: sys.stdout.write(f"\033[38;2;0;255;26m {message}\033[0m\n")
|
11
13
|
|
@@ -21,9 +23,9 @@ def get_pos(key='f10', kill=False):
|
|
21
23
|
rgb = screenshot.pixel(0, 0)
|
22
24
|
color = f"\033[38;2;{rgb[0]};{rgb[1]};{rgb[2]}m"
|
23
25
|
reset = "\033[0m"
|
24
|
-
|
26
|
+
quick_print(f"Coordinates: ({x}, {y}), RGB: {rgb} {color}████████{reset}", lineno)
|
25
27
|
if kill:
|
26
|
-
|
28
|
+
quick_print('killing process')
|
27
29
|
zhmiscellany.misc.die()
|
28
30
|
frame = inspect.currentframe().f_back
|
29
31
|
lineno = frame.f_lineno
|
@@ -34,8 +36,9 @@ def timer(clock=1):
|
|
34
36
|
elapsed = time.time() - timings[clock]
|
35
37
|
frame = inspect.currentframe().f_back
|
36
38
|
lineno = frame.f_lineno
|
37
|
-
|
39
|
+
quick_print(f'Timer {clock} took \033[97m{elapsed}\033[0m seconds', lineno)
|
38
40
|
del timings[clock]
|
41
|
+
return elapsed
|
39
42
|
else:
|
40
43
|
timings[clock] = time.time()
|
41
44
|
|
@@ -57,11 +60,11 @@ def make_trace_function(ignore_special_vars=True, ignore_functions=True, ignore_
|
|
57
60
|
return trace_lines
|
58
61
|
|
59
62
|
header = f"Executing line {lineno}:" if ignore_file_path else f"Executing {filename}:{lineno}:"
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
63
|
+
quick_print("=" * 60)
|
64
|
+
quick_print(header, lineno)
|
65
|
+
quick_print(f" {code_line}", lineno)
|
66
|
+
quick_print("-" * 60, lineno)
|
67
|
+
quick_print("Local Variables:", lineno)
|
65
68
|
|
66
69
|
for var, value in frame.f_locals.items():
|
67
70
|
if ignore_special_vars and var in special_vars:
|
@@ -73,11 +76,11 @@ def make_trace_function(ignore_special_vars=True, ignore_functions=True, ignore_
|
|
73
76
|
if ignore_classes and isinstance(value, type):
|
74
77
|
continue
|
75
78
|
try:
|
76
|
-
|
79
|
+
quick_print(f" {var} = {repr(value)}", lineno)
|
77
80
|
except (AttributeError, TypeError, Exception):
|
78
|
-
|
81
|
+
quick_print(f" {var} = [unreadable]", lineno)
|
79
82
|
|
80
|
-
|
83
|
+
quick_print("=" * 60, lineno)
|
81
84
|
|
82
85
|
return trace_lines
|
83
86
|
|
@@ -94,12 +97,12 @@ def activate_tracing(ignore_special_vars=True, ignore_functions=True, ignore_cla
|
|
94
97
|
)
|
95
98
|
sys.settrace(trace_func)
|
96
99
|
sys._getframe().f_trace = trace_func
|
97
|
-
|
100
|
+
quick_print("Tracing activated.")
|
98
101
|
|
99
102
|
|
100
103
|
def deactivate_tracing():
|
101
104
|
sys.settrace(None)
|
102
|
-
|
105
|
+
quick_print("Tracing deactivated.")
|
103
106
|
|
104
107
|
def pp(msg='caca', subdir=None, pps=3):
|
105
108
|
import os, subprocess
|
@@ -119,14 +122,19 @@ def pp(msg='caca', subdir=None, pps=3):
|
|
119
122
|
result = int(result.stdout.strip()) + 1
|
120
123
|
for i in range(pps):
|
121
124
|
push_pull(msg)
|
122
|
-
|
125
|
+
quick_print('PP finished B======D')
|
123
126
|
os.chdir(os_current)
|
124
127
|
|
125
|
-
def save_img(img, name='', file='temp_screenshots'):
|
128
|
+
def save_img(img, name='', reset=True, file='temp_screenshots'):
|
126
129
|
global ospid
|
127
130
|
if ospid is None:
|
128
|
-
if os.path.exists(file):
|
129
|
-
|
131
|
+
if os.path.exists(file):
|
132
|
+
if reset:
|
133
|
+
zhmiscellany.fileio.empty_directory(file)
|
134
|
+
quick_print(f'Cleaned folder {file}')
|
135
|
+
else:
|
136
|
+
quick_print(f'New folder created {file}')
|
137
|
+
zhmiscellany.fileio.create_folder(file)
|
130
138
|
ospid = True
|
131
139
|
frame = inspect.currentframe().f_back
|
132
140
|
lineno = frame.f_lineno
|
@@ -134,10 +142,18 @@ def save_img(img, name='', file='temp_screenshots'):
|
|
134
142
|
save_name = name + f'{time.time()}'
|
135
143
|
img = Image.fromarray(img)
|
136
144
|
img.save(f'{file}/{save_name}.png')
|
137
|
-
|
145
|
+
quick_print(f'Saved image as {save_name}', lineno)
|
138
146
|
else:
|
139
|
-
|
147
|
+
quick_print(f"Your img is not a fucking numpy array you twat, couldn't save {name}", lineno)
|
140
148
|
|
149
|
+
def load_audio(mp3_path):
|
150
|
+
AudioSegment.from_mp3(mp3_path)
|
151
|
+
|
152
|
+
def play_audio(file_sound, range=(0.9, 1.1)):
|
153
|
+
sound = file_sound
|
154
|
+
sound = sound._spawn(sound.raw_data, overrides={'frame_rate': int(sound.frame_rate * random.uniform(*range))})
|
155
|
+
zhmiscellany.processing.multiprocess_threaded(play, (sound,))
|
156
|
+
|
141
157
|
class k:
|
142
158
|
pass
|
143
159
|
|
@@ -0,0 +1,5 @@
|
|
1
|
+
kenenet/__init__.py,sha256=wCq5QvgqxvmI3p3mATg77l6m0SydI6W7OwZ0GOhC7xU,6300
|
2
|
+
kenenet-0.3.5.dist-info/METADATA,sha256=XdwZ0JkVWgmcfa6rM-xM3hr0QN-zqpRacUE8StzaqhA,513
|
3
|
+
kenenet-0.3.5.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
4
|
+
kenenet-0.3.5.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
|
5
|
+
kenenet-0.3.5.dist-info/RECORD,,
|
kenenet-0.3.2.dist-info/RECORD
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
kenenet/__init__.py,sha256=AdvYkPtf7zKAmh_6qs_sXsanUCmV_RFaLtvzlJ6ddQ8,5715
|
2
|
-
kenenet-0.3.2.dist-info/METADATA,sha256=OGQnX4dPx2hFFO9wCYAiwJnrrU-IhNIBpY0s3UioIe4,513
|
3
|
-
kenenet-0.3.2.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
4
|
-
kenenet-0.3.2.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
|
5
|
-
kenenet-0.3.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|