kenenet 1.1.5__py3-none-any.whl → 1.1.7__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
@@ -7,6 +7,10 @@ import pyaudio
7
7
  from pydub import AudioSegment
8
8
  from zhmiscellany._processing_supportfuncs import _ray_init_thread
9
9
  import zhmiscellany.processing
10
+ import math
11
+ import pygame
12
+ os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
13
+ import io
10
14
  global timings, ospid, debug_mode
11
15
  ospid, debug_mode = None, False
12
16
  timings = {}
@@ -189,24 +193,27 @@ def save_img(img, name=' ', reset=True, file='temp_screenshots', mute=False):
189
193
  ospid = True
190
194
  frame = inspect.currentframe().f_back
191
195
  lineno = frame.f_lineno
192
- if isinstance(img, np.ndarray):
193
- save_name = name + f'{time.time()}'
194
- img = Image.fromarray(img)
195
- img.save(fr'{file}\{save_name}.png')
196
- if not mute: quick_print(f'Saved image as {save_name}', lineno)
197
- else:
198
- quick_print(f"Your img is not a fucking numpy array you twat, couldn't save {name}", lineno)
199
196
 
197
+ if not isinstance(img, np.ndarray):
198
+ quick_print(f"Your img is not a fucking numpy array you twat, couldn't save {name}", lineno)
199
+ return
200
200
 
201
- import random
202
- import threading
203
- import math
204
- import pygame
205
- from pydub import AudioSegment
206
- import io
207
- import time
208
- import zhmiscellany
201
+ save_name = name + f'{time.time()}'
202
+ arr = img
203
+ if arr.ndim == 3 and arr.shape[2] == 3:
204
+ im = Image.fromarray(arr)
205
+ else:
206
+ g = arr.squeeze()
207
+ if np.issubdtype(g.dtype, np.floating):
208
+ g = (np.clip(g, 0, 1) * 255).astype(np.uint8)
209
+ else:
210
+ g = g.astype(np.uint8)
211
+ im = Image.fromarray(g, mode='L')
209
212
 
213
+ path = os.path.join(file, f'{save_name}.png')
214
+ im.save(path)
215
+ if not mute:
216
+ quick_print(f'Saved image as {save_name}', lineno)
210
217
 
211
218
  class _load_audio:
212
219
  def __init__(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kenenet
3
- Version: 1.1.5
3
+ Version: 1.1.7
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=6fDdc-6WpO8jipy2CyfYUYc6E3Q-RlD7M4iVtRZ9-6Y,21482
2
+ kenenet-1.1.7.dist-info/METADATA,sha256=gT81Xu95QgcjcRP1jzRcKn1bMpu2NdQkYb3SF21wDX4,1693
3
+ kenenet-1.1.7.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
4
+ kenenet-1.1.7.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
5
+ kenenet-1.1.7.dist-info/RECORD,,
@@ -1,5 +0,0 @@
1
- kenenet/__init__.py,sha256=tMVkB3fPhXYdNC__SMFyruGjtNgeNO7puOj-Du3xQEY,21197
2
- kenenet-1.1.5.dist-info/METADATA,sha256=XNihhj3UoeWBGCeXFPOXis_hMsIngKMojvcRUO4qvSg,1693
3
- kenenet-1.1.5.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
4
- kenenet-1.1.5.dist-info/top_level.txt,sha256=gUsWXLrM0jF4b4nbYJZdksdFewIx_F3xOF-zER8fMuQ,8
5
- kenenet-1.1.5.dist-info/RECORD,,