All-Feature 1.0.7__tar.gz → 1.0.9__tar.gz

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.
@@ -16,7 +16,7 @@ import sys
16
16
  from time import sleep
17
17
  #--------------------------------------------------------------------------------------
18
18
  #================================Var==================================================
19
- __version__ = "1.0.7"
19
+ __version__ = "1.0.9"
20
20
  #=====================================================================================
21
21
  def found_abs(rel_path):
22
22
  return os.path.normcase(os.path.normpath(os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), rel_path))))
@@ -31,7 +31,7 @@ def play(path):
31
31
  return "file_not_exist"
32
32
 
33
33
  def sysdetect():
34
- return [{platform.system()},{platform.release()}]
34
+ return [{platform.system()},{platform.release()},{platform.version()}]
35
35
 
36
36
  def ofw(file_path,software_path):
37
37
  abs_fp = found_abs(file_path)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: All_Feature
3
- Version: 1.0.7
3
+ Version: 1.0.9
4
4
  Summary: A Toolkit
5
5
  Author-email: shx <q19333189819@outlook.com>
6
6
  Maintainer-email: shx <q19333189819@outlook.com>
@@ -8,9 +8,13 @@ License-Expression: MIT
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Operating System :: Microsoft :: Windows
10
10
  Requires-Python: >=3.14
11
+ Description-Content-Type: text/markdown
11
12
  Requires-Dist: requests
12
13
  Requires-Dist: opencv-python
13
14
  Requires-Dist: qrcode
14
15
  Requires-Dist: pillow
15
16
  Requires-Dist: pyzbar
16
17
  Requires-Dist: cryptography
18
+
19
+ # All_Feature
20
+ All_Feature is a library for python
@@ -2,11 +2,6 @@ README.md
2
2
  pyproject.toml
3
3
  ../All_Feature/All_Feature.py
4
4
  ../All_Feature/__init__.py
5
- ../All_Feature.egg-info/PKG-INFO
6
- ../All_Feature.egg-info/SOURCES.txt
7
- ../All_Feature.egg-info/dependency_links.txt
8
- ../All_Feature.egg-info/requires.txt
9
- ../All_Feature.egg-info/top_level.txt
10
5
  ../build_dir/All_Feature/All_Feature.py
11
6
  ../build_dir/All_Feature/__init__.py
12
7
  All_Feature/All_Feature.py
@@ -15,4 +10,6 @@ All_Feature.egg-info/PKG-INFO
15
10
  All_Feature.egg-info/SOURCES.txt
16
11
  All_Feature.egg-info/dependency_links.txt
17
12
  All_Feature.egg-info/requires.txt
18
- All_Feature.egg-info/top_level.txt
13
+ All_Feature.egg-info/top_level.txt
14
+ build_dir/All_Feature/All_Feature.py
15
+ build_dir/All_Feature/__init__.py
@@ -1,2 +1,3 @@
1
1
  All_Feature
2
+ build_dir
2
3
  dist
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: All_Feature
3
- Version: 1.0.7
3
+ Version: 1.0.9
4
4
  Summary: A Toolkit
5
5
  Author-email: shx <q19333189819@outlook.com>
6
6
  Maintainer-email: shx <q19333189819@outlook.com>
@@ -8,9 +8,13 @@ License-Expression: MIT
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Operating System :: Microsoft :: Windows
10
10
  Requires-Python: >=3.14
11
+ Description-Content-Type: text/markdown
11
12
  Requires-Dist: requests
12
13
  Requires-Dist: opencv-python
13
14
  Requires-Dist: qrcode
14
15
  Requires-Dist: pillow
15
16
  Requires-Dist: pyzbar
16
17
  Requires-Dist: cryptography
18
+
19
+ # All_Feature
20
+ All_Feature is a library for python
@@ -0,0 +1,208 @@
1
+ #-*-coding: utf-8-*-
2
+ #------------------------------import--------------------------------------------------
3
+ import os
4
+ import webbrowser as web
5
+ import platform
6
+ import subprocess
7
+ import requests
8
+ import socket
9
+ from requests.exceptions import RequestException,Timeout
10
+ import cv2
11
+ import qrcode
12
+ from PIL import Image
13
+ from pyzbar.pyzbar import decode
14
+ from cryptography.fernet import Fernet
15
+ import sys
16
+ from time import sleep
17
+ #--------------------------------------------------------------------------------------
18
+ #================================Var==================================================
19
+ __version__ = "1.0.9"
20
+ #=====================================================================================
21
+ def found_abs(rel_path):
22
+ return os.path.normcase(os.path.normpath(os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), rel_path))))
23
+ def webopen(URL):
24
+ web.open(URL)
25
+
26
+ def play(path):
27
+ abs_p = found_abs(path)
28
+ if os.path.exists(abs_p):
29
+ web.open(abs_p)
30
+ else:
31
+ return "file_not_exist"
32
+
33
+ def sysdetect():
34
+ return [{platform.system()},{platform.release()},{platform.version()}]
35
+
36
+ def ofw(file_path,software_path):
37
+ abs_fp = found_abs(file_path)
38
+ if not os.path.isfile(abs_fp):
39
+ return "file_not_exist"
40
+ try:
41
+ subprocess.Popen([software_path, abs_fp])
42
+ except Exception as e:
43
+ return "Failed"
44
+
45
+ def get_public_ip():
46
+ headers = {"User-Agent": "Chrome"}
47
+ ip_apis = [
48
+ "https://api.ipify.org",
49
+ "https://icanhazip.com",
50
+ "https://api.ip.sb/ip",
51
+ "https://ifconfig.me/ip",
52
+ "https://ipinfo.io/ip"
53
+ ]
54
+
55
+ for api in ip_apis:
56
+ try:
57
+ response = requests.get(api, headers=headers, timeout=10)
58
+ response.raise_for_status()
59
+ return response.text.strip()
60
+ except Timeout:
61
+ continue
62
+ except RequestException:
63
+ continue
64
+
65
+ return "Failed"
66
+
67
+
68
+
69
+ def lan_ip():
70
+ DNS_servers = ["114.114.114.114","1.1.1.1","8.8.8.8"]
71
+ Port = 53
72
+ for DNS in DNS_servers:
73
+ try:
74
+ with socket.socket(socket.AF_INET,socket.SOCK_DGRAM) as s:
75
+ s.settimeout(5)
76
+ s.connect((DNS,Port))
77
+ return s.getsockname()[0]
78
+ except:
79
+ continue
80
+ return "Failed"
81
+
82
+ def take_photo(save_path="photo.png"):
83
+ cap = cv2.VideoCapture(0)
84
+ if not cap.isOpened():
85
+ return "cannot_open_cam"
86
+ ret,frame = cap.read()
87
+ if not ret:
88
+ cap.release()
89
+ return "Failed"
90
+ abs_sp = found_abs(save_path)
91
+ cv2.imwrite(abs_sp,frame)
92
+ cap.release()
93
+ return f"Saved"
94
+
95
+ def get_lat_lon():
96
+ api = "https://ipinfo.io/json"
97
+ try:
98
+ data = requests.get(api,timeout=5).json()
99
+ loc = data.get("loc")
100
+ if loc:
101
+ lat,lon = loc.split(',')
102
+ return float(lat),float(lon)
103
+ return "format_change"
104
+ except:
105
+ return "network_Error"
106
+
107
+ def close_task_pid(pid):
108
+ result = os.system(f'taskkill /f /pid {pid}')
109
+ if result != 0:
110
+ return "Failed"
111
+
112
+ def gen_qrcode(content,save_path="qrcode.png",size=8,ver=3):
113
+ if not isinstance(content,(str,int,float,bool)):
114
+ try:
115
+ content = str(content)
116
+ except:
117
+ return "Unknown_type"
118
+ qr = qrcode.QRCode(version=ver,box_size=size,border=4)
119
+ qr.add_data(str(content))
120
+ qr.make(fit=True)
121
+ img = qr.make_image(fill_color="black",back_color="white")
122
+ abs_sp = found_abs(save_path)
123
+ img.save(abs_sp)
124
+ return "Done"
125
+
126
+ def de_qrcode(img_path):
127
+ abs_ip = found_abs(img_path)
128
+ if not os.path.exists(abs_ip):
129
+ return "file_not_found"
130
+ try:
131
+ img = Image.open(abs_ip)
132
+ data = decode(img)[0].data.decode("utf-8")
133
+ return f"{data}"
134
+ except:
135
+ return "Cannot_parse"
136
+
137
+ def gen_key(save_path="secret.key"):
138
+ abs_sp = found_abs(save_path)
139
+ key = Fernet.generate_key()
140
+ with open(abs_sp,"wb") as f:
141
+ f.write(key)
142
+ return "Done"
143
+
144
+ def enc_file(file_path,key_path="secret.key",encrypted_path=None):
145
+ abs_fp = found_abs(file_path)
146
+ abs_kp = found_abs(key_path)
147
+ if not os.path.exists(abs_fp):
148
+ return "file_not_found"
149
+ if not os.path.exists(abs_kp):
150
+ return "key_file_not_found"
151
+ with open(abs_kp,"rb") as kf:
152
+ key = kf.read()
153
+ cipher = Fernet(key)
154
+ with open(abs_fp,"rb") as f:
155
+ data = f.read()
156
+ if encrypted_path is None:
157
+ save_path = abs_fp + ".encrypted"
158
+ else:
159
+ save_path = found_abs(encrypted_path)
160
+ with open(save_path,"wb")as ef:
161
+ ef.write(cipher.encrypt(data))
162
+ return "Saved"
163
+
164
+ def dec_file(encrypted_path,key_path="secret.key",decrypted_path=None):
165
+ abs_ep = found_abs(encrypted_path)
166
+ abs_kp = found_abs(key_path)
167
+ if not os.path.exists(abs_ep):
168
+ return "encrypted_file_not_found"
169
+ if not os.path.exists(abs_kp):
170
+ return "key_path_not_found"
171
+ with open(abs_kp,"rb") as kf:
172
+ key = kf.read()
173
+ cipher = Fernet(key)
174
+ with open(abs_ep,"rb") as ef:
175
+ encrypted_data = ef.read()
176
+ decrypted_data = cipher.decrypt(encrypted_data)
177
+ if decrypted_path is None:
178
+ save_path = abs_ep.replace(".encrypted","")
179
+ else:
180
+ save_path = found_abs(decrypted_path)
181
+ with open(save_path,"wb") as df:
182
+ df.write(decrypted_data)
183
+ return "Done"
184
+
185
+ __dir__ = lambda: [k for k, v in globals().items() if (callable(v) and v.__module__ == __name__)]
186
+ #Test Line 123
187
+ if __name__ == "__main__":
188
+ print("Hello,This is a Python project,Please import it,instead of running it directly!\n")
189
+ print("Owner:https://space.bilibili.com/1803075060") #i am only 10 Years old!!!
190
+ exit(0) #Will exit. exit code:0
191
+
192
+
193
+
194
+
195
+ #--------------------------------------------------------
196
+ #Owenr:shx (https://space.bilibili.com/1803075060) 10y.o a Chinese
197
+ #All_Feature by shx
198
+ #Thank you for using!!!
199
+ #For Python! For All_Feature! For Better program!!!
200
+
201
+
202
+ #Also Try Deltarune!
203
+ #--------------------------------------------------------
204
+
205
+
206
+ # asdfghjkl
207
+
208
+
@@ -0,0 +1,4 @@
1
+ from .All_Feature import *
2
+ from .All_Feature import __version__
3
+
4
+ __all__ = [name for name in globals() if not name.startswith("_")] + ["__version__"]
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "All_Feature"
7
- version = "1.0.7"
7
+ version = "1.0.9"
8
8
  authors = [
9
9
  { name = "shx", email = "q19333189819@outlook.com" }
10
10
  ]
@@ -12,6 +12,7 @@ maintainers = [
12
12
  { name = "shx", email = "q19333189819@outlook.com" }
13
13
  ]
14
14
  description = "A Toolkit"
15
+ readme = "README.md"
15
16
  requires-python = ">=3.14"
16
17
 
17
18
  license = "MIT"
File without changes
File without changes