bcpkgfox 0.16.25__py3-none-any.whl → 0.16.27__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/__init__.py CHANGED
@@ -225,7 +225,7 @@ def wait_for_element_disappear(object, type, timeout=10):
225
225
 
226
226
  return find_elements.backcode__dont_use__wait_for_d(driver, object, type, timeout=tempo)
227
227
 
228
- def selectfox(elemento, method, key):
228
+ def selectfox(elemento, method, key, pure: None):
229
229
  """
230
230
  Seleciona uma opção em um elemento <select>.
231
231
 
@@ -264,9 +264,15 @@ def selectfox(elemento, method, key):
264
264
  if method == "text":
265
265
  elements = WebDriverWait(elemento, 10).until(EC.visibility_of_all_elements_located((By.XPATH, '//option')))
266
266
  for elm in elements:
267
- if key.lower().strip() in elm.text.lower().strip():
268
- select.select_by_visible_text(elm.text)
269
- return
267
+ if pure:
268
+ if key == elm.text:
269
+ select.select_by_visible_text(elm.text)
270
+ return
271
+ else:
272
+ if key.lower().strip() in elm.text.lower().strip():
273
+ select.select_by_visible_text(elm.text)
274
+ return
275
+
270
276
  raise ModuleNotFoundError(f"Option {key} não encontrada")
271
277
 
272
278
  if method == "index":
bcpkgfox/clean.py ADDED
@@ -0,0 +1,257 @@
1
+ import subprocess
2
+ import threading
3
+ import argparse
4
+ import time
5
+ import sys
6
+ import os
7
+
8
+
9
+ class clean_main:
10
+
11
+ def __init__(self):
12
+ self.current_dir = os.getcwd()
13
+ self.args = None
14
+ self.file = None
15
+
16
+ def main(self):
17
+
18
+ # Detect the user input
19
+ self.args = self.parser.parse_args()
20
+ self.file = self.args.filename
21
+
22
+ self.data_dict = []
23
+ if self.args.exe:
24
+ if self.args.add_data:
25
+ for data in self.args.add_data:
26
+ self.data_dict.append(data)
27
+
28
+ # Icon check
29
+ if self.args.icon:
30
+ if len(self.args.icon) > 1:
31
+ raise ValueError("Put only one PATH in 'icon' argument.")
32
+
33
+ if not os.path.exists(os.path.join(self.current_dir, self.args.icon[0])):
34
+ raise ValueError(f"The path '{self.args.icon[0]}' not exists")
35
+
36
+ # Venv
37
+ if self.args.venv:
38
+ self.venv_manager.main()
39
+ elif self.args.venv_clean:
40
+ self.venv_manager.create_venv()
41
+ elif self.args.recreate_venv:
42
+ self.venv_manager.recreate_venv()
43
+ elif self.args.delete_venv:
44
+ self.venv_manager.delete_venv()
45
+
46
+ # Imports
47
+ if self.args.find_imports:
48
+ self.find_imports.main()
49
+ elif self.args.install_imports:
50
+ self.venv_manager.install_imports()
51
+
52
+ # EXEC
53
+ elif self.args.exe:
54
+ self.exec_gen.main()
55
+
56
+ if self.args.zip:
57
+ self.exec_gen.zip_file()
58
+
59
+ # LOG - Verify imports
60
+ if self.args.verify_imports:
61
+ if self.args.find_imports \
62
+ or self.args.install_imports \
63
+ or self.args.venv \
64
+ or self.args.recreate_venv \
65
+ or self.args.exe:
66
+ self.find_imports.verify_imports()
67
+ else:
68
+ print(f"{self.visuals.bold}{self.visuals.RD} > Error: You need to use one function that installs imports before verifying them.{self.visuals.RESET}")
69
+ print("\033[J", end='', flush=True)
70
+
71
+ self.clean_terminal()
72
+
73
+
74
+
75
+ class Visual():
76
+ def __init__(self):
77
+
78
+
79
+ # Colors
80
+ self.DK_ORANGE = "\033[38;5;130m"
81
+ self.ORANGE = "\033[38;5;214m"
82
+ self.YL = "\033[38;5;226m"
83
+ self.RD = "\033[38;5;196m"
84
+ self.GR = "\033[38;5;34m"
85
+ self.RESET = "\033[0m"
86
+ self.bold = "\033[1m"
87
+
88
+ class Visual(clean_main):
89
+ def __init__(self):
90
+ super().__init__()
91
+
92
+ self.hue = 0
93
+
94
+ def hsl_to_rgb(self, h, s, l):
95
+ h = h % 360
96
+ c = (1 - abs(2 * l - 1)) * s
97
+ x = c * (1 - abs((h / 60) % 2 - 1))
98
+ m = l - c / 2
99
+
100
+ if 0 <= h < 60: r, g, b = c, x, 0
101
+ elif 60 <= h < 120: r, g, b = x, c, 0
102
+ elif 120 <= h < 180: r, g, b = 0, c, x
103
+ elif 180 <= h < 240: r, g, b = 0, x, c
104
+ elif 240 <= h < 300: r, g, b = x, 0, c
105
+ elif 300 <= h < 360: r, g, b = c, 0, x
106
+
107
+ r = int((r + m) * 255) ; g = int((g + m) * 255) ; b = int((b + m) * 255)
108
+ return r, g, b
109
+
110
+ def rgb_text(self, text, r, g, b): return f"\033[38;2;{r};{g};{b}m{text}\033[0m"
111
+
112
+ def animate_rgb_text(self, text, delay=0.01):
113
+ r, g, b = self.hsl_to_rgb(self.hue, s=1.0, l=0.5)
114
+ self.hue = (self.hue + 1) % 360
115
+ time.sleep(delay)
116
+ return f" \033[1m{self.rgb_text(text, r, g, b)}\033[0m"
117
+
118
+ class animation:
119
+ def __init__(self, self_cli):
120
+ self.cli = self_cli
121
+ self.text = None
122
+ self.braille_spinner = [
123
+ '\u280B',
124
+ '\u2809',
125
+ '\u2839',
126
+ '\u2838',
127
+ '\u283C',
128
+ '\u2834',
129
+ '\u2826',
130
+ '\u2827',
131
+ '\u2807',
132
+ '\u280F'
133
+ ]
134
+
135
+ self.retro_computer_style = [
136
+ '\u23BA', # ⎺
137
+ '\u23BB', # ⎻
138
+ '\u23BC', # ⎼
139
+ '\u23BD', # ⎽
140
+ ]
141
+
142
+ self.footer_thread = None
143
+ self.process_finished = False
144
+
145
+ def print_footer(self):
146
+ s = 0
147
+ n = 0
148
+ while not self.process_finished:
149
+ if s % 10 == 0: n += 1
150
+ if n == len(self.retro_computer_style): n = 0
151
+
152
+ sys.stdout.write(f"\r \033[F\r\033[K\033[E {self.cli.visuals.animate_rgb_text(f" {self.cli.visuals.bold} {self.retro_computer_style[n]} {self.text} {self.retro_computer_style[n]} {self.cli.visuals.RESET}")} \033[0J\n\033[F")
153
+ sys.stdout.flush()
154
+ s += 1
155
+
156
+ def start(self, text):
157
+ self.text = text
158
+ self.footer_thread = threading.Thread(target=self.print_footer)
159
+ self.footer_thread.start()
160
+
161
+ def finish(self):
162
+ self.process_finished = True
163
+ self.footer_thread.join()
164
+
165
+ def main():
166
+
167
+ class visual():
168
+ def __init__(self):
169
+ self.RESET = "\033[0m"
170
+ self.DK_ORANGE = "\033[38;5;130m"
171
+ self.Neg = "\033[1m"
172
+ self.hue = 0
173
+
174
+ def hsl_to_rgb(self, h, s, l):
175
+ h = h % 360
176
+ c = (1 - abs(2 * l - 1)) * s
177
+ x = c * (1 - abs((h / 60) % 2 - 1))
178
+ m = l - c / 2
179
+
180
+ if 0 <= h < 60: r, g, b = c, x, 0
181
+ elif 60 <= h < 120: r, g, b = x, c, 0
182
+ elif 120 <= h < 180: r, g, b = 0, c, x
183
+ elif 180 <= h < 240: r, g, b = 0, x, c
184
+ elif 240 <= h < 300: r, g, b = x, 0, c
185
+ elif 300 <= h < 360: r, g, b = c, 0, x
186
+
187
+ r = int((r + m) * 255) ; g = int((g + m) * 255) ; b = int((b + m) * 255)
188
+ return r, g, b
189
+
190
+ def rgb_text(self, text, r, g, b): return f"\033[38;2;{r};{g};{b}m{text}\033[0m"
191
+
192
+ def animate_rgb_text(self, text, delay=0.01):
193
+ r, g, b = self.hsl_to_rgb(self.hue, s=1.0, l=0.5)
194
+ self.hue = (self.hue + 1) % 360
195
+ time.sleep(delay)
196
+ return f" \033[1m{self.rgb_text(text, r, g, b)}\033[0m"
197
+
198
+ class exec_gen():
199
+ def __init__(self):
200
+ self.current_dir = None
201
+ self.target_file = None
202
+ self.file_name = None
203
+
204
+ def preparations(self):
205
+ self.current_dir = os.getcwd()
206
+
207
+ parser = argparse.ArgumentParser(description="Script to generate .exe and preventing bugs")
208
+ parser.add_argument("file", type=str, help="Put the name of file after the command (with the extension '.py')")
209
+
210
+ args = parser.parse_args()
211
+ self.file_name = args.file
212
+ self.target_file = os.path.join(self.current_dir, self.file_name)
213
+
214
+ if not os.path.exists(self.target_file):
215
+ print(f"Error: File '{self.target_file}' does not exist.")
216
+ return
217
+
218
+ def run_pyinstaller(self):
219
+ global process_finished
220
+
221
+ def print_footer():
222
+ """Função que mantém a mensagem 'Aguarde download' na última linha."""
223
+ while not process_finished:
224
+ sys.stdout.write(f"\r \033[F\r\033[K\033[E {visuals.animate_rgb_text(f" {visuals.Neg}| Gerando executável do '{self.file_name}', aguarde finalização. |{visuals.RESET}")}\n\033[F")
225
+ sys.stdout.flush()
226
+
227
+ process_finished = False
228
+
229
+ command = ["pyinstaller", self.target_file]
230
+ process = subprocess.Popen(
231
+ command,
232
+ stdout=subprocess.PIPE,
233
+ stderr=subprocess.STDOUT,
234
+ universal_newlines=True,
235
+ bufsize=1
236
+ )
237
+ footer_thread = threading.Thread(target=print_footer)
238
+ footer_thread.start()
239
+
240
+ # Lê a saída do PyInstaller em tempo real
241
+ while True:
242
+ output = process.stdout.readline()
243
+ if output == '' and process.poll() is not None:
244
+ break
245
+ if output:
246
+ sys.stdout.write(f"\033[F\r\033[K{output.strip()}\033[K\n\n")
247
+ sys.stdout.flush()
248
+
249
+ process_finished = True
250
+ footer_thread.join()
251
+
252
+ print(f"\r \033[F\r\033[K\033[f\r\033[K\033[2E{visuals.Neg}{visuals.DK_ORANGE}>{visuals.RESET}{visuals.Neg} Executável gerado com sucesso!\n{visuals.RESET}\033[3E")
253
+
254
+ script = exec_gen()
255
+ visuals = visual()
256
+ script.preparations()
257
+ script.run_pyinstaller()
bcpkgfox/cli.py CHANGED
@@ -174,7 +174,7 @@ class cli:
174
174
  or self.args.exe:
175
175
  self.find_imports.verify_imports()
176
176
  else:
177
- print(f"{self.visuals.bold}{self.visuals.RD} > Error: You need to use one function that installs imports before verifying them.{self.visuals.RESET}")
177
+ print(f"{self.visuals.bold}{self.visuals.RD} > Error: You need to use one function that installs imports before verifying them{self.visuals.RESET}")
178
178
  print("\033[J", end='', flush=True)
179
179
 
180
180
  self.clean_terminal()
@@ -501,11 +501,11 @@ class cli:
501
501
  self.target_file = self.cli.file #FIX
502
502
 
503
503
  if not self.target_file:
504
- print(f"{self.visuals.bold}{self.visuals.RD} > Error: Please pass your 'target_file', to detect the libraries.{self.visuals.RESET}")
504
+ print(f"{self.visuals.bold}{self.visuals.RD} > Error: Please pass your 'target_file' to detect the libraries.{self.visuals.RESET}")
505
505
  sys.exit(1)
506
506
 
507
507
  if not os.path.exists(self.target_file):
508
- print(f"{self.visuals.bold}{self.visuals.RD} > Error: your 'target_file' does not exist or can't be accessed.{self.visuals.RESET}")
508
+ print(f"{self.visuals.bold}{self.visuals.RD} > Error: Your 'target_file' does not exist or can't be accessed.{self.visuals.RESET}")
509
509
  sys.exit(1)
510
510
 
511
511
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcpkgfox
3
- Version: 0.16.25
3
+ Version: 0.16.27
4
4
  Summary: Biblioteca BCFOX
5
5
  Home-page: https://github.com/robotsbcfox/PacotePythonBCFOX
6
6
  Author: Guilherme Neri
@@ -0,0 +1,13 @@
1
+ bcpkgfox/__init__.py,sha256=rQUidstj6OyeKaqB7qXDUXeN41owoGyWnJuJ_ir54m4,16138
2
+ bcpkgfox/clean.py,sha256=80pJDTGmKmPiq73uL1IWopuxqVJF_bj_RVv-njkpl-A,8946
3
+ bcpkgfox/cli.py,sha256=l6GnGmOsx3heYO3h06O6v7Mv6N0nGqnJ9Z0EVrHy1aY,31096
4
+ bcpkgfox/exec_file.py,sha256=fl_Do2SlF7JuXazpNTod-e_0WZUk355fbd7ustQvi40,3728
5
+ bcpkgfox/find_elements.py,sha256=oeB-73LqMLoKchozPXuxRkThBju9IgUKqbgU-2AAq0s,23027
6
+ bcpkgfox/get_driver.py,sha256=ohimk9E2hL6T35IXv0XX0uvWDGCUZvZDlPMnuRjV1R0,30490
7
+ bcpkgfox/invoke_api.py,sha256=UTksbSmg6yucWk-egH1gavYoViKvpUq-OAp5t308ZmY,5334
8
+ bcpkgfox/system.py,sha256=U5vEReSVIQ7LZ-1slUglNyU6k0Vahfioozm6QVEIqfE,6732
9
+ bcpkgfox-0.16.27.dist-info/METADATA,sha256=5eX0E5EwfUGh62Waqe6B8hJ2VM03tqwZse4K-5ZdApM,1912
10
+ bcpkgfox-0.16.27.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
11
+ bcpkgfox-0.16.27.dist-info/entry_points.txt,sha256=qmaEg6K7Y0HOeaFo-G6lf44InGkeVI4I6hqobcY_nns,653
12
+ bcpkgfox-0.16.27.dist-info/top_level.txt,sha256=h01SqyYBEfS72vkRFOlEDZBUSu9pzU0bdX4m9hWNNmw,9
13
+ bcpkgfox-0.16.27.dist-info/RECORD,,
@@ -1,5 +1,12 @@
1
1
  [console_scripts]
2
2
  bc = bcpkgfox.cli:main
3
+ bc-clean = bcpkgfox.clean_main:main
4
+ bc_clean = bcpkgfox.clean_main:main
5
+ bcc = bcpkgfox.clean_main:main
6
+ bcclaen = bcpkgfox.clean_main:main
7
+ bcclean = bcpkgfox.clean_main:main
8
+ bccleanfox = bcpkgfox.clean_main:main
9
+ bcclen = bcpkgfox.clean_main:main
3
10
  bcfox = bcpkgfox.cli:main
4
11
  bcpkffox = bcpkgfox.cli:main
5
12
  bcpkfox = bcpkgfox.cli:main
@@ -8,6 +15,8 @@ bcpkgfox = bcpkgfox.cli:main
8
15
  bcpkhfox = bcpkgfox.cli:main
9
16
  bpckgofx = bcpkgfox.cli:main
10
17
  bpkg = bcpkgfox.cli:main
18
+ cleanbc = bcpkgfox.clean_main:main
19
+ cleanfox = bcpkgfox.clean_main:main
11
20
  fox = bcpkgfox.cli:main
12
21
  pkg = bcpkgfox.cli:main
13
22
  pkgfox = bcpkgfox.cli:main
@@ -1,12 +0,0 @@
1
- bcpkgfox/__init__.py,sha256=tIFJ-KIMZK_ZjcrUg92QoHd2Rbte4cvuPMlPUzjtK0U,15945
2
- bcpkgfox/cli.py,sha256=OdgFtjCvd_Qv-0gQ8Usnu_aqK3jpfnxeMr4Ltz2zG5E,31098
3
- bcpkgfox/exec_file.py,sha256=fl_Do2SlF7JuXazpNTod-e_0WZUk355fbd7ustQvi40,3728
4
- bcpkgfox/find_elements.py,sha256=oeB-73LqMLoKchozPXuxRkThBju9IgUKqbgU-2AAq0s,23027
5
- bcpkgfox/get_driver.py,sha256=ohimk9E2hL6T35IXv0XX0uvWDGCUZvZDlPMnuRjV1R0,30490
6
- bcpkgfox/invoke_api.py,sha256=UTksbSmg6yucWk-egH1gavYoViKvpUq-OAp5t308ZmY,5334
7
- bcpkgfox/system.py,sha256=U5vEReSVIQ7LZ-1slUglNyU6k0Vahfioozm6QVEIqfE,6732
8
- bcpkgfox-0.16.25.dist-info/METADATA,sha256=rAGw2ad9VdYnEEbFtOKlioD2NabEWm1Ryy_M5BcXUIM,1912
9
- bcpkgfox-0.16.25.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
10
- bcpkgfox-0.16.25.dist-info/entry_points.txt,sha256=zzthtJtEpeRjlpE6YDBbSGVH6hvnnVyRxVSSgz1_S0M,337
11
- bcpkgfox-0.16.25.dist-info/top_level.txt,sha256=h01SqyYBEfS72vkRFOlEDZBUSu9pzU0bdX4m9hWNNmw,9
12
- bcpkgfox-0.16.25.dist-info/RECORD,,