rpa-suite 1.4.6__py3-none-any.whl → 1.4.8__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.
rpa_suite/__init__.py CHANGED
@@ -1,4 +1,5 @@
1
1
  # rpa_suite/__init__.py
2
+
2
3
  """
3
4
  RPA Suite is a Python module that provides a set of tools for process automation.
4
5
 
@@ -59,5 +60,6 @@
59
60
  ``Browser``: Objeto de Automação de Navegadores (necessario Selenium e Webdriver_Manager)
60
61
  """
61
62
 
63
+ # allows importing the rpa_suite module without the package name
62
64
  from .suite import rpa
63
65
  rpa
@@ -32,6 +32,7 @@ from .log import Log
32
32
  from .print import Print
33
33
  from .regex import Regex
34
34
  from .validate import Validate
35
+ from .parallel import ParallelRunner
35
36
 
36
37
 
37
38
 
rpa_suite/core/browser.py CHANGED
@@ -1,16 +1,20 @@
1
- # default import
2
- import os, requests
1
+ # rpa_suite/core/browser.py
3
2
 
4
- # imports
3
+ # imports internal
5
4
  from rpa_suite.functions._printer import error_print, alert_print, success_print
6
5
 
6
+ # imports external
7
7
  from selenium import webdriver
8
8
  from selenium.webdriver.common.by import By
9
9
  from selenium.webdriver.chrome.options import Options
10
10
  from selenium.webdriver.support.ui import WebDriverWait
11
11
  from selenium.webdriver.support import expected_conditions as EC
12
12
  from webdriver_manager.chrome import ChromeDriverManager
13
+
14
+ # imports third-party
13
15
  from time import sleep
16
+ import os, requests
17
+
14
18
 
15
19
 
16
20
  class Browser():
@@ -166,7 +170,7 @@ class Browser():
166
170
  error_print(f'Erro ao iniciar navegador: {str(e)}.')
167
171
 
168
172
 
169
- def find_ele(self, value, by=By.XPATH, timeout=12, display_message=True):
173
+ def find_ele(self, value: str, by:By=By.XPATH, timeout=12, display_message=True):
170
174
  """
171
175
  Locate and return a web element on the page using the specified locator strategy.
172
176
  Args:
rpa_suite/core/clock.py CHANGED
@@ -1,8 +1,12 @@
1
+ # rpa_suite/core/clock.py
1
2
 
3
+ # imports internal
4
+ from rpa_suite.functions._printer import error_print, success_print
5
+
6
+ # imports third-party
2
7
  import time
3
8
  from typing import Callable, Any
4
9
  from datetime import datetime as dt
5
- from rpa_suite.functions._printer import error_print, success_print
6
10
  from typing import Callable, Any
7
11
 
8
12
 
rpa_suite/core/date.py CHANGED
@@ -1,9 +1,13 @@
1
- # /date.py
1
+ # rpa_suite/core/date.py
2
2
 
3
+ # imports internal
4
+ from rpa_suite.functions._printer import error_print
5
+
6
+ # imports third-party
3
7
  import datetime as dt
4
8
  from typing import Optional as Op
5
9
  from typing import Tuple
6
- from rpa_suite.functions._printer import error_print
10
+
7
11
 
8
12
  class Date():
9
13
  """
rpa_suite/core/dir.py CHANGED
@@ -1,7 +1,12 @@
1
+ # rpa_suite/core/dir.py
1
2
 
3
+ # imports internal
4
+ from rpa_suite.functions._printer import error_print, alert_print, success_print
5
+
6
+ # imports third-party
2
7
  import os, shutil
3
8
  from typing import Union
4
- from rpa_suite.functions._printer import error_print, alert_print, success_print
9
+
5
10
 
6
11
 
7
12
  class Directory():
rpa_suite/core/email.py CHANGED
@@ -1,13 +1,15 @@
1
- # /sender_smtp.py
1
+ # rpa_suite/core/email.py
2
2
 
3
- import smtplib, os
3
+ # imports internal
4
+ from rpa_suite.functions._printer import alert_print, error_print, success_print
5
+
6
+ # imports third-party
7
+ import smtplib
4
8
  from email.mime.image import MIMEImage
5
9
  from email.mime.multipart import MIMEMultipart
6
10
  from email.mime.text import MIMEText
7
11
  from email.mime.base import MIMEBase
8
12
  from email import encoders
9
- from rpa_suite.functions._printer import alert_print, error_print, success_print
10
- from rpa_suite.core.validate import email_validator
11
13
 
12
14
 
13
15
  class Email():
rpa_suite/core/file.py CHANGED
@@ -1,10 +1,19 @@
1
- import os, time
2
- from datetime import datetime
1
+ # rpa_suite/core/file.py
2
+
3
+ # imports internal
3
4
  from rpa_suite.functions._printer import error_print, success_print, alert_print
4
5
  from rpa_suite.functions.__create_ss_dir import __create_ss_dir as create_ss_dir
6
+
7
+ # imports external
5
8
  from colorama import Fore
9
+
10
+ # imports third-party
11
+ import os, time
12
+ from datetime import datetime
6
13
  from typing import Dict, List, Union
7
14
 
15
+
16
+
8
17
  class File():
9
18
  """
10
19
  Class that provides utilities for file management, including creation, deletion, and manipulation of files.
rpa_suite/core/log.py CHANGED
@@ -1,6 +1,13 @@
1
- from typing import Optional as Op
1
+ # rpa_suite/core/log.py
2
+
3
+ # imports internal
2
4
  from rpa_suite.functions._printer import error_print, alert_print, success_print
5
+
6
+ # imports external
3
7
  from loguru import logger
8
+
9
+ # imports third-party
10
+ from typing import Optional as Op
4
11
  import sys, os, inspect
5
12
 
6
13
 
@@ -0,0 +1,193 @@
1
+ # rpa_suite/core/parallel.py
2
+
3
+ from multiprocessing import Process, Manager
4
+ from typing import Any, Callable, Dict, Optional, TypeVar, Generic
5
+ import time
6
+ import traceback
7
+
8
+ # Definir tipo genérico para o retorno da função
9
+ T = TypeVar('T')
10
+
11
+ class ParallelRunner(Generic[T]):
12
+
13
+ """
14
+ Classe para executar funções em paralelo mantendo o fluxo principal da aplicação.
15
+
16
+ Permite iniciar uma função em um processo separado e obter seu resultado posteriormente.
17
+ """
18
+
19
+ def __init__(self):
20
+ """Inicializa o ParallelRunner."""
21
+ self._manager = Manager()
22
+ self._result_dict = self._manager.dict()
23
+ self._process = None
24
+ self._start_time = None
25
+
26
+ @staticmethod
27
+ def _execute_function(function, args, kwargs, result_dict):
28
+ """
29
+ Função estática que executa a função alvo e armazena o resultado.
30
+ Esta função precisa ser definida no nível do módulo para ser "picklable".
31
+ """
32
+ try:
33
+ # Executa a função do usuário com os argumentos fornecidos
34
+ result = function(*args, **kwargs)
35
+
36
+ # Armazena o resultado no dicionário compartilhado
37
+ result_dict['status'] = 'success'
38
+ result_dict['result'] = result
39
+
40
+ # Para debug
41
+ print(f"[Processo Filho] Resultado calculado: {result}")
42
+ print(f"[Processo Filho] Dicionário de resultados: {dict(result_dict)}")
43
+
44
+ except Exception as e:
45
+ # Em caso de erro, armazena informações sobre o erro
46
+ result_dict['status'] = 'error'
47
+ result_dict['error'] = str(e)
48
+ result_dict['traceback'] = traceback.format_exc()
49
+
50
+ # Para debug
51
+ print(f"[Processo Filho] Erro ocorrido: {str(e)}")
52
+
53
+ def run(self, function: Callable[..., T], *args, **kwargs) -> 'ParallelRunner[T]':
54
+ """
55
+ Inicia a execução da função em um processo paralelo.
56
+
57
+ Args:
58
+ function: Função a ser executada em paralelo
59
+ *args: Argumentos posicionais para a função
60
+ **kwargs: Argumentos nomeados para a função
61
+
62
+ Returns:
63
+ self: Retorna a própria instância para permitir chamadas encadeadas
64
+ """
65
+ # Limpar resultado anterior, se houver
66
+ if self._result_dict:
67
+ self._result_dict.clear()
68
+
69
+ # Configura valores iniciais no dicionário compartilhado
70
+ self._result_dict['status'] = 'running'
71
+
72
+ # Inicia o processo com a função auxiliar estática
73
+ self._process = Process(
74
+ target=ParallelRunner._execute_function,
75
+ args=(function, args, kwargs, self._result_dict)
76
+ )
77
+ self._process.daemon = True # Processo filho termina quando o principal termina
78
+ self._process.start()
79
+ self._start_time = time.time()
80
+
81
+ return self
82
+
83
+ def is_running(self) -> bool:
84
+ """
85
+ Verifica se o processo ainda está em execução.
86
+
87
+ Returns:
88
+ bool: True se o processo ainda estiver em execução, False caso contrário
89
+ """
90
+ if self._process is None:
91
+ return False
92
+ return self._process.is_alive()
93
+
94
+ def get_result(self, timeout: Optional[float] = None, terminate_on_timeout: bool = True) -> Dict[str, Any]:
95
+ """
96
+ Obtém o resultado da execução paralela.
97
+
98
+ Args:
99
+ timeout: Tempo máximo (em segundos) para aguardar o término do processo
100
+ None significa esperar indefinidamente
101
+ terminate_on_timeout: Se True, termina o processo caso o timeout seja atingido
102
+
103
+ Returns:
104
+ Dict contendo:
105
+ - success: bool indicando se a operação foi bem-sucedida
106
+ - result: resultado da função (se bem-sucedida)
107
+ - error: mensagem de erro (se houver)
108
+ - traceback: stack trace completo (se houver erro)
109
+ - execution_time: tempo de execução em segundos
110
+ - terminated: True se o processo foi terminado por timeout
111
+ """
112
+ if self._process is None:
113
+ return {
114
+ 'success': False,
115
+ 'error': 'Nenhum processo foi iniciado',
116
+ 'execution_time': 0,
117
+ 'terminated': False
118
+ }
119
+
120
+ # Aguarda o processo terminar com tempo limite
121
+ self._process.join(timeout=timeout)
122
+ execution_time = time.time() - self._start_time
123
+
124
+ # Preparamos o dicionário de resposta
125
+ result = {
126
+ 'execution_time': execution_time,
127
+ 'terminated': False
128
+ }
129
+
130
+ # Debug - mostra o dicionário compartilhado
131
+ print(f"[Processo Principal] Dicionário compartilhado: {dict(self._result_dict)}")
132
+
133
+ # Verifica se o processo terminou ou se atingiu o timeout
134
+ if self._process.is_alive():
135
+ if terminate_on_timeout:
136
+ self._process.terminate()
137
+ self._process.join(timeout=1) # Pequeno timeout para garantir que o processo termine
138
+ result['terminated'] = True
139
+ result['success'] = False
140
+ result['error'] = f'Operação cancelada por timeout após {execution_time:.2f} segundos'
141
+ else:
142
+ result['success'] = False
143
+ result['error'] = f'Operação ainda em execução após {execution_time:.2f} segundos'
144
+ else:
145
+ # Processo terminou normalmente - verificamos o status
146
+ status = self._result_dict.get('status', 'unknown')
147
+
148
+ if status == 'success':
149
+ result['success'] = True
150
+ # Garantimos que o resultado está sendo copiado corretamente
151
+ if 'result' in self._result_dict:
152
+ result['result'] = self._result_dict['result']
153
+ else:
154
+ result['success'] = False
155
+ result['error'] = 'Resultado não encontrado no dicionário compartilhado'
156
+ else:
157
+ result['success'] = False
158
+ result['error'] = self._result_dict.get('error', 'Erro desconhecido')
159
+ if 'traceback' in self._result_dict:
160
+ result['traceback'] = self._result_dict['traceback']
161
+
162
+ # Finaliza o Manager se o processo terminou e não estamos mais esperando resultado
163
+ if not self._process.is_alive() and (result.get('success', False) or result.get('terminated', False)):
164
+ self._cleanup()
165
+
166
+ return result
167
+
168
+ def terminate(self) -> None:
169
+ """
170
+ Termina o processo em execução.
171
+ """
172
+ if self._process and self._process.is_alive():
173
+ self._process.terminate()
174
+ self._process.join(timeout=1)
175
+ self._cleanup()
176
+
177
+ def _cleanup(self) -> None:
178
+ """
179
+ Limpa os recursos utilizados pelo processo.
180
+ """
181
+ if hasattr(self, '_manager') and self._manager is not None:
182
+ try:
183
+ self._manager.shutdown()
184
+ except Exception:
185
+ pass
186
+ self._manager = None
187
+ self._process = None
188
+
189
+ def __del__(self):
190
+ """
191
+ Destrutor da classe, garante que recursos sejam liberados.
192
+ """
193
+ self.terminate()
rpa_suite/core/print.py CHANGED
@@ -1,8 +1,9 @@
1
+ # rpa_suite/core/print.py
1
2
 
2
- # /printer.py
3
-
3
+ # imports external
4
4
  from colorama import Fore
5
5
 
6
+
6
7
  # Windows bash colors
7
8
  class Colors():
8
9
  black = f'{Fore.BLACK}'
@@ -17,6 +18,7 @@ class Colors():
17
18
  call_fn = f'{Fore.LIGHTMAGENTA_EX}'
18
19
  retur_fn = f'{Fore.LIGHTYELLOW_EX}'
19
20
 
21
+
20
22
  class Print():
21
23
 
22
24
  """
rpa_suite/core/regex.py CHANGED
@@ -1,7 +1,12 @@
1
+ # rpa_suite/core/regex.py
1
2
 
2
- import re
3
+ # imports internal
3
4
  from rpa_suite.functions._printer import error_print, success_print
4
5
 
6
+ # imports third-party
7
+ import re
8
+
9
+
5
10
  class Regex():
6
11
  """
7
12
  Class that provides utilities for working with regular expressions.
@@ -1,8 +1,11 @@
1
- # /mail_validator.py
1
+ # rpa_suite/core/mail_validator.py
2
2
 
3
- import email_validator
3
+ # imports internal
4
4
  from rpa_suite.functions._printer import error_print, success_print
5
5
 
6
+ # imports external
7
+ import email_validator
8
+
6
9
 
7
10
  class Validate():
8
11
 
@@ -1,8 +1,12 @@
1
- # /_create_ss_dir.py
1
+ # rpa_suite/functions/__create_ss_dir.py
2
2
 
3
+ # imports internal
4
+ from rpa_suite.functions._printer import error_print, alert_print, success_print
5
+
6
+ # imports third-party
3
7
  import os
4
8
  from typing import Union
5
- from rpa_suite.functions._printer import error_print, alert_print, success_print
9
+
6
10
 
7
11
 
8
12
  def __create_ss_dir(path_to_create: str = 'default', name_ss_dir: str='screenshots') -> dict[str, Union[bool, str, None]]:
@@ -1,7 +1,9 @@
1
- # /printer.py
1
+ # rpa_suite/functions/_printer.py
2
2
 
3
+ # imports external
3
4
  from colorama import Fore
4
5
 
6
+
5
7
  # Windows bash colors
6
8
  class Colors():
7
9
  black = f'{Fore.BLACK}'
rpa_suite/suite.py CHANGED
@@ -1,5 +1,6 @@
1
1
  # rpa_suite/suite.py
2
2
 
3
+ # imports internal
3
4
  from .core.clock import Clock
4
5
  from .core.date import Date
5
6
  from .core.email import Email
@@ -9,13 +10,20 @@ from .core.log import Log
9
10
  from .core.print import Print
10
11
  from .core.regex import Regex
11
12
  from .core.validate import Validate
13
+ from .core.parallel import ParallelRunner
12
14
 
15
+
16
+ # imports external
13
17
  from colorama import Fore
18
+ import pkg_resources
14
19
 
20
+ # imports third-party
15
21
  import subprocess
16
22
  import sys
17
23
  import hashlib
18
24
 
25
+
26
+
19
27
  # Windows bash colors
20
28
  class Colors():
21
29
 
@@ -68,6 +76,7 @@ class Colors():
68
76
  call_fn = f'{Fore.LIGHTMAGENTA_EX}'
69
77
  retur_fn = f'{Fore.LIGHTYELLOW_EX}'
70
78
 
79
+
71
80
  class Suite():
72
81
 
73
82
  """
@@ -138,15 +147,29 @@ class Suite():
138
147
  printer: Print = Print()
139
148
  regex: Regex = Regex()
140
149
  validate: Validate = Validate()
141
-
150
+ Parallel: ParallelRunner = ParallelRunner
151
+
152
+ # On this case, we are importing the Browser class only if the selenium and webdriver_manager modules are installed.
153
+ # This is useful to avoid unnecessary imports and dependencies if the user does not need the Browser functionality.
154
+ import importlib.util
155
+
156
+ # from .browser import Browser
157
+ if importlib.util.find_spec("selenium") and importlib.util.find_spec("webdriver_manager"):
158
+ from .core.browser import Browser
159
+ browser: Browser = Browser
142
160
 
143
161
 
144
162
  # VARIABLES INTERNAL
145
- __version__ = '1.4.5'
163
+ try:
164
+ __version__ = pkg_resources.get_distribution("rpa_suite").version
165
+ except Exception:
166
+ __version__ = 'unknown'
167
+
146
168
  __id_hash__ = 'rpa_suite'
147
169
 
148
170
 
149
171
  def __init__(self):
172
+ self.__id_hash__ = 'rpa_suite'
150
173
  self.__id_hash__ = hashlib.sha256(self.__version__.encode()).hexdigest()
151
174
 
152
175
  def success_print(self,
@@ -1,4 +1,5 @@
1
1
  # rpa_suite/utils/__init__.py
2
+
2
3
  """
3
4
  The utils module of the rpa-suite provides a collection of utility functions and classes that facilitate various tasks in process automation. It includes helper methods for logging, file handling, and other common operations that enhance the functionality and usability of the RPA Suite.
4
5
 
rpa_suite/utils/system.py CHANGED
@@ -1,7 +1,14 @@
1
+ # rpa_suite/utils/system.py
2
+
3
+ # imports internal
1
4
  from rpa_suite.functions._printer import error_print, success_print
5
+
6
+ # imports third-party
2
7
  import sys, os
3
8
 
9
+
4
10
  def set_importable_dir(display_message: bool = False):
11
+
5
12
  """
6
13
  Sets the directory to be importable by appending it to the system path.
7
14
 
@@ -25,9 +32,11 @@ def set_importable_dir(display_message: bool = False):
25
32
  ----------
26
33
  Nenhum
27
34
  """
35
+
28
36
  try:
29
37
  sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
30
38
 
31
39
  if display_message: success_print(f'Successfully set the directory for importation!')
40
+
32
41
  except Exception as e:
33
- error_print(f'An error occurred while executing the function: {set_importable_dir.__name__}! Error: {str(e)}.')
42
+ error_print(f'An error occurred while executing the function: {set_importable_dir.__name__}! Error: {str(e)}.')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rpa_suite
3
- Version: 1.4.6
3
+ Version: 1.4.8
4
4
  Summary: Conjunto de ferramentas essenciais para Automação RPA com Python, que facilitam o dia a dia de desenvolvimento.
5
5
  Author: Camilo Costa de Carvalho
6
6
  Author-email: camilo.carvalho@triasoftware.com.br
@@ -26,6 +26,7 @@ Requires-Dist: typing
26
26
  Requires-Dist: pillow
27
27
  Requires-Dist: pyautogui
28
28
  Requires-Dist: requests
29
+ Requires-Dist: setuptools
29
30
  Dynamic: author
30
31
  Dynamic: author-email
31
32
  Dynamic: classifier
@@ -64,7 +65,7 @@ Dynamic: summary
64
65
  - [Dependências](#dependências)
65
66
  - [Estrutura do módulo](#estrutura-do-módulo)
66
67
  - [Release](#release)
67
- - [Notas da atualização: 1.4.6](#notas-da-atualização-146)
68
+ - [Notas da atualização: 1.4.8](#notas-da-atualização-148)
68
69
  - [Mais Sobre](#mais-sobre)
69
70
 
70
71
  ## Destaque
@@ -169,23 +170,29 @@ No caso da função de screenshot é necessario ter as libs 'pyautogui' 'pillow'
169
170
  O módulo principal do rpa-suite é dividido em categorias. Cada categoria contém módulos com funções destinadas a categoria:
170
171
 
171
172
  - **rpa_suite**
173
+
172
174
  - **clock**
173
175
  - **exec_at_hour** - Função que executa uma função no horário especificado "xx:yy", permitindo agendamento de tarefas com precisão.
174
176
  - **wait_for_exec** - Função que aguarda um tempo em segundos antes de executar a função passada como argumento.
175
177
  - **exec_and_wait** - Função que executa uma função e, em seguida, aguarda um tempo em segundos antes de continuar.
178
+
176
179
  - **date**
177
180
  - **get_hms** - Função que retorna hora, minuto e segundo formatados como strings.
178
181
  - **get_dmy** - Função que retorna dia, mês e ano formatados como strings.
182
+
179
183
  - **email**
180
184
  - **send_smtp** - Função para envio de emails via SMTP com suporte a anexos e mensagens HTML, configurável e personalizável.
185
+
181
186
  - **file**
182
187
  - **screen_shot** - Função para capturar screenshots, criando diretórios e arquivos com nomes e caminhos personalizáveis.
183
188
  - **flag_create** - Função para criar arquivos de flag indicando execução de processos.
184
189
  - **flag_delete** - Função para deletar arquivos de flag após a execução de processos.
185
190
  - **count_files** - Função para contar arquivos em diretórios, com suporte a extensões específicas.
191
+
186
192
  - **directory**
187
193
  - **create_temp_dir** - Função para criar diretórios temporários com nomes e caminhos personalizáveis.
188
194
  - **delete_temp_dir** - Função para deletar diretórios temporários, com opção de remover arquivos contidos.
195
+
189
196
  - **log**
190
197
  - **config_logger** - Função para configurar logs com suporte a arquivos e streams, utilizando a biblioteca Loguru.
191
198
  - **log_start_run_debug** - Função para registrar logs de início de execução em nível de depuração.
@@ -194,6 +201,7 @@ O módulo principal do rpa-suite é dividido em categorias. Cada categoria cont
194
201
  - **log_warning** - Função para registrar logs em nível de aviso.
195
202
  - **log_error** - Função para registrar logs em nível de erro.
196
203
  - **log_critical** - Função para registrar logs em nível crítico.
204
+
197
205
  - **printer**
198
206
  - **success_print** - Função para imprimir mensagens de sucesso com destaque em verde.
199
207
  - **alert_print** - Função para imprimir mensagens de alerta com destaque em amarelo.
@@ -201,18 +209,26 @@ O módulo principal do rpa-suite é dividido em categorias. Cada categoria cont
201
209
  - **error_print** - Função para imprimir mensagens de erro com destaque em vermelho.
202
210
  - **regex**
203
211
  - **check_pattern_in_text** - Função para verificar a presença de padrões em textos, com suporte a case-sensitive.
212
+
204
213
  - **validate**
205
214
  - **emails** - Função para validar listas de emails, retornando listas de emails válidos e inválidos.
206
215
  - **word** - Função para buscar palavras ou padrões específicos em textos, com suporte a contagem de ocorrências.
216
+
207
217
  - **browser**
208
218
  - **start_browser** - Função para iniciar o navegador Chrome com suporte a depuração remota.
209
219
  - **find_ele** - Função para localizar elementos na página utilizando estratégias de localização do Selenium.
210
220
  - **get** - Função para navegar para URLs específicas.
211
221
  - **close_browser** - Função para fechar o navegador e encerrar processos relacionados.
212
222
 
223
+ - **parallel**
224
+ - **run** - Função para iniciar um processo em paralelo.
225
+ - **is_running** - Função para capturar o status atual do processo que esta rodando em paralelo.
226
+ - **get_result** - Função para coletar o retorno da execução em paralelo junto com resultado da função ou funções que foram enviadas a este processo com retorno em forma de dict.
227
+ - **terminate** - Função para finalizar o processo paralelo mantendo apenas o processo principal do seu código, também é chamada de forma automatica esta função ao final de um procesos paralelo ou no final da função "get_result".
228
+
213
229
  ## Release
214
230
 
215
- Versão: **Beta 1.4.6**
231
+ Versão: **Beta 1.4.8**
216
232
 
217
233
  Lançamento: *20/02/2024*
218
234
 
@@ -220,10 +236,11 @@ Lançamento: *20/02/2024*
220
236
 
221
237
  Status: Em desenvolvimento.
222
238
 
223
- ### Notas da atualização: 1.4.6
239
+ ### Notas da atualização: 1.4.8
224
240
 
225
241
  - Mudança dos submodulos para Objetos, agora Rpa_suite é um Objeto de Suite que compoe diversos sub-objetos separados pelas mesmas categorias anteriormente ja definidas
226
242
  - Reformulada a arquitetura do projeto para melhor coeção e menos subpastas e arquivos, agora a estrutura é mais simples e de melhor manutenção contendo apenas uma pasta core para o nucleo de nossos modulos, e uma pasta utils com ferramentas utilitarias que vamos adicionar varias novidades
243
+ - Adicionado SubModulo Parallel com função dedicada a rodar um processo em paralelo com seu fluxo principal podendo recuperar o resultado da execução em paralelo a qualquer momento e setando timeout ou deixando o tempo indefinido para aguardar a resposta.
227
244
  - Adicionado setor utils com funcionalidade de tornar o diretorio atual em um importavel relativo para o python
228
245
  - Adicionado Automação de Navegadores! Sim estamos devendo esta feature a bastante tempo, porem estamos com a primeira versão disponivel, em breve teremos mais recursos e disponibilidade para outros navegadores, atualmente suporte apenas para *Chrome.*
229
246
  - Mantemos o alerta! **get_dma** atualizada e **renomeada** para **get_dmy** para manter o padrão em ingles
@@ -0,0 +1,24 @@
1
+ rpa_suite/__init__.py,sha256=KO6GC2XbZUO56SAOgKxIkycHFEy6oeWPSswd8-B5IP4,2562
2
+ rpa_suite/suite.py,sha256=4aKwFsIz4YuDuKD41o2ws5bRkmt11uDblymCarYHHUw,11110
3
+ rpa_suite/core/__init__.py,sha256=27hq1brv83Kf89xtk-VVQx2etUWWBnVoZMgbgKI7Ac0,1678
4
+ rpa_suite/core/browser.py,sha256=XgUoOc6pcFwnSQxSlcOF0x8JjlUmj7gw3OvSJ_EoQns,14757
5
+ rpa_suite/core/clock.py,sha256=-ZEEaTYzwoYk9Bw1K6K1RN4s7O21uEhTg2hgBmdYLtQ,13880
6
+ rpa_suite/core/date.py,sha256=4T8_JKWBcYh4klQBAYx4RrmsKqz7uUb8wD5UtgCueeg,6629
7
+ rpa_suite/core/dir.py,sha256=sc_mJGrjo520cmNyC_HZo3YKEbORkBDfD3bCLaQ7U2o,9855
8
+ rpa_suite/core/email.py,sha256=CUqhW8-BF0XS7vFeZieQ13VywEg1TQZVoicEexSQCPE,8671
9
+ rpa_suite/core/file.py,sha256=9Psho6n9eqfLu3aA3XW43LzXefEJnAgIentFyopOpxQ,11623
10
+ rpa_suite/core/log.py,sha256=7VTPKXzVkWMg1W5bBO6BM3XDihKqNOcB4D-d6ytDbts,5631
11
+ rpa_suite/core/parallel.py,sha256=Pftz5cC-3jJLlprLjjSYadc6A9omBBmziCmeUcvNKh4,7668
12
+ rpa_suite/core/print.py,sha256=jhCNdid67dtVE6cCgRnWjqUrmsJcAr1hN38MHVupgfo,6423
13
+ rpa_suite/core/regex.py,sha256=gh3dlV29chepdoaWsl5yW9Db6MHQTGJeWstm0mD9zKU,3377
14
+ rpa_suite/core/validate.py,sha256=vKpl4u7f8CM30e_1rS6sqUqePy0ga51HHGn1cgent1o,11032
15
+ rpa_suite/functions/__create_ss_dir.py,sha256=FWLglWEYFCZUd_t-Peph1_ktfoH0fskkcfwxgU_pyks,3444
16
+ rpa_suite/functions/__init__.py,sha256=aa0jejVvnghufR50owKcKpmYit7XVAliyN9gn9JkdLE,33
17
+ rpa_suite/functions/_printer.py,sha256=51Xbqr0Ck7HHOrhJCxhMxdCKrF_kQ5AsKZN5SZQPwpk,3991
18
+ rpa_suite/utils/__init__.py,sha256=RQ-m9QNbaByek25moxx9ajpuxjPAEdjoMu69ReLBCWY,675
19
+ rpa_suite/utils/system.py,sha256=fQ9BAWxVETrFUeZJlfhN3cLzToU3XDQYqvDS9W0hWgY,1157
20
+ rpa_suite-1.4.8.dist-info/licenses/LICENSE,sha256=5D8PIbs31iGd9i1_MDNg4SzaQnp9sEIULALh2y3WyMI,1102
21
+ rpa_suite-1.4.8.dist-info/METADATA,sha256=N6Yo_DNSgM__jAR4X1SUULETkDQZRSnG-bcciOxkOXQ,12769
22
+ rpa_suite-1.4.8.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
23
+ rpa_suite-1.4.8.dist-info/top_level.txt,sha256=HYkDtg-kJNAr3F2XAIPyJ-QBbNhk7q6jrqsFt10lz4Y,10
24
+ rpa_suite-1.4.8.dist-info/RECORD,,
@@ -1,83 +0,0 @@
1
- # /_create_log_dir.py
2
-
3
- import os
4
- from typing import Union
5
- from rpa_suite.functions._printer import error_print, alert_print, success_print
6
-
7
-
8
- def _create_log_dir(path_to_create: str = 'default', name_log_dir: str='logs') -> dict[str, Union[bool, str, None]]:
9
-
10
- """
11
- Function responsible for creating a logger directory to work with files ``.log``. \n
12
-
13
- Parameters:
14
- ----------
15
- ``path_to_create: str`` - should be a string with the full path pointing to the folder where the logger folder should be created, if it is empty the ``default`` value will be used which will create a folder in the current directory where the file containing this function was called.
16
-
17
- ``name_log_dir: str`` - should be a string representing the name of the logger directory to be created. If it is empty, the ``temp`` value will be used as the default directory name.
18
-
19
- Return:
20
- ----------
21
- >>> type:dict
22
- * 'success': bool - represents case the action was performed successfully
23
- * 'path_created': str - path of the directory that was created on the process
24
-
25
- Description: pt-br
26
- ----------
27
- Função responsavel por criar diretório de logger para trabalhar com arquivos de log. \n
28
-
29
- Parametros:
30
- ----------
31
- ``path_to_create: str`` - deve ser uma string com o path completo apontando para a pasta onde deve ser criada a pasta temporaria, se estiver vazio sera usado valor ``default`` que criará pasta no diretório atual onde o arquivo contendo esta função foi chamada.
32
-
33
- ``name_log_dir: str`` - deve ser uma string representando o nome do diretório de logger a ser criado. Se estiver vazio, o valor ``temp`` será usado como o nome padrão do diretório.
34
-
35
- Retorno:
36
- ----------
37
- >>> type:dict
38
- * 'success': bool - representa se ação foi realizada com sucesso
39
- * 'path_created': str - path do diretório que foi criado no processo
40
- """
41
-
42
- # Local Variables
43
- result: dict = {
44
- 'success': bool,
45
- 'path_created': str,
46
- }
47
-
48
- try:
49
- # by 'default', defines path to local script execution path
50
- if path_to_create == 'default':
51
- path_to_create: str = os.getcwd()
52
-
53
- # Build path to new dir
54
- full_path: str = os.path.join(path_to_create, name_log_dir)
55
-
56
- # Create dir in this block
57
- try:
58
-
59
- # Successefully created
60
- os.makedirs(full_path, exist_ok=False)
61
-
62
- result['success'] = True
63
- result['path_created'] = fr'{full_path}'
64
-
65
- success_print(f"Diretório:'{full_path}' foi criado com sucesso.")
66
-
67
- except FileExistsError:
68
- result['success'] = False
69
- result['path_created'] = full_path
70
- # alert_print(f"Diretório:'{full_path}' já existe.")
71
-
72
- except PermissionError:
73
- result['success'] = False
74
- result['path_created'] = None
75
- alert_print(f"Permissão negada: não é possível criar o diretório '{full_path}'.")
76
-
77
- except Exception as e:
78
- result['success'] = False
79
- result['path_created'] = None
80
- error_print(f'Error capturing current path to create logger directory! Error: {str(e)}')
81
-
82
- finally:
83
- return result
@@ -1,96 +0,0 @@
1
- # /_functions_logger.py
2
-
3
- import logging
4
- from ._logger import file_handler
5
- from rpa_suite.functions._printer import error_print, success_print
6
-
7
-
8
- def log_start_run_debug(msg_start_loggin: str) -> None: # represent start application
9
-
10
- """
11
- Function responsable to generate ``start run log level debug``, in file and print on terminal the same log captured on this call.
12
- """
13
-
14
- try:
15
- global file_handler
16
- file_handler.stream.write(f'\n{msg_start_loggin}\n')
17
- success_print(f'{msg_start_loggin}')
18
-
19
- except Exception as e:
20
- error_print(f'Erro durante a função: {log_start_run_debug.__name__}! Error: {str(e)}')
21
-
22
-
23
- def log_debug(msg) -> None:
24
-
25
- """
26
- Function responsable to generate log level ``debug``, in file and print on terminal the same log captured on this call.
27
- """
28
-
29
- try:
30
- logging.debug(msg)
31
-
32
- except Exception as e:
33
- error_print(f'Erro durante a função: {log_debug.__name__}! Error: {str(e)}')
34
-
35
- def log_info(msg) -> None:
36
-
37
- """
38
- Function responsable to generate log level ``info``, in file and print on terminal the same log captured on this call.
39
- """
40
-
41
- try:
42
- logging.info(msg)
43
-
44
- except Exception as e:
45
- error_print(f'Erro durante a função: {log_debug.__name__}! Error: {str(e)}')
46
-
47
- def log_info(msg) -> None:
48
-
49
- """
50
- Function responsable to generate log level ``info``, in file and print on terminal the same log captured on this call.
51
- """
52
-
53
- try:
54
- logging.info(msg)
55
-
56
- except Exception as e:
57
- error_print(f'Erro durante a função: {log_info.__name__}! Error: {str(e)}')
58
-
59
-
60
- def log_warning(msg) -> None:
61
-
62
- """
63
- Function responsable to generate log level ``warning``, in file and print on terminal the same log captured on this call.
64
- """
65
-
66
- try:
67
- logging.warning(msg)
68
-
69
- except Exception as e:
70
- error_print(f'Erro durante a função: {log_warning.__name__}! Error: {str(e)}')
71
-
72
-
73
- def log_error(msg) -> None:
74
-
75
- """
76
- Function responsable to generate log level ``error``, in file and print on terminal the same log captured on this call.
77
- """
78
-
79
- try:
80
- logging.error(msg)
81
-
82
- except Exception as e:
83
- error_print(f'Erro durante a função: {log_error.__name__}! Error: {str(e)}')
84
-
85
-
86
- def log_critical(msg) -> None:
87
-
88
- """
89
- Function responsable to generate log level ``critical``, in file and print on terminal the same log captured on this call.
90
- """
91
-
92
- try:
93
- logging.critical(msg)
94
-
95
- except Exception as e:
96
- error_print(f'Erro durante a função: {log_critical.__name__}! Error: {str(e)}')
@@ -1,113 +0,0 @@
1
- # /_logger.py
2
-
3
- import logging
4
- from logging import DEBUG
5
- from logging import FileHandler, StreamHandler, Filter
6
- from colorlog import ColoredFormatter
7
- from typing import Optional as Op
8
- from ._variables import file_handler, stream_handler
9
- from .__create_log_dir import _create_log_dir
10
- from rpa_suite.functions._printer import error_print
11
-
12
-
13
- class Filters(Filter):
14
-
15
- word_filter: Op[list[str]]
16
-
17
- def filter(self, record):
18
-
19
- if len(self.word_filter) > 0:
20
-
21
- for words in self.word_filter:
22
-
23
-
24
- string_words: list[str] = [str(word) for word in words]
25
- """print(words)
26
- print(type(words))
27
- print(string_words)
28
- print(type(string_words))
29
- input()"""
30
- for word in string_words:
31
- if word in record.msg:
32
- record.msg = 'Log Alterado devido a palavra Filtrada!'
33
- return True
34
-
35
- return True
36
-
37
-
38
- def config_logger(name_app:str = 'Logger', path_dir:str = None, name_log_dir:str = None, name_file_log: str = 'log', use_default_path_and_name: bool = True, filter_words: list[str] = None) -> Op[FileHandler]:
39
-
40
- """
41
- Function responsible for create a object logger with fileHandler and streamHandler
42
- """
43
-
44
- global file_handler, stream_handler
45
-
46
- try:
47
-
48
-
49
- if not use_default_path_and_name:
50
- result_tryed: dict = _create_log_dir(path_dir, name_log_dir)
51
- path_dir = result_tryed['path_created']
52
- else:
53
- if path_dir == None and name_log_dir == None:
54
- result_tryed: dict = _create_log_dir()
55
- path_dir = result_tryed['path_created']
56
-
57
-
58
- # configuração de objetos logger
59
- file_handler = FileHandler(
60
- filename=fr'{path_dir}\{name_file_log}.log',
61
- mode='a',
62
- encoding='utf-8'
63
- )
64
- stream_handler = StreamHandler()
65
-
66
- # Crie um formatador
67
- formatter = ColoredFormatter(
68
- "%(log_color)s%(levelname)s ->%(reset)s %(log_color)s%(message)s%(reset)s",
69
- datefmt=None,
70
- reset=True,
71
- log_colors={
72
- 'DEBUG': 'cyan',
73
- 'INFO': 'green',
74
- 'WARNING': 'yellow',
75
- 'ERROR': 'red',
76
- 'CRITICAL': 'red',
77
- },
78
- force_color=True
79
- )
80
- stream_handler.setFormatter(formatter)
81
-
82
- # ATRIBUIÇÕES
83
- new_filter: Op[Filters] = None
84
- if filter_words is not None:
85
- new_filter: Filters = Filters()
86
- new_filter.word_filter = [filter_words]
87
-
88
- if new_filter is not None:
89
- file_handler.addFilter(new_filter)
90
-
91
- file_handler.setLevel(DEBUG)
92
-
93
- # Obtenha o logger
94
- logger = logging.getLogger(__name__)
95
-
96
- # Adicione o manipulador de stream ao logger
97
- logger.addHandler(stream_handler)
98
-
99
- # terminando de inplementar configuração para o logger
100
- FORMAT = '%(levelname)s!%(asctime)s: %(message)s'
101
- logging.basicConfig(
102
- level=DEBUG, # level from stream_handler
103
- #format='%(levelname)s - %(asctime)s - %(message)s',
104
- format=FORMAT,
105
- handlers=[file_handler, stream_handler],
106
- datefmt='%d.%m.%y %H:%M',
107
- )
108
- return file_handler
109
-
110
- except Exception as e:
111
-
112
- error_print(f'Houve um erro durante a execução da função: {config_logger.__name__}! Error: {str(e)}.')
113
- return None
@@ -1,10 +0,0 @@
1
- # /_variables.py
2
-
3
- from logging import FileHandler, StreamHandler
4
- from typing import Optional
5
-
6
- # Variável global para o manipulador de arquivo
7
- file_handler: Optional[FileHandler] = None
8
-
9
- # Variável global para o manipulador de stream stdout/stdin/buffer
10
- stream_handler: Optional[StreamHandler] = None
@@ -1,11 +0,0 @@
1
- # /_variables_uru.py
2
-
3
- from loguru import logger
4
- from typing import Optional
5
- from typing import Any
6
-
7
- # Variável global para o manipulador de arquivo
8
- file_handler: Optional[str] = None
9
-
10
- # Variável global para o manipulador de stream stdout/stdin/buffer
11
- stream_handler: Optional[Any] = logger
@@ -1,28 +0,0 @@
1
- rpa_suite/__init__.py,sha256=A6Y1CmdmN9ADAgmvhS8FNXmLNP5fQuyUuZBTm9AKdQo,2494
2
- rpa_suite/suite.py,sha256=pCbceWTf9WM_xt0GSf_k7Xnk4w_qHKS1hLscYqV5Ga0,10280
3
- rpa_suite/core/__init__.py,sha256=TJ-WlsgWTVQ-jc-n66K5ZrqJJeHfI27jXytQVcVHN3M,1640
4
- rpa_suite/core/browser.py,sha256=E-yD2LgwaDVOwUBs09BBXQVx5tLZ7DMFee8LYvgLClY,14682
5
- rpa_suite/core/clock.py,sha256=1QnlOLs9YCRIq-tMFfk9OgaoicKtCL9sBzJmJmz9m_w,13808
6
- rpa_suite/core/date.py,sha256=PBU999Acxiwoep029ElqKSzK6T4DrF3eIP-LB_J-BbM,6568
7
- rpa_suite/core/dir.py,sha256=y6YDyRYQdf9Bj0z3Gs6ugNZ0tKWYgWdDI5R5BjjRIEY,9783
8
- rpa_suite/core/email.py,sha256=kQJAc6Nb9y7jo-oBAo8X1EZS2y-_gTJRoRc9ylS04CE,8675
9
- rpa_suite/core/file.py,sha256=rgvXqq_uV3D5wsioL4kTy0cbKv0bNO35alSVup6veHk,11524
10
- rpa_suite/core/log.py,sha256=xCAoXLxnG2bVzXIafULvW45I4-ljo296E4auU1CppYY,5537
11
- rpa_suite/core/print.py,sha256=tLHIKo6LDTrV91gWKvwlTrxb1idgx3EV_fIRkqtzWBM,6389
12
- rpa_suite/core/regex.py,sha256=wsTxe8-baKul2Fv1-fycXZ-DVa5krhkc9qMkP04giGs,3303
13
- rpa_suite/core/validate.py,sha256=0HnCUgT19LPBMhKxIV_hOAoixpqM7TAL9EkC0S56DFc,10976
14
- rpa_suite/functions/__create_log_dir.py,sha256=-NjH3Mwv8Aa0EgZiD_TcdlSKbsoYl5EoYmPclFwjTKY,3325
15
- rpa_suite/functions/__create_ss_dir.py,sha256=WMuDDTxM5xWudQjftC7xPr6y3IdiXjVK-GfxkQNIo4c,3377
16
- rpa_suite/functions/__init__.py,sha256=aa0jejVvnghufR50owKcKpmYit7XVAliyN9gn9JkdLE,33
17
- rpa_suite/functions/_functions_logger.py,sha256=hlYDEUsmmfwaPlY_YQeNQEFeT_mryHBqgBVyRdxge48,2703
18
- rpa_suite/functions/_logger.py,sha256=gTYO9JlbX5_jDfu_4FTTajJw3_GotE2BHUbDDB1Hf5g,3643
19
- rpa_suite/functions/_printer.py,sha256=r72zeobAi2baVbYgbfFH0h5-WMv4tSDGPNlcpZen7O0,3949
20
- rpa_suite/functions/_variables.py,sha256=vCcktifFUriBQTyUaayZW8BlE8Gr7VP-tFbfomKOS5U,312
21
- rpa_suite/functions/_variables_uru.py,sha256=xRqYp49l1fFNrHczOmJ6Pqw1PKIWs0f9kxlgvuYGYys,303
22
- rpa_suite/utils/__init__.py,sha256=f0qiYRZ7VzBarp1yNj91V0UMZG9QY2mgDXEbWvNZDYs,673
23
- rpa_suite/utils/system.py,sha256=JIONQutSbNBkQIATcN1wC0NUE4ILlgVZ-TOnuoMPxHI,1055
24
- rpa_suite-1.4.6.dist-info/licenses/LICENSE,sha256=5D8PIbs31iGd9i1_MDNg4SzaQnp9sEIULALh2y3WyMI,1102
25
- rpa_suite-1.4.6.dist-info/METADATA,sha256=N-wf425WMZNyO6PcTVXcHboPh97H4dZNaAgjfijqplI,11828
26
- rpa_suite-1.4.6.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
27
- rpa_suite-1.4.6.dist-info/top_level.txt,sha256=HYkDtg-kJNAr3F2XAIPyJ-QBbNhk7q6jrqsFt10lz4Y,10
28
- rpa_suite-1.4.6.dist-info/RECORD,,