bcpkgfox 0.15.30__py3-none-any.whl → 0.17.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.
bcpkgfox/cli copy 2.py DELETED
@@ -1,237 +0,0 @@
1
- import subprocess
2
- import threading
3
- import argparse
4
- import time
5
- import sys
6
- import re
7
- import os
8
-
9
- class cli:
10
- def __init__(self, file):
11
- self.current_dir = os.getcwd()
12
-
13
- self.file = file
14
- self.visuals = self.visual(self)
15
- self.exec_gen = self.exec_gen_(self)
16
- self.find_imports = self.find_import(self)
17
-
18
- def clean_terminal(self):
19
- if self.exec_gen.error == 1 \
20
- or self.find_imports.error == 1:
21
- print("\033[J", end='', flush=True)
22
-
23
- if self.exec_gen.descerror: print(f"\n {self.visuals.DK_ORANGE}>{self.visuals.RESET} {self.exec_gen.descerror}")
24
- if self.find_imports.descerror: print(f"\n {self.visuals.DK_ORANGE}>{self.visuals.RESET} {self.find_imports.descerror}")
25
-
26
- class visual:
27
- def __init__(self, self_cli):
28
- self.cli = self_cli
29
- self.RESET = "\033[0m"
30
- self.DK_ORANGE = "\033[38;5;130m"
31
- self.Neg = "\033[1m"
32
- self.hue = 0
33
-
34
- def hsl_to_rgb(self, h, s, l):
35
- h = h % 360
36
- c = (1 - abs(2 * l - 1)) * s
37
- x = c * (1 - abs((h / 60) % 2 - 1))
38
- m = l - c / 2
39
-
40
- if 0 <= h < 60: r, g, b = c, x, 0
41
- elif 60 <= h < 120: r, g, b = x, c, 0
42
- elif 120 <= h < 180: r, g, b = 0, c, x
43
- elif 180 <= h < 240: r, g, b = 0, x, c
44
- elif 240 <= h < 300: r, g, b = x, 0, c
45
- elif 300 <= h < 360: r, g, b = c, 0, x
46
-
47
- r = int((r + m) * 255) ; g = int((g + m) * 255) ; b = int((b + m) * 255)
48
- return r, g, b
49
-
50
- def rgb_text(self, text, r, g, b): return f"\033[38;2;{r};{g};{b}m{text}\033[0m"
51
-
52
- def animate_rgb_text(self, text, delay=0.01):
53
- r, g, b = self.hsl_to_rgb(self.hue, s=1.0, l=0.5)
54
- self.hue = (self.hue + 1) % 360
55
- time.sleep(delay)
56
- return f" \033[1m{self.rgb_text(text, r, g, b)}\033[0m"
57
-
58
- class exec_gen_:
59
- def __init__(self, self_cli):
60
- self.cli = self_cli
61
- self.current_dir = None
62
- self.target_file = None
63
- self.file_name = None
64
- self.error = 0
65
- self.descerror = ""
66
- self.visuals = self.cli.visuals
67
-
68
- def preparations(self):
69
- self.current_dir = os.getcwd()
70
-
71
- parser = argparse.ArgumentParser(description="Script to generate .exe and preventing bugs")
72
- parser.add_argument("file", type=str, help="Put the name of file after the command (with the extension '.py')")
73
-
74
- # args = parser.parse_args() #TODO
75
- # self.file_name = args.file #TODO
76
- # self.target_file = os.path.join(self.current_dir, self.file_name) #TODO
77
- self.target_file = self.cli.file #FIX
78
-
79
- if not os.path.exists(self.target_file):
80
- self.descerror = f"Error: File '{self.target_file}' does not exist."
81
- self.error = 1
82
- return
83
-
84
- def run_pyinstaller(self):
85
- global process_finished
86
-
87
- def print_footer():
88
- """Função que mantém a mensagem 'Aguarde download' na última linha."""
89
- while not process_finished:
90
- sys.stdout.write(f"\r \033[F\r\033[K\033[E {self.visuals.animate_rgb_text(f" {self.visuals.Neg}| Gerando executável do '{self.file_name}', aguarde finalização. |{self.visuals.RESET}")}\n\033[F")
91
- sys.stdout.flush()
92
-
93
- process_finished = False
94
- command = ["pyinstaller", self.target_file]
95
- process = subprocess.Popen(
96
- command,
97
- stdout=subprocess.PIPE,
98
- stderr=subprocess.STDOUT,
99
- universal_newlines=True,
100
- bufsize=1
101
- )
102
- footer_thread = threading.Thread(target=print_footer)
103
- footer_thread.start()
104
-
105
- # Lê a saída do PyInstaller em tempo real
106
- while True:
107
- output = process.stdout.readline()
108
- if output == '' and process.poll() is not None:
109
- break
110
- if output:
111
- sys.stdout.write(f"\033[F\r\033[K{output.strip()}\033[K\n\n")
112
- sys.stdout.flush()
113
-
114
- process_finished = True
115
- footer_thread.join()
116
-
117
- print(f"\r \033[F\r\033[K\033[f\r\033[K\033[2E{self.visuals.Neg}{self.visuals.DK_ORANGE}>{self.visuals.RESET}{self.visuals.Neg} Executável gerado com sucesso!\n{self.visuals.RESET}\033[3E")
118
-
119
- def main(self):
120
- script = self.cli.exec_gen
121
- script.preparations()
122
- script.run_pyinstaller()
123
-
124
-
125
- class find_import:
126
- def __init__(self, self_cli):
127
- self.cli = self_cli
128
- self.visuals = self.cli.visuals
129
-
130
- self.error = 0
131
- self.descerror = ""
132
-
133
- self.imports = None
134
-
135
- def hsl_to_rgb(self, h, s, l):
136
- h = h % 360
137
- c = (1 - abs(2 * l - 1)) * s
138
- x = c * (1 - abs((h / 60) % 2 - 1))
139
- m = l - c / 2
140
-
141
- if 0 <= h < 60: r, g, b = c, x, 0
142
- elif 60 <= h < 120: r, g, b = x, c, 0
143
- elif 120 <= h < 180: r, g, b = 0, c, x
144
- elif 180 <= h < 240: r, g, b = 0, x, c
145
- elif 240 <= h < 300: r, g, b = x, 0, c
146
- elif 300 <= h < 360: r, g, b = c, 0, x
147
-
148
- r = int((r + m) * 255) ; g = int((g + m) * 255) ; b = int((b + m) * 255)
149
- return r, g, b
150
-
151
- def rgb_text(self, text, r, g, b): return f"\033[38;2;{r};{g};{b}m{text}\033[0m"
152
-
153
- def animate_rgb_text(self, text, delay=0.01):
154
- import time
155
- from bcpkgfox import DK_ORANGE
156
- hue = 0
157
- print(f" {DK_ORANGE}>{self.visuals.RESET} Dependências do arquivo {self.visuals.DK_ORANGE}'{self.target_file}'{self.visuals.RESET} identificadas com sucesso")
158
- time.sleep(2)
159
- print(f"{DK_ORANGE} PIP:{self.visuals.RESET}\033[s")
160
- while True:
161
- r, g, b = self.hsl_to_rgb(hue, s=1.0, l=0.5)
162
- terminal_width = shutil.get_terminal_size().columns
163
- num_lines = len(text) // terminal_width + 1
164
- print(f"\033[u\033[0J ---> \033[1m{self.rgb_text(text, r, g, b)}\033[0m (CTRL + C)", end="\r")
165
- hue = (hue + 1) % 360
166
- time.sleep(delay)
167
-
168
- def main(self):
169
- current_dir = os.getcwd()
170
-
171
- parser = argparse.ArgumentParser(description="A CLI tool to find imports.")
172
- parser.add_argument("file", type=str, help="The target .py file to process")
173
-
174
- # args = parser.parse_args() #TODO
175
- # self.file_name = args.file #TODO
176
- # self.target_file = os.path.join(self.current_dir, self.file_name) #TODO
177
- self.target_file = self.cli.file #FIX
178
-
179
- if not os.path.exists(self.target_file):
180
- self.descerror = f"Error: File '{self.target_file}' does not exist."
181
- self.error = 1
182
- return
183
-
184
- try:
185
- with open(self.target_file, "r", encoding="utf-8", errors="replace") as file:
186
- file_content = file.read()
187
- except Exception as e:
188
- print(f"Error reading file: {e}")
189
- return
190
-
191
- if not file_content:
192
- print(f"Erro: Não foi possível ler o arquivo '{self.target_file}' com nenhuma codificação testada.")
193
- return
194
-
195
- self.imports = []
196
- import_data = {
197
- "extract_pdf": "PyMuPDF",
198
- "import requests": "requests",
199
- "import pyautogui": "pyautogui",
200
- "import cv2": "opencv-python",
201
- "from PIL": "Pillow",
202
- "from reportlab.lib import utils": "reportlab",
203
- "from PyPDF2 import PdfMerger": "PyPDF2",
204
- "import PyPDF2": "PyPDF2",
205
- "invoke_api_": "requests",
206
- "wait_for": "pygetwindow",
207
- "from selenium_stealth import stealth": "selenium-stealth",
208
- "import undetected_chromedriver": "undetected-chromedriver",
209
- "from webdriver_manager.chrome import ChromeDriverManager": "webdriver-manager",
210
- "move_to_image": ["pyscreeze", "pyautogui", "Pillow", "opencv-python"],
211
- "move_mouse_smoothly": ["pyscreeze", "pyautogui", "Pillow"],
212
- "initialize_driver": ["webdriver-manager", "undetected-chromedriver", "pyautogui", "psutil"],
213
- "stealth max": ["webdriver-manager", "undetected-chromedriver", "fake-useragent"]
214
- }
215
-
216
- for name, import_name in import_data.items():
217
- if re.search(fr"\b{name}\b", file_content):
218
- if isinstance(import_name, list):
219
- self.imports.extend(import_name)
220
- else: self.imports.append(import_name)
221
-
222
- self.imports = list(set(self.imports))
223
- import pyperclip
224
- pyperclip.copy(f"pip install {' '.join(self.imports)}")
225
-
226
- from bcpkgfox import DK_ORANGE, ORANGE, RESET
227
- if self.imports:
228
-
229
- # try: self.animate_rgb_text(f'pip install {" ".join(self.imports)}', delay=0.002)
230
- try: self.animate_rgb_text(f'pip install testetestetestetestetestetestetestetestetestetestetestetestetestetestetestetestetestetestetestetestetestetestetestetestetestetestetestetestetestetestetesteteste', delay=0.002)
231
- except KeyboardInterrupt: print(f" {DK_ORANGE}--->{RESET} {ORANGE}pip install {' '.join(self.imports)}{RESET} \n\n {DK_ORANGE}>{RESET} Copiado para sua área de transferencia. \n(obs: só identifica as libs que são pertencentes da bibliotca bcfox) \n")
232
- else: print("No libraries from the list were found in the script.")
233
-
234
- code = cli("bcpkgfox//cli.py")
235
- code.find_imports.main()
236
- code.clean_terminal()
237
- print()
bcpkgfox/cli copy.py DELETED
@@ -1,306 +0,0 @@
1
- import subprocess
2
- import threading
3
- import argparse
4
- import time
5
- import sys
6
- import re
7
- import os
8
-
9
- class cli:
10
- def __init__(self):
11
- self.current_dir = os.getcwd()
12
-
13
- self.visuals = self.visual(self)
14
- self.exec_gen = self.exec_gen_(self)
15
- self.find_imports = self.find_import(self)
16
-
17
- class visual:
18
- def __init__(self):
19
- self.RESET = "\033[0m"
20
- self.DK_ORANGE = "\033[38;5;130m"
21
- self.Neg = "\033[1m"
22
- self.hue = 0
23
-
24
- def hsl_to_rgb(self, h, s, l):
25
- h = h % 360
26
- c = (1 - abs(2 * l - 1)) * s
27
- x = c * (1 - abs((h / 60) % 2 - 1))
28
- m = l - c / 2
29
-
30
- if 0 <= h < 60: r, g, b = c, x, 0
31
- elif 60 <= h < 120: r, g, b = x, c, 0
32
- elif 120 <= h < 180: r, g, b = 0, c, x
33
- elif 180 <= h < 240: r, g, b = 0, x, c
34
- elif 240 <= h < 300: r, g, b = x, 0, c
35
- elif 300 <= h < 360: r, g, b = c, 0, x
36
-
37
- r = int((r + m) * 255) ; g = int((g + m) * 255) ; b = int((b + m) * 255)
38
- return r, g, b
39
-
40
- def rgb_text(self, text, r, g, b): return f"\033[38;2;{r};{g};{b}m{text}\033[0m"
41
-
42
- def animate_rgb_text(self, text, delay=0.01):
43
- r, g, b = self.hsl_to_rgb(self.hue, s=1.0, l=0.5)
44
- self.hue = (self.hue + 1) % 360
45
- time.sleep(delay)
46
- return f" \033[1m{self.rgb_text(text, r, g, b)}\033[0m"
47
-
48
- class exec_gen_:
49
- def __init__(self, self_cli):
50
- self.cli = self_cli
51
- self.current_dir = None
52
- self.target_file = None
53
- self.file_name = None
54
- self.visuals = self.cli.visuals
55
-
56
- def preparations(self):
57
- self.current_dir = os.getcwd()
58
-
59
- parser = argparse.ArgumentParser(description="Script to generate .exe and preventing bugs")
60
- parser.add_argument("file", type=str, help="Put the name of file after the command (with the extension '.py')")
61
-
62
- args = parser.parse_args()
63
- self.file_name = args.file
64
- self.self.target_file = os.path.join(self.current_dir, self.file_name)
65
-
66
- if not os.path.exists(self.self.target_file):
67
- print(f"Error: File '{self.self.target_file}' does not exist.")
68
- return
69
-
70
- def run_pyinstaller(self):
71
- global process_finished
72
-
73
- def print_footer():
74
- """Função que mantém a mensagem 'Aguarde download' na última linha."""
75
- while not process_finished:
76
- sys.stdout.write(f"\r \033[F\r\033[K\033[E {self.visuals.animate_rgb_text(f" {self.visuals.Neg}| Gerando executável do '{self.file_name}', aguarde finalização. |{self.visuals.RESET}")}\n\033[F")
77
- sys.stdout.flush()
78
-
79
- process_finished = False
80
- command = ["pyinstaller", self.self.target_file]
81
- process = subprocess.Popen(
82
- command,
83
- stdout=subprocess.PIPE,
84
- stderr=subprocess.STDOUT,
85
- universal_newlines=True,
86
- bufsize=1
87
- )
88
- footer_thread = threading.Thread(target=print_footer)
89
- footer_thread.start()
90
-
91
- # Lê a saída do PyInstaller em tempo real
92
- while True:
93
- output = process.stdout.readline()
94
- if output == '' and process.poll() is not None:
95
- break
96
- if output:
97
- sys.stdout.write(f"\033[F\r\033[K{output.strip()}\033[K\n\n")
98
- sys.stdout.flush()
99
-
100
- process_finished = True
101
- footer_thread.join()
102
-
103
- print(f"\r \033[F\r\033[K\033[f\r\033[K\033[2E{self.visuals.Neg}{self.visuals.DK_ORANGE}>{self.visuals.RESET}{self.visuals.Neg} Executável gerado com sucesso!\n{self.visuals.RESET}\033[3E")
104
-
105
- def main(self):
106
- script = self.cli.exec_gen_()
107
- script.preparations()
108
- script.run_pyinstaller()
109
-
110
- class find_import:
111
- def __init__(self, self_cli):
112
- self.cli = self_cli
113
- self.visuals = self.cli.visuals
114
-
115
- self.imports = None
116
-
117
- def hsl_to_rgb(self, h, s, l):
118
- h = h % 360
119
- c = (1 - abs(2 * l - 1)) * s
120
- x = c * (1 - abs((h / 60) % 2 - 1))
121
- m = l - c / 2
122
-
123
- if 0 <= h < 60: r, g, b = c, x, 0
124
- elif 60 <= h < 120: r, g, b = x, c, 0
125
- elif 120 <= h < 180: r, g, b = 0, c, x
126
- elif 180 <= h < 240: r, g, b = 0, x, c
127
- elif 240 <= h < 300: r, g, b = x, 0, c
128
- elif 300 <= h < 360: r, g, b = c, 0, x
129
-
130
- r = int((r + m) * 255) ; g = int((g + m) * 255) ; b = int((b + m) * 255)
131
- return r, g, b
132
-
133
- def rgb_text(self, text, r, g, b): return f"\033[38;2;{r};{g};{b}m{text}\033[0m"
134
-
135
- def animate_rgb_text(self, text, delay=0.01):
136
- import time
137
- from bcpkgfox import DK_ORANGE
138
- hue = 0
139
- print(f" {DK_ORANGE}>{self.visuals.RESET} Dependências do arquivo {self.visuals.ORANGE}'{self.target_file}'{self.visuals.RESET} identificadas com sucesso")
140
- time.sleep(2)
141
- print(f"{DK_ORANGE} PIP:{self.visuals.RESET}")
142
- while True:
143
- r, g, b = self.hsl_to_rgb(hue, s=1.0, l=0.5)
144
- print(f" ---> \033[1m{self.rgb_text(text, r, g, b)}\033[0m (CTRL + C)", end="\r")
145
- hue = (hue + 1) % 360
146
- time.sleep(delay)
147
-
148
- def main(self):
149
- current_dir = os.getcwd()
150
-
151
- parser = argparse.ArgumentParser(description="A CLI tool to find imports.")
152
- parser.add_argument("file", type=str, help="The target .py file to process")
153
-
154
- args = parser.parse_args()
155
- self.self.target_file = os.path.join(current_dir, args.file)
156
-
157
- if not os.path.exists(self.target_file):
158
- print(f"Error: File '{self.target_file}' does not exist.")
159
- return
160
-
161
- try:
162
- with open(self.target_file, "r", encoding="utf-8", errors="replace") as file:
163
- file_content = file.read()
164
- except Exception as e:
165
- print(f"Error reading file: {e}")
166
- return
167
-
168
- if not file_content:
169
- print(f"Erro: Não foi possível ler o arquivo '{self.target_file}' com nenhuma codificação testada.")
170
- return
171
-
172
- libraries = [
173
- 'undetected-chromedriver',
174
- 'webdriver-manager',
175
- 'opencv-python',
176
- 'pygetwindow',
177
- 'setuptools',
178
- 'pyscreeze',
179
- 'pyautogui',
180
- 'selenium',
181
- 'requests',
182
- 'PyMuPDF',
183
- 'Pillow',
184
- 'psutil'
185
- ]
186
-
187
- self.imports = []
188
- for lib in libraries:
189
- pattern = rf"\b{re.escape(lib)}\b"
190
- if re.search(pattern, file_content):
191
- self.imports.append(lib)
192
-
193
- dict = {
194
- "extract_pdf": "PyMuPDF"
195
- "import requests": "requests"
196
- "import pyautogui": "pyautogui"
197
- "from PIL import Image": "Pillow"
198
- "from reportlab.lib import utils": "reportlab"
199
- "from PyPDF2 import PdfMerger": "PyPDF2"
200
- "import PyPDF2": "PyPDF2"
201
- "invoke_api_": "requests"
202
- "wait_for": "pygetwindow"
203
- "from selenium_stealth import stealth": "selenium-stealth"
204
- "import undetected_chromedriver": "undetected-chromedriver"
205
- "from webdriver_manager.chrome import ChromeDriverManager": "webdriver-manager"
206
- "move_to_image": ["pyscreeze", "pyautogui", "Pillow", "opencv-python"]
207
- "move_mouse_smoothly": ["pyscreeze", "pyautogui", "Pillow"]
208
- "initialize_driver": ["webdriver-manager", "undetected-chromedriver", "pyautogui", "psutil"]
209
- "stealth max": ["webdriver-manager", "undetected-chromedriver", "fake-useragent"]
210
- }
211
-
212
- for dic in dict.keys:
213
- if re.search(fr"\.{dic}\b", file_content):
214
- self.imports.append(dic.value)
215
-
216
-
217
-
218
- if re.search(r"\.import requests\b", file_content):
219
- self.imports.append("requests")
220
-
221
- if re.search(r"\.import pyautogui\b", file_content):
222
- self.imports.append("pyautogui")
223
-
224
- if re.search(r"\.from PIL import Image\b", file_content):
225
- self.imports.append("Pillow")
226
-
227
- if re.search(r"\.from reportlab.lib import utils\b", file_content):
228
- self.imports.append("reportlab")
229
-
230
- if re.search(r"\.from PyPDF2 import PdfMerger\b", file_content):
231
- self.imports.append("PyPDF2")
232
-
233
- if re.search(r"\.import PyPDF2\b", file_content):
234
- self.imports.append("PyPDF2")
235
-
236
- if re.search(r"\.invoke_api_\b", file_content):
237
- self.imports.append("requests")
238
-
239
- if re.search(r"\.wait_for\b", file_content):
240
- self.imports.append("pygetwindow")
241
-
242
- if re.search(r"\.from selenium_stealth import stealth\b", file_content):
243
- self.imports.append("selenium-stealth")
244
-
245
- if re.search(r"\.import undetected_chromedriver\b", file_content):
246
- self.imports.append("undetected-chromedriver")
247
-
248
- if re.search(r"\.from webdriver_manager.chrome import ChromeDriverManager\b", file_content):
249
- self.imports.append("webdriver-manager")
250
-
251
- if re.search(r"\.move_to_image\b", file_content):
252
- self.imports.extend(["pyscreeze", "pyautogui", "Pillow", "opencv-python"])
253
-
254
- if re.search(r"\.move_mouse_smoothly\b", file_content):
255
- self.imports.extend(["pyscreeze", "pyautogui", "Pillow"])
256
-
257
- if re.search(r"\.initialize_driver\b", file_content):
258
- self.imports.extend(["webdriver-manager", "undetected-chromedriver", "pyautogui", "psutil"])
259
-
260
- if re.search(r"\.stealth max\b", file_content):
261
- self.imports.extend(["webdriver-manager", "undetected-chromedriver", "fake-useragent"])
262
-
263
- imports = list(set(imports))
264
- import pyperclip
265
- pyperclip.copy(f"pip install {' '.join(imports)}")
266
-
267
- from bcpkgfox import DK_ORANGE, ORANGE, RESET
268
- if imports:
269
-
270
- def print_footer():
271
- """Função que mantém a mensagem 'Aguarde download' na última linha."""
272
- while not process_finished:
273
- sys.stdout.write(f"\r \033[F\r\033[K\033[E {self.visuals.animate_rgb_text(f" {self.visuals.Neg}| Gerando executável do '{self.file_name}', aguarde finalização. |{self.visuals.RESET}")}\n\033[F")
274
- sys.stdout.flush()
275
-
276
- process_finished = False
277
- command = ["pyinstaller", self.self.target_file]
278
- process = subprocess.Popen(
279
- command,
280
- stdout=subprocess.PIPE,
281
- stderr=subprocess.STDOUT,
282
- universal_newlines=True,
283
- bufsize=1
284
- )
285
- footer_thread = threading.Thread(target=print_footer)
286
- footer_thread.start()
287
-
288
- # Lê a saída do PyInstaller em tempo real
289
- while True:
290
- output = process.stdout.readline()
291
- if output == '' and process.poll() is not None:
292
- break
293
- if output:
294
- sys.stdout.write(f"\033[F\r\033[K{output.strip()}\033[K\n\n")
295
- sys.stdout.flush()
296
-
297
- process_finished = True
298
- footer_thread.join()
299
-
300
- print(f"\r \033[F\r\033[K\033[f\r\033[K\033[2E{self.visuals.Neg}{self.visuals.DK_ORANGE}>{self.visuals.RESET}{self.visuals.Neg} Executável gerado com sucesso!\n{self.visuals.RESET}\033[3E")
301
-
302
- try: self.animate_rgb_text(f'pip install {" ".join(imports)}', delay=0.002)
303
- except KeyboardInterrupt: print(f" {DK_ORANGE}--->{RESET} {ORANGE}pip install {' '.join(imports)}{RESET} \n\n {DK_ORANGE}>{RESET} Copiado para sua área de transferencia. \n(obs: só identifica as libs que são pertencentes da bibliotca bcfox) \n")
304
- else: print("No libraries from the list were found in the script.")
305
-
306
-