zhmiscellany 6.2.3__py3-none-any.whl → 6.2.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.
zhmiscellany/pipes.py CHANGED
@@ -1,17 +1,8 @@
1
- import threading
2
- import queue
3
- import time
4
1
  import sys
5
- import zhmiscellany.string
6
2
 
7
3
  WIN32_AVAILABLE = False
8
4
  if sys.platform == "win32":
9
- try:
10
- import win32pipe
11
- import win32file
12
- WIN32_AVAILABLE = True
13
- except ImportError:
14
- print("Warning: pywin32 not available, Windows pipe features disabled")
5
+ WIN32_AVAILABLE = True
15
6
 
16
7
 
17
8
  class PipeTransmitter:
@@ -19,7 +10,8 @@ class PipeTransmitter:
19
10
  if not WIN32_AVAILABLE:
20
11
  print("PipeTransmitter only supports Windows!")
21
12
  return
22
-
13
+ import threading
14
+ import queue
23
15
  self.pipe_name = r'\\.\pipe'+'\\'+pipe_name
24
16
  self.close_pipes = close_pipes
25
17
  self.send_queue = queue.Queue()
@@ -31,7 +23,8 @@ class PipeTransmitter:
31
23
  def send_data_thread(self):
32
24
  if not WIN32_AVAILABLE:
33
25
  return
34
-
26
+ import win32pipe
27
+ import win32file
35
28
  pipe_handle = win32pipe.CreateNamedPipe(
36
29
  self.pipe_name,
37
30
  win32pipe.PIPE_ACCESS_OUTBOUND,
@@ -60,7 +53,8 @@ class PipeReceiver:
60
53
  if not WIN32_AVAILABLE:
61
54
  print("PipeReceiver only supports Windows!")
62
55
  return
63
-
56
+ import threading
57
+ import queue
64
58
  self.pipe_name = r'\\.\pipe'+'\\'+pipe_name
65
59
  self.receive_queue = queue.Queue()
66
60
  self.callback_function = None
@@ -72,7 +66,7 @@ class PipeReceiver:
72
66
  def receive_data_thread(self):
73
67
  if not WIN32_AVAILABLE:
74
68
  return
75
-
69
+ import win32file
76
70
  pipe_handle = win32file.CreateFile(
77
71
  self.pipe_name,
78
72
  win32file.GENERIC_READ,
@@ -103,7 +97,7 @@ def raw_receive_data(pipe_name):
103
97
  if not WIN32_AVAILABLE:
104
98
  print("raw_receive_data only supports Windows! Returning None")
105
99
  return None
106
-
100
+ import win32file
107
101
  try:
108
102
  pipe_name = r'\\.\pipe' + '\\' + pipe_name
109
103
  pipe_handle = win32file.CreateFile(
@@ -121,11 +115,15 @@ def raw_receive_data(pipe_name):
121
115
 
122
116
 
123
117
  def raw_send_data(data, pipe_name):
118
+ import threading
124
119
  if not WIN32_AVAILABLE:
125
120
  print("raw_send_data only supports Windows!")
126
121
  return
127
122
 
128
123
  def _raw_send_data(data, pipe_name):
124
+ import win32pipe
125
+ import win32file
126
+ import time
129
127
  sent = False
130
128
  while not sent:
131
129
  try:
@@ -1,13 +1,7 @@
1
- from ._processing_supportfuncs import batch_multiprocess, multiprocess, synchronous_class_multiprocess, ThreadWithResult
2
- import threading, kthread
3
- import traceback
4
- import zhmiscellany.string
5
- import concurrent.futures
6
- import subprocess, zlib, pickle, dill, tempfile, os, base64
7
- from itertools import chain
8
-
1
+ import threading
9
2
 
10
3
  def start_daemon(**kwargs):
4
+ import threading
11
5
  thread = threading.Thread(**kwargs)
12
6
  thread.daemon = True
13
7
  thread.start()
@@ -15,6 +9,9 @@ def start_daemon(**kwargs):
15
9
 
16
10
 
17
11
  def batch_threading(targets, max_threads=None, show_errors=True, flatten=False):
12
+ import concurrent.futures
13
+ import traceback
14
+ from itertools import chain
18
15
  def execute_target(target):
19
16
  try: return target[0](*target[1])
20
17
  except Exception:
@@ -34,6 +31,8 @@ def batch_threading(targets, max_threads=None, show_errors=True, flatten=False):
34
31
 
35
32
 
36
33
  def batch_threading_gen(targets, max_threads=None, show_errors=True):
34
+ import concurrent.futures
35
+ import traceback
37
36
  def execute_target(target):
38
37
  try: return target[0](*target[1])
39
38
  except Exception:
@@ -49,6 +48,9 @@ def batch_threading_gen(targets, max_threads=None, show_errors=True):
49
48
 
50
49
 
51
50
  def batch_multiprocess_threaded(targets_and_args, disable_warning=False, killable=False, daemon=False):
51
+ import kthread
52
+ import threading
53
+ from ._processing_supportfuncs import batch_multiprocess
52
54
  if killable:
53
55
  thread_method = kthread.KThread
54
56
  else:
@@ -65,6 +67,13 @@ def multiprocess_threaded(target, args=(), disable_warning=False, killable=False
65
67
 
66
68
 
67
69
  def raw_multiprocess(func, args=(), fileless=True):
70
+ import zhmiscellany.string
71
+ import subprocess
72
+ import tempfile
73
+ import os
74
+ import zlib
75
+ import pickle
76
+ import dill
68
77
  cap_string = b'|'+bytes(zhmiscellany.string.get_universally_unique_string(), 'u8')+b'|'
69
78
  code = \
70
79
  '''import os, dill, zlib, sys, pickle, traceback, psutil, signal
@@ -158,6 +167,14 @@ if __name__ == "__main__":
158
167
 
159
168
 
160
169
  def raw_continuous_multiprocess(input_class, args=(), fileless=True, cleanup_file=True):
170
+ import zhmiscellany.string
171
+ import subprocess
172
+ import tempfile
173
+ import os
174
+ import zlib
175
+ import pickle
176
+ import dill
177
+ import base64
161
178
  cap_string = b'|' + bytes(zhmiscellany.string.get_universally_unique_string(), 'u8') + b'|'
162
179
  block_header_string = b'|' + bytes(zhmiscellany.string.get_universally_unique_string(), 'u8') + b'|'
163
180
  completion_marker = b'|' + bytes(zhmiscellany.string.get_universally_unique_string(), 'u8') + b'|'
zhmiscellany/rust.py CHANGED
@@ -1,10 +1,12 @@
1
1
  import zhmiscellanyrusteffect
2
- import numpy as np
3
2
 
4
3
  list_files_recursive = zhmiscellanyrusteffect.list_files_recursive
5
4
  def numpy_mean(np_arr):
5
+ import numpy as np
6
6
  return zhmiscellanyrusteffect.np_mean(np_arr.astype(np.float64, copy=False))
7
7
  def numpy_sum(np_arr):
8
+ import numpy as np
8
9
  return zhmiscellanyrusteffect.np_sum(np_arr.astype(np.float64, copy=False))
9
10
  def numpy_median(np_arr):
11
+ import numpy as np
10
12
  return zhmiscellanyrusteffect.np_median(np_arr.astype(np.float64, copy=False))
zhmiscellany/string.py CHANGED
@@ -1,7 +1,5 @@
1
- import string, time, datetime
2
-
3
-
4
1
  def convert_to_base62(number):
2
+ import string
5
3
  number = int(str(number).replace('.', ''))
6
4
  # Base 62 characters: digits (0-9), lowercase letters (a-z), and uppercase letters (A-Z)
7
5
  base62_chars = string.digits + string.ascii_lowercase + string.ascii_uppercase
@@ -17,6 +15,7 @@ def convert_to_base62(number):
17
15
 
18
16
 
19
17
  def get_universally_unique_string():
18
+ import time
20
19
  #number = None
21
20
  #if not number:
22
21
  timestamp = str(time.perf_counter_ns())
@@ -40,6 +39,7 @@ def multi_replace(string, replaces, recursive=False):
40
39
 
41
40
 
42
41
  def timestamp_to_time(unix_timestamp):
42
+ import datetime
43
43
  # Convert the Unix timestamp to a datetime object
44
44
  dt_object = datetime.datetime.fromtimestamp(unix_timestamp)
45
45
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: zhmiscellany
3
- Version: 6.2.3
3
+ Version: 6.2.5
4
4
  Summary: A collection of useful/interesting python libraries made by zh.
5
5
  Home-page: https://discord.gg/ThBBAuueVJ
6
6
  Author: zh
@@ -0,0 +1,27 @@
1
+ zhmiscellany/__init__.py,sha256=n18TrUpZfgMfUzNsVvokokHamWXWOCjXJ8XO1XXN6Xk,1147
2
+ zhmiscellany/_discord_supportfuncs.py,sha256=cCvru9zGEeFxn-hqnBeI6fFYoKTWeTQIHvZTHcudfe8,6510
3
+ zhmiscellany/_fileio_supportfuncs.py,sha256=RZxakXD4tb05AXJXgHS4ZI-Lr9A8fY_LcWe2-8EeF9Y,436
4
+ zhmiscellany/_misc_supportfuncs.py,sha256=gprZ1b7PgfSlAppMlHxRQImV-ks4IXFe7LZhbVecLUQ,13839
5
+ zhmiscellany/_processing_supportfuncs.py,sha256=kKP_dChzkci9zleP3nEvEEIz0Jd8DJ3X0Hi3Qah9eK8,11449
6
+ zhmiscellany/_py_resources.py,sha256=eEEvqa-C7jYFrUnKLvemO77_h1-TdzEe_QsLal86P8U,229013
7
+ zhmiscellany/_resource_files_lookup.py,sha256=hsgPW0dngokgqWrAVAv5rUo-eobzJPjvWHt4xrOG5l0,856
8
+ zhmiscellany/cpp.py,sha256=XEUEoIKCDCdY5VgwNWE5oXrGjtsmGdz_MnaVwQmi2dk,179
9
+ zhmiscellany/dict.py,sha256=dNu3G9qiJeLgE7JY3QD31GJU7EfLsYPqxf8AOhBsYag,81
10
+ zhmiscellany/discord.py,sha256=yKoigWI3tONfYSoMEynGGEWW1VsXSRdkg8vPbIKwBNI,20312
11
+ zhmiscellany/fileio.py,sha256=0QZvCXd9fJ3Rart-kk63KMSwIJ3iCoWvUHtdhd-EM0o,20595
12
+ zhmiscellany/gui.py,sha256=OVwuZ_kWHJlgKPeYR7fAAyomNmU-OnxOgXZelVNPm1w,10409
13
+ zhmiscellany/image.py,sha256=6Hz5sfym_o7FHokGUKeXRsjl89VY_ZMSLnvuSam1icI,8265
14
+ zhmiscellany/list.py,sha256=BnbYG-lpHmi0C4v8jLfaeXqQdc3opmNgkvY6yz4pasg,1475
15
+ zhmiscellany/macro.py,sha256=d4YvD3hktlNLTChOVs97_djOxXpBtraeB9jtEECxNFA,27889
16
+ zhmiscellany/math.py,sha256=nNsrg4le3XIt1y36lQv5xNCjUoIu7Q1lV5BdpmyD_wk,2530
17
+ zhmiscellany/misc.py,sha256=0vJFa0MRdKXjLLVeFfMx1Q-b-qrKqpdaq6FzWKz6SMY,32489
18
+ zhmiscellany/netio.py,sha256=rN17uIbsWqDG9ssmouD7VZqOtlgWObaCsvn2Hrq-k6w,2413
19
+ zhmiscellany/pastebin.py,sha256=jstR_HRP9fUVcQXp4D8zkqvA0GLHNrDrfhqb9Sc-dL0,6479
20
+ zhmiscellany/pipes.py,sha256=RlHxsW_M_R6UJUIDgYVS_zfqUwO8kXG8j-0YG5qByjo,4637
21
+ zhmiscellany/processing.py,sha256=qvowgj-cHZBaQsSQcQ51ywjX2Q5qRZQTMz3o5QIVEM4,11290
22
+ zhmiscellany/rust.py,sha256=cHkSpdtq7QQW3yzBEAYL9lZxLW0h4wal2tsxIOnyTrA,494
23
+ zhmiscellany/string.py,sha256=A4ilBWSYlrJ0AJ0axvepSSjYCYwYk5X-vRrHNphi_ow,4809
24
+ zhmiscellany-6.2.5.dist-info/METADATA,sha256=j4rVcqZ6yBSzienT6Siar6CIyqHbTw0mmWxyJnDJwSA,43872
25
+ zhmiscellany-6.2.5.dist-info/WHEEL,sha256=hPN0AlP2dZM_3ZJZWP4WooepkmU9wzjGgCLCeFjkHLA,92
26
+ zhmiscellany-6.2.5.dist-info/top_level.txt,sha256=ioDtsrevCI52rTxZntMPljRIBsZs73tD0hI00HektiE,13
27
+ zhmiscellany-6.2.5.dist-info/RECORD,,
@@ -1,27 +0,0 @@
1
- zhmiscellany/__init__.py,sha256=Oh3gAJRWq2aUEgkolmQyiZOQ3iey5OC4NA2XaTHuVv4,1139
2
- zhmiscellany/_discord_supportfuncs.py,sha256=RotSpurqFtL5q6v_ST1e2Y_1qJMaHp1CDsF5i-gR4ec,6524
3
- zhmiscellany/_fileio_supportfuncs.py,sha256=soibLv9nOR79sHQ2MGQH2O6MhnqdXqI7ybxHSN2Tfac,434
4
- zhmiscellany/_misc_supportfuncs.py,sha256=RH1keGtoVjJOFh7MWOTJ2BJijLLeEvsMy9tNumdd6Uk,9944
5
- zhmiscellany/_processing_supportfuncs.py,sha256=K6BDWce22tOKQEcfryC9hmvyQihLJHjsKq7MVJIAGmQ,11091
6
- zhmiscellany/_py_resources.py,sha256=HqJs5aRLymLZ2J5Io8g6bY58pGWhN9b8vCktC2DW4KQ,229009
7
- zhmiscellany/_resource_files_lookup.py,sha256=hsgPW0dngokgqWrAVAv5rUo-eobzJPjvWHt4xrOG5l0,856
8
- zhmiscellany/cpp.py,sha256=XEUEoIKCDCdY5VgwNWE5oXrGjtsmGdz_MnaVwQmi2dk,179
9
- zhmiscellany/dict.py,sha256=0BZJ5eK-MurAHYV1OPa0jdGTr-QEWos7ZM0npb-tN9I,81
10
- zhmiscellany/discord.py,sha256=nzXjRnJbuYbuH4hScqqdsF61VeXx8xiYrwp_AKTWt9o,19774
11
- zhmiscellany/fileio.py,sha256=YqIfdit0TQr4VYmpCftoqwtddqo1OZz6duI7BKg7Dy4,19532
12
- zhmiscellany/gui.py,sha256=BDmM7e5ITKQuzxSzaYvPapQuPbQjCMTOq-GyMcLCIgg,10198
13
- zhmiscellany/image.py,sha256=qUjxiYpc2VVZp2vwr1vN36O2PVQ7YlMKzhegQ1u4c0M,8198
14
- zhmiscellany/list.py,sha256=S8Z85bLJEP9lk2JkGpzUcG6kpRB7a-NWDIHMPiF5bKo,1473
15
- zhmiscellany/macro.py,sha256=kKtKYoHLSnBBHyGl8FlnfMaAoraKKSK023VA-mOezO0,27861
16
- zhmiscellany/math.py,sha256=btOQTe_GvqP0A7Zz84tmN_c8j1NGe_mKnhmAt40lhLU,2482
17
- zhmiscellany/misc.py,sha256=llL3ZHD5pxS4RDKLj3gX0k3NpE2mM5g3JVd0k_RvIUg,31979
18
- zhmiscellany/netio.py,sha256=VCqlo3ev_iOTTu5sXTZQwsYU0WMbAlOTDRsJ5Dj5-fc,2519
19
- zhmiscellany/pastebin.py,sha256=TbZ3DqFYXo5qt5d95ugrofYoptlzKkjXUr7VnEqa6ks,6357
20
- zhmiscellany/pipes.py,sha256=zETvWP4PF-PuSzYwR1UCodY4ftNAgmCChb9DUMofXok,4657
21
- zhmiscellany/processing.py,sha256=CUHgbNp8RetXDpc6DuojThi3T2iu_DX09P_WD8iUZ7s,11014
22
- zhmiscellany/rust.py,sha256=znN6DYNoa_p-braTuDZKvUnXX8reWLFu_dG4fv2vLR0,442
23
- zhmiscellany/string.py,sha256=xyqE6V5YF2nieZDcg5ZrXTIrH2D9oDRbZ5vQGz8rPys,4787
24
- zhmiscellany-6.2.3.dist-info/METADATA,sha256=6oliDhPeUlJVWkiEUz3veak3sMV8V0sYvbTMCizR8a0,43872
25
- zhmiscellany-6.2.3.dist-info/WHEEL,sha256=hPN0AlP2dZM_3ZJZWP4WooepkmU9wzjGgCLCeFjkHLA,92
26
- zhmiscellany-6.2.3.dist-info/top_level.txt,sha256=ioDtsrevCI52rTxZntMPljRIBsZs73tD0hI00HektiE,13
27
- zhmiscellany-6.2.3.dist-info/RECORD,,