zhmiscellany 6.2.2__py3-none-any.whl → 6.2.4__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/_misc_supportfuncs.py +1 -1
- zhmiscellany/_processing_supportfuncs.py +5 -9
- zhmiscellany/discord.py +0 -1
- zhmiscellany/image.py +5 -4
- zhmiscellany/netio.py +6 -5
- zhmiscellany/pipes.py +0 -1
- zhmiscellany/processing.py +2 -1
- {zhmiscellany-6.2.2.dist-info → zhmiscellany-6.2.4.dist-info}/METADATA +1 -1
- {zhmiscellany-6.2.2.dist-info → zhmiscellany-6.2.4.dist-info}/RECORD +11 -11
- {zhmiscellany-6.2.2.dist-info → zhmiscellany-6.2.4.dist-info}/WHEEL +0 -0
- {zhmiscellany-6.2.2.dist-info → zhmiscellany-6.2.4.dist-info}/top_level.txt +0 -0
|
@@ -156,7 +156,7 @@ def get_actual_screen_resolution():
|
|
|
156
156
|
try:
|
|
157
157
|
return pyautogui.size()
|
|
158
158
|
except Exception:
|
|
159
|
-
|
|
159
|
+
# Could not determine screen resolution on Linux, defaulting to 1920x1080
|
|
160
160
|
return 1920, 1080
|
|
161
161
|
|
|
162
162
|
|
|
@@ -9,11 +9,7 @@ from unittest.mock import patch
|
|
|
9
9
|
|
|
10
10
|
# Ray availability check
|
|
11
11
|
if sys.platform == "win32" or True:
|
|
12
|
-
|
|
13
|
-
import ray
|
|
14
|
-
RAY_AVAILABLE = True
|
|
15
|
-
except ImportError:
|
|
16
|
-
RAY_AVAILABLE = False
|
|
12
|
+
RAY_AVAILABLE = True
|
|
17
13
|
else:
|
|
18
14
|
RAY_AVAILABLE = False
|
|
19
15
|
|
|
@@ -281,7 +277,7 @@ def synchronous_class_multiprocess(cls, *args, disable_warning=False, **kwargs):
|
|
|
281
277
|
if not RAY_AVAILABLE:
|
|
282
278
|
print("synchronous_class_multiprocess() only supports Windows! Returning None")
|
|
283
279
|
return None
|
|
284
|
-
|
|
280
|
+
|
|
285
281
|
if _ray_state == 'disabled':
|
|
286
282
|
if not disable_warning:
|
|
287
283
|
logging.warning("zhmiscellany didn't detect that you were going to be using multiprocessing functions, and ray was not initialized preemptively.\n\
|
|
@@ -295,12 +291,12 @@ All this means is that ray is still being initialized and this call to multiproc
|
|
|
295
291
|
If you want to avoid this in the future and wait until ray is ready you can add this line just after importing zhmiscellany: (Or you can pass disable_warning=True to this function call)\n\
|
|
296
292
|
from zhmiscellany._processing_supportfuncs import _ray_init_thread; _ray_init_thread.join()")
|
|
297
293
|
_ray_init_thread.join()
|
|
298
|
-
|
|
294
|
+
|
|
299
295
|
def _ready(self):
|
|
300
296
|
return True
|
|
301
297
|
|
|
302
298
|
cls._ready = _ready
|
|
303
|
-
|
|
304
|
-
remote_cls = ray.remote(cls)
|
|
299
|
+
|
|
300
|
+
remote_cls = ray.remote(num_cpus=0)(cls)
|
|
305
301
|
actor_instance = remote_cls.remote(*args, **kwargs)
|
|
306
302
|
return RayActorWrapper(actor_instance)
|
zhmiscellany/discord.py
CHANGED
zhmiscellany/image.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import numpy as np
|
|
2
|
-
from PIL import Image, ImageDraw, ImageFont
|
|
3
2
|
import math
|
|
4
3
|
|
|
5
4
|
|
|
@@ -19,6 +18,8 @@ def image_diff(img1, img2):
|
|
|
19
18
|
|
|
20
19
|
class Canvas:
|
|
21
20
|
def __init__(self, width, height, colour=(0, 0, 0, 255)):
|
|
21
|
+
from PIL import Image, ImageDraw, ImageFont
|
|
22
|
+
self.ImageFont = ImageFont
|
|
22
23
|
self.width = width
|
|
23
24
|
self.height = height
|
|
24
25
|
self.image = Image.new("RGBA", (self.width, self.height), color=colour)
|
|
@@ -83,11 +84,11 @@ class Canvas:
|
|
|
83
84
|
line_colour = default_color
|
|
84
85
|
|
|
85
86
|
try:
|
|
86
|
-
font = ImageFont.truetype("consola.ttf", int(12 * text_scale))
|
|
87
|
+
font = self.ImageFont.truetype("consola.ttf", int(12 * text_scale))
|
|
87
88
|
except IOError:
|
|
88
|
-
font = ImageFont.load_default()
|
|
89
|
+
font = self.ImageFont.load_default()
|
|
89
90
|
if hasattr(font, "size"):
|
|
90
|
-
font = ImageFont.load_default().font_variant(size=int(12 * text_scale))
|
|
91
|
+
font = self.ImageFont.load_default().font_variant(size=int(12 * text_scale))
|
|
91
92
|
text_bbox = self.draw.textbbox((0, 0), text, font=font)
|
|
92
93
|
text_width = text_bbox[2] - text_bbox[0]
|
|
93
94
|
text_height = text_bbox[3] - text_bbox[1]
|
zhmiscellany/netio.py
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import os, requests
|
|
2
2
|
import zhmiscellany.string
|
|
3
|
-
import urllib.parse
|
|
4
3
|
import sys
|
|
5
|
-
from urllib3.exceptions import InsecureRequestWarning
|
|
6
|
-
import urllib3
|
|
7
|
-
|
|
8
|
-
urllib3.disable_warnings(InsecureRequestWarning)
|
|
9
4
|
|
|
10
5
|
WIN32_AVAILABLE = False
|
|
11
6
|
if sys.platform == "win32":
|
|
@@ -18,6 +13,7 @@ if sys.platform == "win32":
|
|
|
18
13
|
|
|
19
14
|
|
|
20
15
|
def resolve_file(url, destination_folder="."):
|
|
16
|
+
import urllib.parse
|
|
21
17
|
file_name = urllib.parse.unquote(url.split("/")[-1])
|
|
22
18
|
file_name = file_name.split('?')[0]
|
|
23
19
|
destination_path = f"{destination_folder}/{file_name}"
|
|
@@ -27,6 +23,10 @@ def resolve_file(url, destination_folder="."):
|
|
|
27
23
|
|
|
28
24
|
|
|
29
25
|
def download_file(url, destination_folder=".", just_return_path=False, headers=None, file_path=None):
|
|
26
|
+
from urllib3.exceptions import InsecureRequestWarning
|
|
27
|
+
import urllib3
|
|
28
|
+
urllib3.disable_warnings(InsecureRequestWarning)
|
|
29
|
+
|
|
30
30
|
if file_path:
|
|
31
31
|
destination_path = file_path
|
|
32
32
|
else:
|
|
@@ -54,6 +54,7 @@ def download_file(url, destination_folder=".", just_return_path=False, headers=N
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
def generate_headers(url):
|
|
57
|
+
import urllib.parse
|
|
57
58
|
headers = {}
|
|
58
59
|
|
|
59
60
|
if WIN32_AVAILABLE:
|
zhmiscellany/pipes.py
CHANGED
zhmiscellany/processing.py
CHANGED
|
@@ -2,7 +2,6 @@ from ._processing_supportfuncs import batch_multiprocess, multiprocess, synchron
|
|
|
2
2
|
import threading, kthread
|
|
3
3
|
import traceback
|
|
4
4
|
import zhmiscellany.string
|
|
5
|
-
import concurrent.futures
|
|
6
5
|
import subprocess, zlib, pickle, dill, tempfile, os, base64
|
|
7
6
|
from itertools import chain
|
|
8
7
|
|
|
@@ -15,6 +14,7 @@ def start_daemon(**kwargs):
|
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
def batch_threading(targets, max_threads=None, show_errors=True, flatten=False):
|
|
17
|
+
import concurrent.futures
|
|
18
18
|
def execute_target(target):
|
|
19
19
|
try: return target[0](*target[1])
|
|
20
20
|
except Exception:
|
|
@@ -34,6 +34,7 @@ def batch_threading(targets, max_threads=None, show_errors=True, flatten=False):
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
def batch_threading_gen(targets, max_threads=None, show_errors=True):
|
|
37
|
+
import concurrent.futures
|
|
37
38
|
def execute_target(target):
|
|
38
39
|
try: return target[0](*target[1])
|
|
39
40
|
except Exception:
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
zhmiscellany/__init__.py,sha256=Oh3gAJRWq2aUEgkolmQyiZOQ3iey5OC4NA2XaTHuVv4,1139
|
|
2
2
|
zhmiscellany/_discord_supportfuncs.py,sha256=RotSpurqFtL5q6v_ST1e2Y_1qJMaHp1CDsF5i-gR4ec,6524
|
|
3
3
|
zhmiscellany/_fileio_supportfuncs.py,sha256=soibLv9nOR79sHQ2MGQH2O6MhnqdXqI7ybxHSN2Tfac,434
|
|
4
|
-
zhmiscellany/_misc_supportfuncs.py,sha256=
|
|
5
|
-
zhmiscellany/_processing_supportfuncs.py,sha256=
|
|
4
|
+
zhmiscellany/_misc_supportfuncs.py,sha256=vfwcETCBq6fX96jad8aVPnZq5OpvNslgQPATUmGVbuI,9937
|
|
5
|
+
zhmiscellany/_processing_supportfuncs.py,sha256=6UfR0QVkWv2MXKuTwWmI4bsn1joEQ-EOYo3v8sFzx_Y,11001
|
|
6
6
|
zhmiscellany/_py_resources.py,sha256=HqJs5aRLymLZ2J5Io8g6bY58pGWhN9b8vCktC2DW4KQ,229009
|
|
7
7
|
zhmiscellany/_resource_files_lookup.py,sha256=hsgPW0dngokgqWrAVAv5rUo-eobzJPjvWHt4xrOG5l0,856
|
|
8
8
|
zhmiscellany/cpp.py,sha256=XEUEoIKCDCdY5VgwNWE5oXrGjtsmGdz_MnaVwQmi2dk,179
|
|
9
9
|
zhmiscellany/dict.py,sha256=0BZJ5eK-MurAHYV1OPa0jdGTr-QEWos7ZM0npb-tN9I,81
|
|
10
|
-
zhmiscellany/discord.py,sha256=
|
|
10
|
+
zhmiscellany/discord.py,sha256=iQfDrYCcoolfpCbE_kQN_yq_oOx4cbdYcTI8iHoKtIE,19756
|
|
11
11
|
zhmiscellany/fileio.py,sha256=YqIfdit0TQr4VYmpCftoqwtddqo1OZz6duI7BKg7Dy4,19532
|
|
12
12
|
zhmiscellany/gui.py,sha256=BDmM7e5ITKQuzxSzaYvPapQuPbQjCMTOq-GyMcLCIgg,10198
|
|
13
|
-
zhmiscellany/image.py,sha256=
|
|
13
|
+
zhmiscellany/image.py,sha256=kl4i5nfFW_byQkuCn_55HK4p1kuqng7L-k0iUbnhFb8,8257
|
|
14
14
|
zhmiscellany/list.py,sha256=S8Z85bLJEP9lk2JkGpzUcG6kpRB7a-NWDIHMPiF5bKo,1473
|
|
15
15
|
zhmiscellany/macro.py,sha256=kKtKYoHLSnBBHyGl8FlnfMaAoraKKSK023VA-mOezO0,27861
|
|
16
16
|
zhmiscellany/math.py,sha256=btOQTe_GvqP0A7Zz84tmN_c8j1NGe_mKnhmAt40lhLU,2482
|
|
17
17
|
zhmiscellany/misc.py,sha256=llL3ZHD5pxS4RDKLj3gX0k3NpE2mM5g3JVd0k_RvIUg,31979
|
|
18
|
-
zhmiscellany/netio.py,sha256=
|
|
18
|
+
zhmiscellany/netio.py,sha256=qwHsQb7TrKaIYmjH0SV-2J6lELth9QsmcsHDupzf5ok,2560
|
|
19
19
|
zhmiscellany/pastebin.py,sha256=TbZ3DqFYXo5qt5d95ugrofYoptlzKkjXUr7VnEqa6ks,6357
|
|
20
|
-
zhmiscellany/pipes.py,sha256=
|
|
21
|
-
zhmiscellany/processing.py,sha256=
|
|
20
|
+
zhmiscellany/pipes.py,sha256=ESg7UvnUJMfJ4LnNoARayZuhBPKEMGPLv_429ZCNzso,4629
|
|
21
|
+
zhmiscellany/processing.py,sha256=FnWPhtzLHFtIkp0ROUVQ9fZWk1IZrSPv7lMIp8VZLnI,11049
|
|
22
22
|
zhmiscellany/rust.py,sha256=znN6DYNoa_p-braTuDZKvUnXX8reWLFu_dG4fv2vLR0,442
|
|
23
23
|
zhmiscellany/string.py,sha256=xyqE6V5YF2nieZDcg5ZrXTIrH2D9oDRbZ5vQGz8rPys,4787
|
|
24
|
-
zhmiscellany-6.2.
|
|
25
|
-
zhmiscellany-6.2.
|
|
26
|
-
zhmiscellany-6.2.
|
|
27
|
-
zhmiscellany-6.2.
|
|
24
|
+
zhmiscellany-6.2.4.dist-info/METADATA,sha256=JpHQ3pl0C7gqzZtNBnJQaojYzq0OxV5mxKojVLgt5SE,43872
|
|
25
|
+
zhmiscellany-6.2.4.dist-info/WHEEL,sha256=hPN0AlP2dZM_3ZJZWP4WooepkmU9wzjGgCLCeFjkHLA,92
|
|
26
|
+
zhmiscellany-6.2.4.dist-info/top_level.txt,sha256=ioDtsrevCI52rTxZntMPljRIBsZs73tD0hI00HektiE,13
|
|
27
|
+
zhmiscellany-6.2.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|