bcpkgfox 0.16.33__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.

Potentially problematic release.


This version of bcpkgfox might be problematic. Click here for more details.

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, pure = None):
228
+ def selectfox(elemento, method, key, relative = None):
229
229
  """
230
230
  Seleciona uma opção em um elemento <select>.
231
231
 
@@ -233,6 +233,7 @@ def selectfox(elemento, method, key, pure = None):
233
233
  - elemento: Elemento <select> encontrado pelo Selenium.
234
234
  - method: Método de seleção ('index', 'text' ou 'value').
235
235
  - key: Valor usado na seleção (índice, texto visível ou valor do atributo 'value').
236
+ - relative: Ao invés de selecionar um elemento identico, seleciona um elemento que apenas contém a 'key'
236
237
 
237
238
  - Exemplo:
238
239
  elemento_select = bc.find_element_with_wait("xpath", '//select[@value="VALUE_DO_PRIMEIRO_SELECT"]')
@@ -264,12 +265,12 @@ def selectfox(elemento, method, key, pure = None):
264
265
  if method == "text":
265
266
  elements = select.options
266
267
  for elm in elements:
267
- if pure:
268
- if key == elm.text:
268
+ if relative:
269
+ if key.lower().strip() in elm.text.lower().strip():
269
270
  select.select_by_visible_text(elm.text)
270
271
  return
271
272
  else:
272
- if key.lower().strip() in elm.text.lower().strip():
273
+ if key == elm.text:
273
274
  select.select_by_visible_text(elm.text)
274
275
  return
275
276
 
@@ -456,6 +457,6 @@ def move_mouse_smoothly(element, click=False):
456
457
  RESET, GR, ORANGE, DK_ORANGE = "\033[0m", "\033[38;5;34m", "\033[38;5;214m", "\033[38;5;130m"
457
458
  result = subprocess.run(['pip', 'show', "bcpkgfox"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
458
459
  version_line = next((line for line in result.stdout.decode().splitlines() if line.startswith('Version:')), None)
459
- try: print(f"\n\n{ORANGE}Biblioteca BCFOX importada - {re.sub(r"[^0-9.b]", "", version_line)}{RESET}")
460
+ try: print(f"\n\n{ORANGE}Biblioteca BCFOX importada - {re.sub(r'[^0-9.b]', '', version_line)}{RESET}")
460
461
  except: pass
461
462
  create_dirs()
bcpkgfox/cli.py CHANGED
@@ -60,7 +60,9 @@ class cli:
60
60
  venv_group.add_argument(
61
61
  '-r', '--requirements',
62
62
  action='store_true',
63
- const='requirements.txt'
63
+ # nargs='?',
64
+ # action=self.venv_manager.custom_action_requirements,
65
+ # default=False,
64
66
  help="Create a requirements\n"
65
67
  )
66
68
 
@@ -183,6 +185,10 @@ class cli:
183
185
  print(f"{self.visuals.bold}{self.visuals.RD} > Error: You need to use one function that installs imports before verifying them{self.visuals.RESET}")
184
186
  print("\033[J", end='', flush=True)
185
187
 
188
+ # Requirements
189
+ if self.args.requirements:
190
+ self.venv_manager.requirements()
191
+
186
192
  self.clean_terminal()
187
193
 
188
194
  def clean_terminal(self):
@@ -504,7 +510,7 @@ class cli:
504
510
  print(f" {self.visuals.bold}{self.visuals.YL} - {lib} {self.visuals.RESET}")
505
511
 
506
512
  def main(self, return_=False):
507
- self.target_file = self.cli.file #FIX
513
+ self.target_file = self.cli.file
508
514
 
509
515
  if not self.target_file:
510
516
  print(f"{self.visuals.bold}{self.visuals.RD} > Error: Please pass your 'target_file' to detect the libraries.{self.visuals.RESET}")
@@ -538,6 +544,7 @@ class cli:
538
544
  "PdfWriter": "pypdf",
539
545
  "import PyPDF2": "PyPDF2",
540
546
  "invoke_api_": "requests",
547
+ "login_2fac": "pyautogui",
541
548
  "wait_for": "pygetwindow",
542
549
  "from selenium_stealth import stealth": "selenium-stealth",
543
550
  "capmonstercloudclient": "bcpkgfox[capmonstercloudclient]",
@@ -795,21 +802,59 @@ class cli:
795
802
  self.delete_venv()
796
803
  self.create_venv()
797
804
 
798
- def requirementes(self):
799
- if self.cli.args.requirements:
800
- if '.' in self.cli.args.requirements:
801
- ext = self.cli.args.requirements.rsplit('.', 1)[1]
805
+ class custom_action_requirements(argparse.Action):
806
+ ''' This is necessary to define a new action and the parser identifies it as valid '''
807
+
808
+ def __call__(self, parser, namespace, values, option_string=None):
809
+ if values is None:
810
+ setattr(namespace, self.dest, 'requirements.txt')
802
811
  else:
803
- ext = None
804
- try:
805
- os.remove(os.path.join(self.current_dir, self.cli.args.requirements))
806
- except:
807
- try:
808
- os.remove(os.path.join(self.current_dir, 'requirements.txt'))
809
- except:
810
- pass
812
+ setattr(namespace, self.dest, values)
813
+
814
+ def requirements(self):
815
+
816
+ # # Identifies endwish
817
+ # if '.' in self.cli.args.requirements:
818
+ # name = self.cli.args.requirements
819
+ # else:
820
+ # name = self.cli.args.requirements + '.txt'
821
+
822
+ # FIX: name is always 'requirements.txt'
823
+ name = 'requirements.txt'
824
+
825
+ # Attempt of recreate
826
+ try:
827
+ os.remove(os.path.join(self.current_dir, name))
828
+ except:
829
+ pass
830
+
831
+ # Creates a new one
832
+ subprocess.run(f"pip freeze > {name}", shell=True)
833
+
834
+ # Read
835
+ with open(f'{name}', 'r') as f:
836
+ lines = f.readlines()
837
+
838
+ # Re-write
839
+ add_list = []
840
+ imports = self.cli.find_imports.main(return_=True)
841
+ imports_lower = {imp.lower() for imp in imports}
842
+ with open(f'{name}', 'w') as f:
843
+
844
+ for line in lines:
845
+
846
+ # Formats
847
+ if '\n' in line:
848
+ line_for_print = line.replace('\n', '').strip()
849
+
850
+ # Compares
851
+ pkg = line.split('==')[0].strip().lower()
852
+ if pkg in imports_lower:
853
+ f.write(line)
854
+ add_list.append(line_for_print)
811
855
 
812
- subprocess.run("pip freeze > requirements.txt", shell=True)
856
+ print(f"\n{self.visuals.bold}{self.visuals.GR} > Requirements created with sucessfuly {self.visuals.RESET}\n")
857
+ print(f"{self.visuals.bold}{self.visuals.YL} Libraries installed: {self.visuals.RESET}{self.visuals.YL}" + "".join(f"\n {lib}" for lib in add_list) + f"{self.visuals.RESET}")
813
858
 
814
859
  def main(self):
815
860
  try: self.delete_venv()
bcpkgfox/invoke_api.py CHANGED
@@ -1,5 +1,12 @@
1
+ import json
2
+
3
+ from selenium.webdriver.support import expected_conditions as EC
4
+ from selenium.webdriver.support.ui import WebDriverWait
5
+ from selenium.webdriver.common.by import By
1
6
  from typing import Optional
7
+ from threading import Thread
2
8
  import time
9
+ import os
3
10
 
4
11
  def invoke_api_list(link: str, token: str, method: Optional[str] = "GET", headers: Optional[str] = None, print_response: Optional[bool] = False) -> dict:
5
12
  import requests
@@ -161,3 +168,371 @@ def invoke_api_proc_log(link, id_robo, token):
161
168
  responseinsert = requests.request(
162
169
  "POST", link, json=payload, headers=headers)
163
170
  print(f"\n{responseinsert.json()}")
171
+
172
+ def login_2fac(driver, certificate, system, token, code_timeout=60):
173
+ import requests
174
+ import pyautogui
175
+ from . import mostrar_mensagem
176
+
177
+ class login_2fac:
178
+ def __init__(self):
179
+ self.certificate = certificate
180
+ self.system = system
181
+ self.token = token
182
+ self.code_timeout = code_timeout
183
+ self.driver = driver
184
+
185
+ class Pop_up_protection(login_2fac):
186
+ def __init__(self):
187
+ super().__init__()
188
+ self.status = False
189
+
190
+ def __monitor(self):
191
+ while self.status:
192
+
193
+ handles = self.driver.window_handles
194
+ if len(handles) > 1:
195
+ self.driver.switch_to.window(self.driver.window_handles[-1])
196
+
197
+ try:
198
+ alert = self.driver.switch_to.alert
199
+ alert.accept()
200
+ except:
201
+ pass
202
+
203
+ time.sleep(0.1)
204
+
205
+ def start(self):
206
+ self.status = True
207
+ protection = Thread(target=self.__monitor, daemon=True)
208
+ protection.start()
209
+
210
+ def stop(self):
211
+ self.status = False
212
+
213
+ class tool(login_2fac):
214
+ def find_element_with_wait(self, by, value, timeout=10):
215
+ global driver
216
+ return WebDriverWait(
217
+ self.driver, timeout).until(
218
+ EC.presence_of_element_located(
219
+ (by, value)))
220
+
221
+ def find_elements_with_wait(self, by, value, timeout=10):
222
+ return WebDriverWait(
223
+ self.driver, timeout).until(
224
+ EC.presence_of_all_elements_located(
225
+ (by, value)))
226
+
227
+ class invokes_whoom(login_2fac):
228
+ def __init__(self):
229
+ super().__init__()
230
+
231
+ self.list_codes = []
232
+
233
+ def invoke_get_codes(self):
234
+
235
+ url = "https://api-4.bcfox.com.br/bcjur/views/codigo-validacao"
236
+ headers = {"x-access-token": self.token}
237
+
238
+ max_attempts = 5
239
+ for attempt in range(1, max_attempts + 1):
240
+ try:
241
+ response = requests.get(url, headers=headers)
242
+ response.raise_for_status() # Lança uma exceção se a resposta não for bem-sucedida
243
+
244
+ self.list_codes = response.json()
245
+ # print(self.list_codes)
246
+ return self.list_codes
247
+
248
+ except Exception as e:
249
+ print(f'Tentativa {attempt} falhou: {e}')
250
+
251
+ if attempt < max_attempts:
252
+ print('Tentando novamente em 5 segundos...')
253
+ time.sleep(5)
254
+ continue
255
+ else:
256
+ raise('Todas as tentativas falharam!')
257
+
258
+ def invoke_update_status(self, id):
259
+
260
+ url = f"https://api-4.bcfox.com.br/bcjur/views/codigo-validacao/{id}"
261
+ headers = {"x-access-token": self.token}
262
+
263
+ max_attempts = 5
264
+ for attempt in range(1, max_attempts + 1):
265
+ try:
266
+ responseinsert = requests.put(url, headers=headers)
267
+ responseinsert.raise_for_status() # Lança uma exceção se a resposta não for bem-sucedida
268
+
269
+ print(responseinsert)
270
+ return responseinsert
271
+
272
+ except Exception as e:
273
+ print(f'Tentativa {attempt} falhou: {e}')
274
+
275
+ if attempt < max_attempts:
276
+ print('Tentando novamente em 5 segundos...')
277
+ time.sleep(5)
278
+ continue
279
+ else:
280
+ raise('Todas as tentativas falharam!')
281
+
282
+ class whoom_codes(login_2fac):
283
+ def __init__(self):
284
+ super().__init__()
285
+
286
+ def extension_check(self):
287
+
288
+ self.driver.get('chrome-extension://lnidijeaekolpfeckelhkomndglcglhh/index.html')
289
+ time.sleep(3)
290
+
291
+ for _ in range(10):
292
+
293
+ # Caso a extensão já esteja instalada
294
+ try:
295
+ tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Digite ou selecione um sistema pra acessar"]', timeout=1)
296
+ return
297
+ except: pass
298
+
299
+ try:
300
+ tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Insira aqui o seu email"]', timeout=1)
301
+ return
302
+ except: pass
303
+
304
+ # Caso a extensão não esteja instala
305
+ if 'This page has been blocked by Chrome' in driver.page_source:
306
+ break
307
+
308
+ if 'eliezer@bcfox.com.br' in self.driver.page_source:
309
+ tools.find_element_with_wait(By.XPATH, "//span[text()='alterar']").click()
310
+ return
311
+
312
+ # Abrir uma nova aba
313
+ self.driver.execute_script("window.open('');")
314
+
315
+ # Fechar a aba original
316
+ self.driver.close()
317
+
318
+ # Mudar para a nova aba
319
+ self.driver.switch_to.window(self.driver.window_handles[-1])
320
+
321
+ time.sleep(1)
322
+
323
+ self.driver.get("https://chromewebstore.google.com/detail/whom-gerenciador-de-certi/lnidijeaekolpfeckelhkomndglcglhh")
324
+
325
+
326
+ tools.find_element_with_wait(By.XPATH, "//span[contains(text(), 'no Chrome') or contains(text(), 'Usar') or contains(text(), 'Add to Chrome')]").click()
327
+ time.sleep(5)
328
+ import pygetwindow as gw
329
+ windows = gw.getAllTitles()
330
+ for w in windows:
331
+ if w and "Whom?".lower() in w.lower():
332
+ print("Janela de extensão detectada:", w)
333
+ window = gw.getWindowsWithTitle(w)[0]
334
+ window.activate()
335
+ time.sleep(1)
336
+ coords = (gw.getActiveWindow().left + gw.getActiveWindow().size[0] // 2,
337
+ gw.getActiveWindow().top + int(gw.getActiveWindow().size[1] * 0.3))
338
+ pyautogui.moveTo(coords[0], coords[1])
339
+ pyautogui.click()
340
+
341
+ # Envia TAB e ENTER do teclado físico
342
+ pyautogui.press('tab')
343
+ time.sleep(0.5)
344
+ pyautogui.press('enter')
345
+ time.sleep(5)
346
+ break
347
+
348
+ self.driver.get('chrome-extension://lnidijeaekolpfeckelhkomndglcglhh/index.html')
349
+
350
+ def codes_2_fac(self):
351
+ try:
352
+ tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Digite ou selecione um sistema pra acessar"]', timeout=2).send_keys(self.system)
353
+ code_insertion = True
354
+
355
+ except:
356
+ self.driver.get('chrome-extension://lnidijeaekolpfeckelhkomndglcglhh/index.html')
357
+
358
+ # Request the code
359
+ for _ in range(50): # Wait the extension to load
360
+
361
+ try:
362
+ tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Insira aqui o seu email"]', timeout=1).send_keys('eliezer@bcfox.com.br')
363
+ time.sleep(1)
364
+ break
365
+ except:
366
+ self.driver.get('chrome-extension://lnidijeaekolpfeckelhkomndglcglhh/index.html')
367
+
368
+ # Envia o código pro email, o for é só para tratativa de bugs
369
+ for _ in range(10):
370
+ try:
371
+ tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Digite aqui o código que enviamos para o seu e-mail"]', timeout=1)
372
+ break
373
+
374
+ except:
375
+ try:
376
+ element = tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Insira aqui o seu email"]', timeout=1)
377
+ element.clear()
378
+ element.send_keys('eliezer@bcfox.com.br')
379
+ tools.find_element_with_wait(By.XPATH, '//button').click()
380
+ time.sleep(1)
381
+ except:
382
+ break
383
+
384
+ # Attempts the new codes until success or requests limit
385
+ for _ in range(code_timeout):
386
+ responses = api.invoke_get_codes()
387
+
388
+ # Try new codes
389
+ code_insertion = False
390
+ for response in responses:
391
+
392
+ CODE = response['CODIGO']
393
+ ID = response['ID']
394
+
395
+ element = tools.find_element_with_wait(By.XPATH, '//input[@type="password"]')
396
+ element.clear()
397
+ element.send_keys(CODE)
398
+
399
+ for _ in range(10):
400
+ try:
401
+ tools.find_element_with_wait(By.XPATH, '//div/div[2]/button', timeout=2).click()
402
+ time.sleep(1)
403
+ except:
404
+ break
405
+
406
+ # Check the code result
407
+ for _ in range(30):
408
+
409
+ # Correct
410
+ try:
411
+ # input('\n\n > Selecione o sistema e aperte alguma tecla.')
412
+ tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Digite ou selecione um sistema pra acessar"]', timeout=1).send_keys(self.system)
413
+ api.invoke_update_status(ID) #FIX: Update
414
+ code_insertion = True
415
+ break
416
+
417
+ except:
418
+ pass
419
+
420
+ # Wrong
421
+ try:
422
+ tools.find_element_with_wait(By.XPATH, "//span[contains(text(), 'Senha inválida')]", timeout=1)
423
+ tools.find_element_with_wait(By.XPATH, "//button[text()='Voltar']", timeout=1).click()
424
+ code_insertion = False
425
+ break
426
+
427
+ except:
428
+ pass
429
+
430
+ # If the 'new_response' loop succeeds immediately
431
+ if not responses:
432
+ time.sleep(1)
433
+
434
+ if code_insertion:
435
+ break
436
+
437
+ if not(code_insertion):
438
+ raise TimeoutError('Código WHOOM não chegou dentro do timeout estabelecido')
439
+
440
+ def select_system(self):
441
+ time.sleep(4)
442
+ try:
443
+ tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Insira aqui o seu email"]',
444
+ timeout=1).click()
445
+ time.sleep(1)
446
+ self.codes_2_fac()
447
+ return
448
+ except:
449
+ pass
450
+
451
+ # Selects the system to access
452
+ lines = tools.find_elements_with_wait(By.XPATH, '//div[@role="menu"]//div[@role="menuitem"]')
453
+
454
+ finded = False
455
+ div_list = []
456
+
457
+ # This loop extract the lines with the system name
458
+ for line in lines:
459
+
460
+ titulo_element = line.find_elements(By.XPATH, './span[*[name()="svg"]]')
461
+
462
+ if not titulo_element and not finded:
463
+ continue
464
+
465
+ elif titulo_element and not finded:
466
+ titulo_text = line.find_element(By.XPATH, './span').text
467
+ if self.certificate.lower().strip() in titulo_text.lower().strip():
468
+ finded = True
469
+ continue
470
+
471
+ elif not titulo_element and finded:
472
+ div_list.append(line)
473
+
474
+ elif titulo_element and finded:
475
+ break
476
+
477
+ if not div_list:
478
+ mostrar_mensagem('Não conseguiu achar o sistema no certificado')
479
+ raise ValueError('Não conseguiu achar o sistema no certificado')
480
+
481
+ if len(div_list) == 1:
482
+ time.sleep(1)
483
+ div_list[0].click()
484
+
485
+ # Just do this loop if there are more than one system
486
+ else:
487
+ for div in div_list:
488
+ div_text = div.find_element(By.XPATH, './span').text
489
+ if self.system.lower().strip() not in div_text.lower().strip():
490
+ div_list.remove(div)
491
+
492
+ if len(div_list) == 1:
493
+ div_list[0].click()
494
+ else:
495
+ mostrar_mensagem('Mais de um sistema encontrado, verifique o nome do sistema no WHOOM e coloque um nome único na função')
496
+ raise ValueError('Mais de um sistema encontrado, verifique o nome')
497
+
498
+
499
+ # Verifies if the system was opened
500
+ for _ in range(30):
501
+ time.sleep(1)
502
+ if len(self.driver.window_handles) == 1:
503
+ try:
504
+ tools.find_element_with_wait(By.XPATH, "//button[text()='Acessar']", timeout=1).click()
505
+ except:
506
+ time.sleep(1)
507
+ else:
508
+ time.sleep(3)
509
+ break
510
+
511
+ self.driver.switch_to.window(self.driver.window_handles[-1])
512
+ attempt = 0
513
+ while 'whoom' in self.driver.title.strip().lower() and attempt <= 180:
514
+ time.sleep(1)
515
+ attempt += 1
516
+ time.sleep(5)
517
+
518
+ if attempt >= 180:
519
+ mostrar_mensagem('Whoom congelou no conectar com site.')
520
+ raise SystemError('Whoom congelou no conectar com site.')
521
+
522
+ protection.stop()
523
+ if len(self.driver.window_handles) > 1:
524
+ self.driver.switch_to.window(self.driver.window_handles[0])
525
+ self.driver.close()
526
+ self.driver.switch_to.window(self.driver.window_handles[-1])
527
+
528
+ # Instances
529
+ tools = tool()
530
+ api = invokes_whoom()
531
+ protection = Pop_up_protection()
532
+ bot = whoom_codes()
533
+
534
+ # Operacional
535
+ bot.extension_check()
536
+ protection.start()
537
+ bot.codes_2_fac()
538
+ bot.select_system()
bcpkgfox/system.py CHANGED
@@ -253,5 +253,3 @@ class System:
253
253
  return estados[valor.upper()]
254
254
  estado_uf = {v.lower(): k for k, v in estados.items()}
255
255
  return estado_uf.get(valor.lower(), "Valor inválido")
256
-
257
-
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcpkgfox
3
- Version: 0.16.33
3
+ Version: 0.17.7
4
4
  Summary: Biblioteca BCFOX
5
5
  Home-page: https://github.com/robotsbcfox/PacotePythonBCFOX
6
- Author: Guilherme Neri
7
- Author-email: guilherme.neri@bcfox.com.br
6
+ Author: BCFOX
7
+ Author-email: bcfox@bcfox.com.br
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Operating System :: OS Independent
@@ -0,0 +1,12 @@
1
+ bcpkgfox/__init__.py,sha256=49TPbTUNI6xKcYk4blwseUZQTgHtRcNI1AFEqxSQ3wY,16540
2
+ bcpkgfox/clean.py,sha256=80pJDTGmKmPiq73uL1IWopuxqVJF_bj_RVv-njkpl-A,8946
3
+ bcpkgfox/cli.py,sha256=E1Yahd8jIjUwxM6EMHveDDne5-fh8QeAvAhyATNatEo,33541
4
+ bcpkgfox/find_elements.py,sha256=oeB-73LqMLoKchozPXuxRkThBju9IgUKqbgU-2AAq0s,23027
5
+ bcpkgfox/get_driver.py,sha256=ohimk9E2hL6T35IXv0XX0uvWDGCUZvZDlPMnuRjV1R0,30490
6
+ bcpkgfox/invoke_api.py,sha256=TQ9f_eAhf37VvEyUL6UJR__r8HWTvpsgMsR7X56kGdM,20140
7
+ bcpkgfox/system.py,sha256=3lyOWx893T6KiAI-jDv7zAo3oKPf0Q5CLgZ8TeFd0Do,7901
8
+ bcpkgfox-0.17.7.dist-info/METADATA,sha256=VmejLvx9ZJbmeL9_Y2BWnKGfnUkfgSV-zQZgJmaW0qU,1893
9
+ bcpkgfox-0.17.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
+ bcpkgfox-0.17.7.dist-info/entry_points.txt,sha256=qmaEg6K7Y0HOeaFo-G6lf44InGkeVI4I6hqobcY_nns,653
11
+ bcpkgfox-0.17.7.dist-info/top_level.txt,sha256=h01SqyYBEfS72vkRFOlEDZBUSu9pzU0bdX4m9hWNNmw,9
12
+ bcpkgfox-0.17.7.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
bcpkgfox/exec_file.py DELETED
@@ -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()
@@ -1,13 +0,0 @@
1
- bcpkgfox/__init__.py,sha256=BCTiPEXhpV3lV3HSVW6iCWFVema6VsIuwCQrUcHk8QM,16416
2
- bcpkgfox/clean.py,sha256=80pJDTGmKmPiq73uL1IWopuxqVJF_bj_RVv-njkpl-A,8946
3
- bcpkgfox/cli.py,sha256=QodEes-R-BxwTe1Z1m_VVDEfDtvpqxQU4f4Mk8B9fRM,31841
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=5jj1LbLwNYPRjYQYFPX4t5QfxW9r1-LYkyXosss9QOU,7905
9
- bcpkgfox-0.16.33.dist-info/METADATA,sha256=X01Vcrt9JGJCT8fW32sMP79fLnEN55VSYSEilGf641E,1912
10
- bcpkgfox-0.16.33.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
11
- bcpkgfox-0.16.33.dist-info/entry_points.txt,sha256=qmaEg6K7Y0HOeaFo-G6lf44InGkeVI4I6hqobcY_nns,653
12
- bcpkgfox-0.16.33.dist-info/top_level.txt,sha256=h01SqyYBEfS72vkRFOlEDZBUSu9pzU0bdX4m9hWNNmw,9
13
- bcpkgfox-0.16.33.dist-info/RECORD,,