bcpkgfox 0.16.26__tar.gz → 0.16.27__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcpkgfox
3
- Version: 0.16.26
3
+ Version: 0.16.27
4
4
  Summary: Biblioteca BCFOX
5
5
  Home-page: https://github.com/robotsbcfox/PacotePythonBCFOX
6
6
  Author: Guilherme Neri
@@ -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":
@@ -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()
@@ -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()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcpkgfox
3
- Version: 0.16.26
3
+ Version: 0.16.27
4
4
  Summary: Biblioteca BCFOX
5
5
  Home-page: https://github.com/robotsbcfox/PacotePythonBCFOX
6
6
  Author: Guilherme Neri
@@ -1,8 +1,8 @@
1
1
  README.md
2
2
  setup.py
3
3
  bcpkgfox/__init__.py
4
+ bcpkgfox/clean.py
4
5
  bcpkgfox/cli.py
5
- bcpkgfox/exec_file.py
6
6
  bcpkgfox/find_elements.py
7
7
  bcpkgfox/get_driver.py
8
8
  bcpkgfox/invoke_api.py
@@ -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
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="bcpkgfox",
5
- version="0.16.26",
5
+ version="0.16.27",
6
6
  author="Guilherme Neri",
7
7
  author_email="guilherme.neri@bcfox.com.br",
8
8
  description="Biblioteca BCFOX",
@@ -26,6 +26,17 @@ setup(
26
26
  "fox",
27
27
  "bc",
28
28
  ]],
29
+ *[f"{cmd}=bcpkgfox.clean_main:main" for cmd in [
30
+ "bcclean",
31
+ "bcc",
32
+ "bcclen",
33
+ "bcclaen",
34
+ "bc-clean",
35
+ "bc_clean",
36
+ "cleanbc",
37
+ "bccleanfox",
38
+ "cleanfox",
39
+ ]],
29
40
  ]
30
41
  },
31
42
  classifiers=[
@@ -1,100 +0,0 @@
1
- import subprocess
2
- import threading
3
- import argparse
4
- import time
5
- import sys
6
- import os
7
-
8
- def main():
9
-
10
- class visual():
11
- def __init__(self):
12
- self.RESET = "\033[0m"
13
- self.DK_ORANGE = "\033[38;5;130m"
14
- self.Neg = "\033[1m"
15
- self.hue = 0
16
-
17
- def hsl_to_rgb(self, h, s, l):
18
- h = h % 360
19
- c = (1 - abs(2 * l - 1)) * s
20
- x = c * (1 - abs((h / 60) % 2 - 1))
21
- m = l - c / 2
22
-
23
- if 0 <= h < 60: r, g, b = c, x, 0
24
- elif 60 <= h < 120: r, g, b = x, c, 0
25
- elif 120 <= h < 180: r, g, b = 0, c, x
26
- elif 180 <= h < 240: r, g, b = 0, x, c
27
- elif 240 <= h < 300: r, g, b = x, 0, c
28
- elif 300 <= h < 360: r, g, b = c, 0, x
29
-
30
- r = int((r + m) * 255) ; g = int((g + m) * 255) ; b = int((b + m) * 255)
31
- return r, g, b
32
-
33
- def rgb_text(self, text, r, g, b): return f"\033[38;2;{r};{g};{b}m{text}\033[0m"
34
-
35
- def animate_rgb_text(self, text, delay=0.01):
36
- r, g, b = self.hsl_to_rgb(self.hue, s=1.0, l=0.5)
37
- self.hue = (self.hue + 1) % 360
38
- time.sleep(delay)
39
- return f" \033[1m{self.rgb_text(text, r, g, b)}\033[0m"
40
-
41
- class exec_gen():
42
- def __init__(self):
43
- self.current_dir = None
44
- self.target_file = None
45
- self.file_name = None
46
-
47
- def preparations(self):
48
- self.current_dir = os.getcwd()
49
-
50
- parser = argparse.ArgumentParser(description="Script to generate .exe and preventing bugs")
51
- parser.add_argument("file", type=str, help="Put the name of file after the command (with the extension '.py')")
52
-
53
- args = parser.parse_args()
54
- self.file_name = args.file
55
- self.target_file = os.path.join(self.current_dir, self.file_name)
56
-
57
- if not os.path.exists(self.target_file):
58
- print(f"Error: File '{self.target_file}' does not exist.")
59
- return
60
-
61
- def run_pyinstaller(self):
62
- global process_finished
63
-
64
- def print_footer():
65
- """Função que mantém a mensagem 'Aguarde download' na última linha."""
66
- while not process_finished:
67
- 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")
68
- sys.stdout.flush()
69
-
70
- process_finished = False
71
-
72
- command = ["pyinstaller", self.target_file]
73
- process = subprocess.Popen(
74
- command,
75
- stdout=subprocess.PIPE,
76
- stderr=subprocess.STDOUT,
77
- universal_newlines=True,
78
- bufsize=1
79
- )
80
- footer_thread = threading.Thread(target=print_footer)
81
- footer_thread.start()
82
-
83
- # Lê a saída do PyInstaller em tempo real
84
- while True:
85
- output = process.stdout.readline()
86
- if output == '' and process.poll() is not None:
87
- break
88
- if output:
89
- sys.stdout.write(f"\033[F\r\033[K{output.strip()}\033[K\n\n")
90
- sys.stdout.flush()
91
-
92
- process_finished = True
93
- footer_thread.join()
94
-
95
- 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")
96
-
97
- script = exec_gen()
98
- visuals = visual()
99
- script.preparations()
100
- script.run_pyinstaller()
File without changes
File without changes