rpa-suite 1.6.2__py3-none-any.whl → 1.6.3__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/core/print.py CHANGED
@@ -3,9 +3,14 @@
3
3
  # imports third party
4
4
  from colorama import Fore
5
5
 
6
+ class PrintError(Exception):
7
+ """Custom exception for Print errors."""
8
+ def __init__(self, message):
9
+ super().__init__(f'Print Error: {message}')
6
10
 
7
11
  # Windows bash colors
8
12
  class Colors:
13
+ """Color constants for console output formatting."""
9
14
  black = f"{Fore.BLACK}"
10
15
  blue = f"{Fore.BLUE}"
11
16
  green = f"{Fore.GREEN}"
@@ -26,7 +31,9 @@ class Print:
26
31
  This class offers functionalities for:
27
32
  - Printing success messages in green
28
33
  - Printing alert messages in yellow
29
- - Additional printing methods can be added for other message types
34
+ - Printing information messages in cyan
35
+ - Printing error messages in red
36
+ - Additional printing methods for other message types
30
37
 
31
38
  The Print class is part of the RPA Suite and can be used to enhance the visibility of console outputs.
32
39
 
@@ -34,164 +41,180 @@ class Print:
34
41
  ----------
35
42
  >>> from rpa_suite import rpa
36
43
  >>> rpa.alert_print('Hello World')
37
-
38
- pt-br
39
- ----
40
-
41
- Classe que fornece métodos para impressão formatada no console, permitindo que diferentes tipos de mensagens sejam exibidas com cores específicas.
42
-
43
- Esta classe oferece funcionalidades para:
44
- - Imprimir mensagens de sucesso em verde
45
- - Imprimir mensagens de alerta em amarelo
46
- - Métodos de impressão adicionais podem ser adicionados para outros tipos de mensagens
47
-
48
- A classe Print é parte do RPA Suite e pode ser usada para aumentar a visibilidade das saídas do console.
49
-
50
- Exemplo de uso:
51
- ----------
52
- >>> from rpa_suite import rpa
53
- >>> rpa.alert_print('Hello World')
54
44
  """
55
45
 
56
46
  colors: Colors = Colors
57
47
 
58
- def __init__(self): ...
48
+ def __init__(self) -> None:
49
+ """Initialize the Print class."""
50
+ pass
59
51
 
60
52
  def success_print(self, string_text: str, color=Colors.green, ending="\n") -> None:
61
53
  """
62
- Print that indicates ``SUCCESS``. Customized with the color Green \n
54
+ Print that indicates SUCCESS. Customized with the color Green.
63
55
 
64
- Return:
65
- ----------
66
- >>> type:None
56
+ Parameters:
57
+ -----------
58
+ ``string_text: str``
59
+ The text to be printed.
60
+
61
+ ``color``
62
+ The color to use for printing. Default is green.
63
+
64
+ ``ending: str``
65
+ The string appended after the text. Default is newline.
67
66
 
68
- pt-br
69
- ----------
70
- Print que indica ``SUCESSO``. Personalizado com a cor Verde \n
71
-
72
- Retorno:
67
+ Return:
73
68
  ----------
74
- >>> type:None
69
+ >>> type: None
75
70
  """
76
71
  print(f"{color}{string_text}{Colors.default}", end=ending)
77
72
 
78
73
  def alert_print(self, string_text: str, color=Colors.yellow, ending="\n") -> None:
79
74
  """
80
- Print that indicates ``ALERT``. Customized with the color Yellow \n
75
+ Print that indicates ALERT. Customized with the color Yellow.
81
76
 
82
- Return:
83
- ----------
84
- >>> type:None
77
+ Parameters:
78
+ -----------
79
+ ``string_text: str``
80
+ The text to be printed.
81
+
82
+ ``color``
83
+ The color to use for printing. Default is yellow.
84
+
85
+ ``ending: str``
86
+ The string appended after the text. Default is newline.
85
87
 
86
- pt-br
87
- ----------
88
- Print que indica ``ALERTA``. Personalizado com a cor Amarelo \n
89
- Retorno:
88
+ Return:
90
89
  ----------
91
- >>> type:None
90
+ >>> type: None
92
91
  """
93
92
  print(f"{color}{string_text}{Colors.default}", end=ending)
94
93
 
95
94
  def info_print(self, string_text: str, color=Colors.cyan, ending="\n") -> None:
96
95
  """
97
- Print that indicates ``INFORMATION``. Customized with the color Cyan \n
96
+ Print that indicates INFORMATION. Customized with the color Cyan.
98
97
 
99
- Return:
100
- ----------
101
- >>> type:None
98
+ Parameters:
99
+ -----------
100
+ ``string_text: str``
101
+ The text to be printed.
102
+
103
+ ``color``
104
+ The color to use for printing. Default is cyan.
105
+
106
+ ``ending: str``
107
+ The string appended after the text. Default is newline.
102
108
 
103
- pt-br
104
- ----------
105
- Print que indica ``INFORMATIVO``. Personalizado com a cor Ciano \n
106
- Retorno:
109
+ Return:
107
110
  ----------
108
- >>> type:None
111
+ >>> type: None
109
112
  """
110
113
  print(f"{color}{string_text}{Colors.default}", end=ending)
111
114
 
112
115
  def error_print(self, string_text: str, color=Colors.red, ending="\n") -> None:
113
116
  """
114
- Print that indicates ``ERROR``. Customized with the color Red \n
117
+ Print that indicates ERROR. Customized with the color Red.
115
118
 
116
- Return:
117
- ----------
118
- >>> type:None
119
+ Parameters:
120
+ -----------
121
+ ``string_text: str``
122
+ The text to be printed.
123
+
124
+ ``color``
125
+ The color to use for printing. Default is red.
126
+
127
+ ``ending: str``
128
+ The string appended after the text. Default is newline.
119
129
 
120
- pt-br
121
- ----------
122
- Print que indica ``ERRO``. Personalizado com a cor Vermelho \n
123
- Retorno:
130
+ Return:
124
131
  ----------
125
- >>> type:None
132
+ >>> type: None
126
133
  """
127
134
  print(f"{color}{string_text}{Colors.default}", end=ending)
128
135
 
129
136
  def magenta_print(self, string_text: str, color=Colors.magenta, ending="\n") -> None:
130
137
  """
131
- Print customized with the color Magenta \n
138
+ Print customized with the color Magenta.
132
139
 
133
- Return:
134
- ----------
135
- >>> type:None
140
+ Parameters:
141
+ -----------
142
+ ``string_text: str``
143
+ The text to be printed.
144
+
145
+ ``color``
146
+ The color to use for printing. Default is magenta.
147
+
148
+ ``ending: str``
149
+ The string appended after the text. Default is newline.
136
150
 
137
- pt-br
138
- ----------
139
- Print personalizado com a cor Magenta \n
140
- Retorno:
151
+ Return:
141
152
  ----------
142
- >>> type:None
153
+ >>> type: None
143
154
  """
144
155
  print(f"{color}{string_text}{Colors.default}", end=ending)
145
156
 
146
157
  def blue_print(self, string_text: str, color=Colors.blue, ending="\n") -> None:
147
158
  """
148
- Print customized with the color Blue \n
159
+ Print customized with the color Blue.
149
160
 
150
- Return:
151
- ----------
152
- >>> type:None
161
+ Parameters:
162
+ -----------
163
+ ``string_text: str``
164
+ The text to be printed.
165
+
166
+ ``color``
167
+ The color to use for printing. Default is blue.
168
+
169
+ ``ending: str``
170
+ The string appended after the text. Default is newline.
153
171
 
154
- pt-br
155
- ----------
156
- Print personalizado com a cor Azul \n
157
- Retorno:
172
+ Return:
158
173
  ----------
159
- >>> type:None
174
+ >>> type: None
160
175
  """
161
176
  print(f"{color}{string_text}{Colors.default}", end=ending)
162
177
 
163
178
  def print_call_fn(self, string_text: str, color=Colors.call_fn, ending="\n") -> None:
164
179
  """
165
- Print customized for function called (log) \n
166
- Color: Magenta Light
167
- Return:
168
- ----------
169
- >>> type:None
180
+ Print customized for function called (log).
181
+ Color: Light Magenta
170
182
 
171
- pt-br
172
- ----------
173
- Print personalizado para log de chamada de função. \n
174
- Cor: Magenta Light
175
- Retorno:
183
+ Parameters:
184
+ -----------
185
+ ``string_text: str``
186
+ The text to be printed.
187
+
188
+ ``color``
189
+ The color to use for printing. Default is light magenta.
190
+
191
+ ``ending: str``
192
+ The string appended after the text. Default is newline.
193
+
194
+ Return:
176
195
  ----------
177
- >>> type:None
196
+ >>> type: None
178
197
  """
179
198
  print(f"{color}{string_text}{Colors.default}", end=ending)
180
199
 
181
200
  def print_retur_fn(self, string_text: str, color=Colors.retur_fn, ending="\n") -> None:
182
201
  """
183
- Print customized for function return (log) \n
184
- Color: Yellow Light
185
- Return:
186
- ----------
187
- >>> type:None
202
+ Print customized for function return (log).
203
+ Color: Light Yellow
188
204
 
189
- pt-br
190
- ----------
191
- Print personalizado para log de chamada de função. \n
192
- Cor: Yellow Light
193
- Retorno:
205
+ Parameters:
206
+ -----------
207
+ ``string_text: str``
208
+ The text to be printed.
209
+
210
+ ``color``
211
+ The color to use for printing. Default is light yellow.
212
+
213
+ ``ending: str``
214
+ The string appended after the text. Default is newline.
215
+
216
+ Return:
194
217
  ----------
195
- >>> type:None
218
+ >>> type: None
196
219
  """
197
220
  print(f"{color}{string_text}{Colors.default}", end=ending)
rpa_suite/core/regex.py CHANGED
@@ -4,8 +4,12 @@
4
4
  import re
5
5
 
6
6
  # imports internal
7
- from rpa_suite.functions._printer import error_print, success_print
7
+ from rpa_suite.functions._printer import success_print
8
8
 
9
+ class RegexError(Exception):
10
+ """Custom exception for Regex errors."""
11
+ def __init__(self, message):
12
+ super().__init__(f'Regex Error: {message}')
9
13
 
10
14
  class Regex:
11
15
  """
@@ -16,19 +20,11 @@ class Regex:
16
20
  - Validating strings against specific patterns
17
21
 
18
22
  The Regex class is part of the RPA Suite and can be used to enhance text processing capabilities.
19
-
20
- pt-br
21
- ----------
22
- Classe que fornece utilitários para trabalhar com expressões regulares.
23
-
24
- Esta classe oferece funcionalidades para:
25
- - Buscar padrões em texto
26
- - Validar strings contra padrões específicos
27
-
28
- A classe Regex é parte do RPA Suite e pode ser usada para aprimorar as capacidades de processamento de texto.
29
23
  """
30
24
 
31
- def __init__(self): ...
25
+ def __init__(self) -> None:
26
+ """Initialize the Regex class."""
27
+ pass
32
28
 
33
29
  def check_pattern_in_text(
34
30
  self,
@@ -38,19 +34,25 @@ class Regex:
38
34
  display_message: bool = False,
39
35
  ) -> bool:
40
36
  """
41
- Function responsible for searching in a string ``origin_text`` a pattern ``pattern_to_search`` and returning True if the pattern is found, otherwise False. ``case_sensitive`` used for exact cases or cases with diferencce upper and lower cases
37
+ Function responsible for searching for a pattern in a text string and returning True if the pattern is found, otherwise False.
42
38
 
43
- Return:
44
- ----------
45
- A boolean indicating whether the pattern was found in the text.
39
+ Parameters:
40
+ -----------
41
+ ``origin_text: str``
42
+ The text where the search should be performed.
46
43
 
47
- Description: pt-br
48
- ----------
49
- Função responsável por buscar em um texto de leitura humana uma string ``origin_text`` por um padrão ``pattern_to_search`` e retornar True se o padrão for encontrado, caso contrário, False. ``case_sensitive`` usado para casos exatos ou casos com diferença entre caixa alta e baixa nos caracteres.
44
+ ``pattern_to_search: str``
45
+ The regex pattern to search for in the text.
46
+
47
+ ``case_sensitive: bool``
48
+ Whether the search should be case sensitive. Default is True.
49
+
50
+ ``display_message: bool``
51
+ Whether to display success/failure messages. Default is False.
50
52
 
51
- Retorno:
53
+ Return:
52
54
  ----------
53
- Um booleano indicando se o padrão foi encontrado no texto.
55
+ A boolean indicating whether the pattern was found in the text.
54
56
  """
55
57
 
56
58
  try:
@@ -85,8 +87,6 @@ class Regex:
85
87
  return False
86
88
 
87
89
  except Exception as e:
88
-
89
- error_print(
90
- f"Error function: {self.check_pattern_in_text.__name__} when trying to check pattern in text. Error: {str(e)}"
91
- )
92
- return False
90
+ RegexError(
91
+ f"Error in function: {self.check_pattern_in_text.__name__} when trying to check pattern in text. Error: {str(e)}"
92
+ ) from e
@@ -4,8 +4,12 @@
4
4
  import email_validator
5
5
 
6
6
  # imports internal
7
- from rpa_suite.functions._printer import error_print, success_print
7
+ from rpa_suite.functions._printer import success_print
8
8
 
9
+ class ValidateError(Exception):
10
+ """Custom exception for Validate errors."""
11
+ def __init__(self, message):
12
+ super().__init__(f'Validate Error: {message}')
9
13
 
10
14
  class Validate:
11
15
  """
@@ -17,24 +21,15 @@ class Validate:
17
21
  - Return a dictionary with information about the validity of the emails, including lists of valid and invalid emails, as well as counts for each category.
18
22
 
19
23
  The class uses the email_validator library to perform rigorous validation of email addresses, ensuring that the provided data is correct and ready for use in applications that require email communication. Additionally, it provides methods for searching words in text, enhancing its utility for text processing.
20
-
21
- pt-br
22
- ----
23
- Classe responsável pela validação de endereços de e-mail e pela busca de palavras dentro de textos.
24
-
25
- Esta classe oferece funcionalidades para:
26
- - Validar uma lista de e-mails, verificando se cada um deles está em conformidade com os padrões de formatação de e-mail.
27
- - Buscar palavras ou padrões específicos dentro de um texto fornecido, fornecendo informações sobre suas ocorrências.
28
- - Retornar um dicionário com informações sobre a validade dos e-mails, incluindo listas de e-mails válidos e inválidos, bem como contagens de cada categoria.
29
-
30
- A classe utiliza a biblioteca email_validator para realizar a validação rigorosa dos endereços de e-mail, garantindo que os dados fornecidos estejam corretos e prontos para uso em aplicações que requerem comunicação via e-mail. Além disso, fornece métodos para busca de palavras em textos, aumentando sua utilidade para o processamento de texto.
31
24
  """
32
25
 
33
- def __init__(self): ...
26
+ def __init__(self) -> None:
27
+ """Initialize the Validate class."""
28
+ pass
34
29
 
35
30
  def emails(self, email_list: list[str], display_message: bool = False) -> dict:
36
31
  """
37
- Function responsible for rigorously validating a list of emails using the email_validator library. \n
32
+ Function responsible for rigorously validating a list of emails using the email_validator library.
38
33
 
39
34
  Parameters:
40
35
  ------------
@@ -50,25 +45,6 @@ class Validate:
50
45
  * 'qt_valids': int - number of valid emails
51
46
  * 'qt_invalids': int - number of invalid emails
52
47
  * 'map_validation' - map of the validation of each email
53
-
54
- Description: pt-br
55
- ----------
56
- Função responsavel por validar de forma rigorosa lista de emails usando a biblioteca email_validator. \n
57
-
58
- Paramentros:
59
- ------------
60
- ``email_list: list`` uma lista de strings contendo os emails a serem validados
61
-
62
- Retorno:
63
- ------------
64
- >>> type: dict
65
- Retorna um dicionário com os respectivos dados:
66
- * 'success': bool - representa se a lista é 100% valida
67
- * 'valid_emails': list - lista de emails validos
68
- * 'invalid_emails': list - lista de emails invalidos
69
- * 'qt_valids': int - quantidade de emails validos
70
- * 'qt_invalids': int - quantidade de emails invalidos
71
- * 'map_validation' - mapa da validação de cada email
72
48
  """
73
49
 
74
50
  # Local Variables
@@ -101,7 +77,7 @@ class Validate:
101
77
  success_print(f"Function: {self.emails.__name__} executed.")
102
78
 
103
79
  except Exception as e:
104
- error_print(f"Error when trying to validate email list: {str(e)}")
80
+ raise ValidateError(f"Error when trying to validate email list: {str(e)}") from e
105
81
 
106
82
  # Postprocessing
107
83
  result = {
@@ -124,19 +100,17 @@ class Validate:
124
100
  display_message: bool = False,
125
101
  ) -> dict:
126
102
  """
127
- Function responsible for searching for a string, substring or word within a provided text. \n
103
+ Function responsible for searching for a string, substring or word within a provided text.
128
104
 
129
105
  Parameters:
130
106
  -----------
131
- ``origin_text: str`` \n
107
+ ``origin_text: str``
108
+ It is the text where the search should be made, in string format.
132
109
 
133
- * It is the text where the search should be made, in string format. \n
134
-
135
- ``search_by: str`` accepts the values: \n
136
-
137
- * 'string' - can find a requested writing excerpt. (default) \n
138
- * 'word' - finds only the word written out exclusively. \n
139
- * 'regex' - find regex patterns, [ UNDER DEVELOPMENT ...] \n
110
+ ``search_by: str`` accepts the values:
111
+ * 'string' - can find a requested writing excerpt. (default)
112
+ * 'word' - finds only the word written out exclusively.
113
+ * 'regex' - find regex patterns, [ UNDER DEVELOPMENT ...]
140
114
 
141
115
  Return:
142
116
  -----------
@@ -151,36 +125,6 @@ class Validate:
151
125
  -----------
152
126
  >>> type: list[set(int, int), ...]
153
127
  * at `index = 0` we find the first occurrence of the text, and the occurrence is composed of a PAIR of numbers in a set, the other indexes represent other positions where occurrences were found if any.
154
-
155
- Description: pt-br
156
- ----------
157
- Função responsavel por fazer busca de uma string, sbustring ou palavra dentro de um texto fornecido. \n
158
-
159
- Parametros:
160
- -----------
161
- ``origin_text: str`` \n
162
-
163
- * É o texto onde deve ser feita a busca, no formato string. \n
164
-
165
- ``search_by: str`` aceita os valores: \n
166
-
167
- * 'string' - consegue encontrar um trecho de escrita solicitado. (default) \n
168
- * 'word' - encontra apenas a palavra escrita por extenso exclusivamente. \n
169
- * 'regex' - encontrar padrões de regex, [ EM DESENVOLVIMENTO ...] \n
170
-
171
- Retorno:
172
- -----------
173
- >>> type:dict
174
- um dicionário com todas informações que podem ser necessarias sobre a validação.
175
- Sendo respectivamente:
176
- * 'is_found': bool - se o pattern foi encontrado em pelo menos um caso
177
- * 'number_occurrences': int - representa o número de vezes que esse pattern foi econtrado
178
- * 'positions': list[set(int, int), ...] - representa todas posições onde apareceu o pattern no texto original
179
-
180
- Sobre o `Positions`:
181
- -----------
182
- >>> type: list[set(int, int), ...]
183
- * no `index = 0` encontramos a primeira ocorrência do texto, e a ocorrência é composta por um PAR de números em um set, os demais indexes representam outras posições onde foram encontradas ocorrências caso hajam.
184
128
  """
185
129
 
186
130
  # Local Variables
@@ -204,7 +148,7 @@ class Validate:
204
148
  result["is_found"] = result["number_occurrences"] > 0
205
149
 
206
150
  except Exception as e:
207
- return error_print(f"Unable to complete the search: {searched_word}. Error: {str(e)}")
151
+ return ValidateError(f"Unable to complete the search: {searched_word}. Error: {str(e)}")
208
152
 
209
153
  elif search_by == "string":
210
154
  try:
@@ -218,10 +162,10 @@ class Validate:
218
162
  result["is_found"] = result["number_occurrences"] > 0
219
163
 
220
164
  except Exception as e:
221
- return error_print(f"Unable to complete the search: {searched_word}. Error: {str(e)}")
165
+ return ValidateError(f"Unable to complete the search: {searched_word}. Error: {str(e)}")
222
166
 
223
167
  except Exception as e:
224
- return error_print(f"Unable to search for: {searched_word}. Error: {str(e)}")
168
+ raise ValidateError(f"Unable to search for: {searched_word}. Error: {str(e)}") from e
225
169
 
226
170
  # Postprocessing
227
171
  if result["is_found"]:
@@ -1,3 +1,3 @@
1
1
  # rpa_suite/functions/__init__.py
2
2
 
3
- __version__ = "1.6.1"
3
+ __version__ = "1.6.2"
rpa_suite/suite.py CHANGED
@@ -22,6 +22,10 @@ import subprocess
22
22
  import sys
23
23
  import hashlib
24
24
 
25
+ class SuiteError(Exception):
26
+ """Custom exception for Suite errors."""
27
+ def __init__(self, message):
28
+ super().__init__(f'SuiteError: {message}')
25
29
 
26
30
  # Windows bash colors
27
31
  class Colors:
@@ -107,6 +111,7 @@ class Suite:
107
111
  ``AsyncRunner``: Object AsyncRunner functions to run in Assyncronous
108
112
  ``Browser``: Object Browser automation functions (neeeds Selenium and Webdriver_Manager)
109
113
  ``Iris``: Object Iris automation functions to convert documents with OCR + IA based on ``docling``
114
+ ``Artemis``: Object Artemis automation functions to desktopbot similar Botcity with ``pyautogui``
110
115
 
111
116
  pt-br
112
117
  -----
@@ -140,6 +145,7 @@ class Suite:
140
145
  ``AsyncRunner``: Objeto AsyncRunner funções para rodar processos em assincronicidade
141
146
  ``Browser``: Objeto de Automação de Navegadores (necessario Selenium e Webdriver_Manager)
142
147
  ``Iris``: Objeto Iris Automação de funções para converter documentos com OCR + IA baseado em ``docling``
148
+ ``Artemis``: Objeto Artemis funções de automação para desktop similar ao Botcity com ``pyautogui``
143
149
  """
144
150
 
145
151
  # SUBMODULES
@@ -171,7 +177,13 @@ class Suite:
171
177
  from .core.iris import Iris
172
178
 
173
179
  iris: Iris = Iris
174
-
180
+
181
+ # from .iris import Iris
182
+ if importlib.util.find_spec("pyautogui"):
183
+ from .core.artemis import Artemis
184
+
185
+ artemis: Artemis = Artemis
186
+
175
187
  # VARIABLES INTERNAL
176
188
  try:
177
189
  # old: __version__ = pkg_resources.get_distribution("rpa_suite").version
@@ -12,4 +12,4 @@ O módulo de utilitários da rpa-suite fornece uma coleção de funções e clas
12
12
  from .system import Tools
13
13
 
14
14
 
15
- __version__ = "1.6.1"
15
+ __version__ = "1.6.2"