zhmiscellany 6.2.3__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.
@@ -156,7 +156,7 @@ def get_actual_screen_resolution():
156
156
  try:
157
157
  return pyautogui.size()
158
158
  except Exception:
159
- print("Could not determine screen resolution on Linux, defaulting to 1920x1080")
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
- try:
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
 
zhmiscellany/discord.py CHANGED
@@ -429,7 +429,6 @@ def id_to_timestamp(id):
429
429
 
430
430
 
431
431
  def timestamp_to_id(timestamp):
432
- id = int(id)
433
432
  DISCORD_EPOCH = 1420070400000
434
433
  return int((timestamp * 1000 - DISCORD_EPOCH) * 4194304)
435
434
 
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
@@ -2,7 +2,6 @@ import threading
2
2
  import queue
3
3
  import time
4
4
  import sys
5
- import zhmiscellany.string
6
5
 
7
6
  WIN32_AVAILABLE = False
8
7
  if sys.platform == "win32":
@@ -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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: zhmiscellany
3
- Version: 6.2.3
3
+ Version: 6.2.4
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
@@ -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=RH1keGtoVjJOFh7MWOTJ2BJijLLeEvsMy9tNumdd6Uk,9944
5
- zhmiscellany/_processing_supportfuncs.py,sha256=K6BDWce22tOKQEcfryC9hmvyQihLJHjsKq7MVJIAGmQ,11091
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=nzXjRnJbuYbuH4hScqqdsF61VeXx8xiYrwp_AKTWt9o,19774
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=qUjxiYpc2VVZp2vwr1vN36O2PVQ7YlMKzhegQ1u4c0M,8198
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=VCqlo3ev_iOTTu5sXTZQwsYU0WMbAlOTDRsJ5Dj5-fc,2519
18
+ zhmiscellany/netio.py,sha256=qwHsQb7TrKaIYmjH0SV-2J6lELth9QsmcsHDupzf5ok,2560
19
19
  zhmiscellany/pastebin.py,sha256=TbZ3DqFYXo5qt5d95ugrofYoptlzKkjXUr7VnEqa6ks,6357
20
- zhmiscellany/pipes.py,sha256=zETvWP4PF-PuSzYwR1UCodY4ftNAgmCChb9DUMofXok,4657
21
- zhmiscellany/processing.py,sha256=CUHgbNp8RetXDpc6DuojThi3T2iu_DX09P_WD8iUZ7s,11014
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.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,,
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,,