rpa-suite 1.3.3__py3-none-any.whl → 1.3.5__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.
Files changed (48) hide show
  1. rpa_suite/__init__.py +4 -1
  2. rpa_suite/core/__init__.py +1 -0
  3. rpa_suite/core/clock.py +271 -0
  4. rpa_suite/core/date.py +138 -0
  5. rpa_suite/core/dir.py +182 -0
  6. rpa_suite/core/email.py +343 -0
  7. rpa_suite/core/file.py +209 -0
  8. rpa_suite/core/log.py +304 -0
  9. rpa_suite/core/print.py +197 -0
  10. rpa_suite/core/regex.py +62 -0
  11. rpa_suite/core/validate.py +220 -0
  12. rpa_suite/{log → functions}/__create_log_dir.py +5 -7
  13. rpa_suite/{file → functions}/__create_ss_dir.py +2 -2
  14. rpa_suite/functions/__init__.py +1 -0
  15. rpa_suite/{log → functions}/_functions_logger.py +8 -8
  16. rpa_suite/{log → functions}/_logger.py +3 -3
  17. rpa_suite/suite.py +238 -148
  18. {rpa_suite-1.3.3.dist-info → rpa_suite-1.3.5.dist-info}/METADATA +66 -55
  19. rpa_suite-1.3.5.dist-info/RECORD +25 -0
  20. rpa_suite/clock/__init__.py +0 -1
  21. rpa_suite/clock/exec_at.py +0 -133
  22. rpa_suite/clock/scheduler.py +0 -38
  23. rpa_suite/clock/waiter.py +0 -139
  24. rpa_suite/date/__init__.py +0 -1
  25. rpa_suite/date/date.py +0 -124
  26. rpa_suite/email/__init__.py +0 -1
  27. rpa_suite/email/sender_smtp.py +0 -203
  28. rpa_suite/file/__init__.py +0 -1
  29. rpa_suite/file/counter.py +0 -69
  30. rpa_suite/file/file_flag.py +0 -103
  31. rpa_suite/file/screen_shot.py +0 -91
  32. rpa_suite/file/temp_dir.py +0 -176
  33. rpa_suite/log/__init__.py +0 -1
  34. rpa_suite/log/functions_logger_uru.py +0 -172
  35. rpa_suite/log/log_decorator.py +0 -37
  36. rpa_suite/log/logger_uru.py +0 -110
  37. rpa_suite/regex/__init__.py +0 -1
  38. rpa_suite/regex/pattern_in_text.py +0 -58
  39. rpa_suite/validate/__init__.py +0 -1
  40. rpa_suite/validate/mail_validator.py +0 -93
  41. rpa_suite/validate/string_validator.py +0 -120
  42. rpa_suite-1.3.3.dist-info/RECORD +0 -36
  43. /rpa_suite/{log/printer.py → functions/_printer.py} +0 -0
  44. /rpa_suite/{log → functions}/_variables.py +0 -0
  45. /rpa_suite/{log → functions}/_variables_uru.py +0 -0
  46. {rpa_suite-1.3.3.dist-info → rpa_suite-1.3.5.dist-info}/WHEEL +0 -0
  47. {rpa_suite-1.3.3.dist-info → rpa_suite-1.3.5.dist-info}/licenses/LICENSE +0 -0
  48. {rpa_suite-1.3.3.dist-info → rpa_suite-1.3.5.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,220 @@
1
+ # /mail_validator.py
2
+
3
+ import email_validator
4
+ from rpa_suite.functions._printer import error_print, success_print
5
+
6
+
7
+ class Validate():
8
+
9
+ def __init__(self):
10
+ ...
11
+
12
+ def emails(self,
13
+ email_list: list[str],
14
+ display_message: bool = False
15
+ ) -> dict:
16
+
17
+ """
18
+ Function responsible for rigorously validating a list of emails using the email_validator library. \n
19
+
20
+ Parameters:
21
+ ------------
22
+ ``email_list: list`` a list of strings containing the emails to be validated
23
+
24
+ Return:
25
+ ------------
26
+ >>> type: dict
27
+ Returns a dictionary with the respective data:
28
+ * 'success': bool - represents if the list is 100% valid
29
+ * 'valid_emails': list - list of valid emails
30
+ * 'invalid_emails': list - list of invalid emails
31
+ * 'qt_valids': int - number of valid emails
32
+ * 'qt_invalids': int - number of invalid emails
33
+ * 'map_validation' - map of the validation of each email
34
+
35
+ Description: pt-br
36
+ ----------
37
+ Função responsavel por validar de forma rigorosa lista de emails usando a biblioteca email_validator. \n
38
+
39
+ Paramentros:
40
+ ------------
41
+ ``email_list: list`` uma lista de strings contendo os emails a serem validados
42
+
43
+ Retorno:
44
+ ------------
45
+ >>> type: dict
46
+ Retorna um dicionário com os respectivos dados:
47
+ * 'success': bool - representa se a lista é 100% valida
48
+ * 'valid_emails': list - lista de emails validos
49
+ * 'invalid_emails': list - lista de emails invalidos
50
+ * 'qt_valids': int - quantidade de emails validos
51
+ * 'qt_invalids': int - quantidade de emails invalidos
52
+ * 'map_validation' - mapa da validação de cada email
53
+ """
54
+
55
+ # Local Variables
56
+ result: dict = {
57
+ 'success': bool,
58
+ 'valid_emails': list,
59
+ 'invalid_emails': list,
60
+ 'qt_valids': int,
61
+ 'qt_invalids': int,
62
+ 'map_validation': list[dict]
63
+ }
64
+
65
+
66
+ # Preprocessing
67
+ validated_emails: list = []
68
+ invalid_emails: list = []
69
+ map_validation: list[dict] = []
70
+
71
+ # Process
72
+ try:
73
+ for email in email_list:
74
+ try:
75
+ v = email_validator.validate_email(email)
76
+ validated_emails.append(email)
77
+ map_validation.append(v)
78
+
79
+ except email_validator.EmailNotValidError:
80
+ invalid_emails.append(email)
81
+
82
+ if display_message: success_print(f'Function: {self.emails.__name__} executed.')
83
+
84
+ except Exception as e:
85
+ error_print(f'Error when trying to validate email list: {str(e)}')
86
+
87
+
88
+ # Postprocessing
89
+ result = {
90
+ 'success': len(invalid_emails) == 0,
91
+ 'valid_emails': validated_emails,
92
+ 'invalid_emails': invalid_emails,
93
+ 'qt_valids': len(validated_emails),
94
+ 'qt_invalids': len(invalid_emails),
95
+ 'map_validation': map_validation
96
+ }
97
+
98
+ return result
99
+
100
+
101
+ def word(self,
102
+ origin_text: str,
103
+ searched_word: str,
104
+ case_sensitivy: bool = True,
105
+ search_by: str = 'string',
106
+ display_message: bool = False
107
+ ) -> dict:
108
+
109
+ """
110
+ Function responsible for searching for a string, substring or word within a provided text. \n
111
+
112
+ Parameters:
113
+ -----------
114
+ ``origin_text: str`` \n
115
+
116
+ * It is the text where the search should be made, in string format. \n
117
+
118
+ ``search_by: str`` accepts the values: \n
119
+
120
+ * 'string' - can find a requested writing excerpt. (default) \n
121
+ * 'word' - finds only the word written out exclusively. \n
122
+ * 'regex' - find regex patterns, [ UNDER DEVELOPMENT ...] \n
123
+
124
+ Return:
125
+ -----------
126
+ >>> type:dict
127
+ a dictionary with all information that may be necessary about the validation.
128
+ Respectively being:
129
+ * 'is_found': bool - if the pattern was found in at least one case
130
+ * 'number_occurrences': int - represents the number of times this pattern was found
131
+ * 'positions': list[set(int, int), ...] - represents all positions where the pattern appeared in the original text
132
+
133
+ About `Positions`:
134
+ -----------
135
+ >>> type: list[set(int, int), ...]
136
+ * 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.
137
+
138
+ Description: pt-br
139
+ ----------
140
+ Função responsavel por fazer busca de uma string, sbustring ou palavra dentro de um texto fornecido. \n
141
+
142
+ Parametros:
143
+ -----------
144
+ ``origin_text: str`` \n
145
+
146
+ * É o texto onde deve ser feita a busca, no formato string. \n
147
+
148
+ ``search_by: str`` aceita os valores: \n
149
+
150
+ * 'string' - consegue encontrar um trecho de escrita solicitado. (default) \n
151
+ * 'word' - encontra apenas a palavra escrita por extenso exclusivamente. \n
152
+ * 'regex' - encontrar padrões de regex, [ EM DESENVOLVIMENTO ...] \n
153
+
154
+ Retorno:
155
+ -----------
156
+ >>> type:dict
157
+ um dicionário com todas informações que podem ser necessarias sobre a validação.
158
+ Sendo respectivamente:
159
+ * 'is_found': bool - se o pattern foi encontrado em pelo menos um caso
160
+ * 'number_occurrences': int - representa o número de vezes que esse pattern foi econtrado
161
+ * 'positions': list[set(int, int), ...] - representa todas posições onde apareceu o pattern no texto original
162
+
163
+ Sobre o `Positions`:
164
+ -----------
165
+ >>> type: list[set(int, int), ...]
166
+ * 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.
167
+ """
168
+
169
+ # Local Variables
170
+ result: dict = {
171
+ 'is_found': False,
172
+ 'number_occurrences': 0,
173
+ 'positions': []
174
+ }
175
+
176
+ # Preprocessing
177
+ result['is_found'] = False
178
+
179
+ # Process
180
+ try:
181
+ if search_by == 'word':
182
+ origin_words = origin_text.split()
183
+ try:
184
+ if case_sensitivy:
185
+ result['number_occurrences'] = origin_words.count(searched_word)
186
+ result['is_found'] = result['number_occurrences'] > 0
187
+ else:
188
+ words_lowercase = [word.lower() for word in origin_words]
189
+ searched_word_lower = searched_word.lower()
190
+ result['number_occurrences'] = words_lowercase.count(searched_word_lower)
191
+ result['is_found'] = result['number_occurrences'] > 0
192
+
193
+ except Exception as e:
194
+ return error_print(f'Unable to complete the search: {searched_word}. Error: {str(e)}')
195
+
196
+ elif search_by == 'string':
197
+ try:
198
+ if case_sensitivy:
199
+ result['number_occurrences'] = origin_text.count(searched_word)
200
+ result['is_found'] = result['number_occurrences'] > 0
201
+ else:
202
+ origin_text_lower = origin_text.lower()
203
+ searched_word_lower = searched_word.lower()
204
+ result['number_occurrences'] = origin_text_lower.count(searched_word_lower)
205
+ result['is_found'] = result['number_occurrences'] > 0
206
+
207
+ except Exception as e:
208
+ return error_print(f'Unable to complete the search: {searched_word}. Error: {str(e)}')
209
+
210
+ except Exception as e:
211
+ return error_print(f'Unable to search for: {searched_word}. Error: {str(e)}')
212
+
213
+ # Postprocessing
214
+ if result['is_found']:
215
+ if display_message: success_print(f'Function: {self.word.__name__} found: {result["number_occurrences"]} occurrences for "{searched_word}".')
216
+ else:
217
+ if display_message: success_print(f'Function: {self.word.__name__} found no occurrences of "{searched_word}" during the search.')
218
+
219
+ return result
220
+
@@ -2,7 +2,7 @@
2
2
 
3
3
  import os
4
4
  from typing import Union
5
- from rpa_suite.log.printer import error_print, alert_print, success_print
5
+ from rpa_suite.functions._printer import error_print, alert_print, success_print
6
6
 
7
7
 
8
8
  def _create_log_dir(path_to_create: str = 'default', name_log_dir: str='logs') -> dict[str, Union[bool, str, None]]:
@@ -38,15 +38,13 @@ def _create_log_dir(path_to_create: str = 'default', name_log_dir: str='logs') -
38
38
  * 'success': bool - representa se ação foi realizada com sucesso
39
39
  * 'path_created': str - path do diretório que foi criado no processo
40
40
  """
41
-
42
-
41
+
43
42
  # Local Variables
44
43
  result: dict = {
45
44
  'success': bool,
46
45
  'path_created': str,
47
46
  }
48
-
49
-
47
+
50
48
  try:
51
49
  # by 'default', defines path to local script execution path
52
50
  if path_to_create == 'default':
@@ -64,7 +62,7 @@ def _create_log_dir(path_to_create: str = 'default', name_log_dir: str='logs') -
64
62
  result['success'] = True
65
63
  result['path_created'] = fr'{full_path}'
66
64
 
67
- success_print(f"Dir:'{full_path}' created!")
65
+ success_print(f"Diretório:'{full_path}' foi criado com sucesso.")
68
66
 
69
67
  except FileExistsError:
70
68
  result['success'] = False
@@ -74,7 +72,7 @@ def _create_log_dir(path_to_create: str = 'default', name_log_dir: str='logs') -
74
72
  except PermissionError:
75
73
  result['success'] = False
76
74
  result['path_created'] = None
77
- alert_print(f"Permission Denied: Not Able to create: '{full_path}'.")
75
+ alert_print(f"Permissão negada: não é possível criar o diretório '{full_path}'.")
78
76
 
79
77
  except Exception as e:
80
78
  result['success'] = False
@@ -2,13 +2,13 @@
2
2
 
3
3
  import os
4
4
  from typing import Union
5
- from rpa_suite.log.printer import error_print, alert_print, success_print
5
+ from rpa_suite.functions._printer import error_print, alert_print, success_print
6
6
 
7
7
 
8
8
  def __create_ss_dir(path_to_create: str = 'default', name_ss_dir: str='screenshots') -> dict[str, Union[bool, str, None]]:
9
9
 
10
10
  """
11
- Function responsible for creating a ScreenShots directory to work with your screenshot files. \n
11
+ Function responsible for creating a screenshots directory to work with your screenshot files. \n
12
12
 
13
13
  Parameters:
14
14
  ----------
@@ -0,0 +1 @@
1
+ # rpa_suite/functions/__init__.py
@@ -2,7 +2,7 @@
2
2
 
3
3
  import logging
4
4
  from ._logger import file_handler
5
- from rpa_suite.log.printer import error_print, success_print
5
+ from rpa_suite.functions._printer import error_print, success_print
6
6
 
7
7
 
8
8
  def log_start_run_debug(msg_start_loggin: str) -> None: # represent start application
@@ -17,7 +17,7 @@ def log_start_run_debug(msg_start_loggin: str) -> None: # represent start applic
17
17
  success_print(f'{msg_start_loggin}')
18
18
 
19
19
  except Exception as e:
20
- error_print(f'Error to execute function:{log_start_run_debug.__name__}! Error: {str(e)}')
20
+ error_print(f'Erro durante a função: {log_start_run_debug.__name__}! Error: {str(e)}')
21
21
 
22
22
 
23
23
  def log_debug(msg) -> None:
@@ -30,7 +30,7 @@ def log_debug(msg) -> None:
30
30
  logging.debug(msg)
31
31
 
32
32
  except Exception as e:
33
- error_print(f'Error to execute function:{log_debug.__name__}! Error: {str(e)}')
33
+ error_print(f'Erro durante a função: {log_debug.__name__}! Error: {str(e)}')
34
34
 
35
35
  def log_info(msg) -> None:
36
36
 
@@ -42,7 +42,7 @@ def log_info(msg) -> None:
42
42
  logging.info(msg)
43
43
 
44
44
  except Exception as e:
45
- error_print(f'Error to execute function:{log_debug.__name__}! Error: {str(e)}')
45
+ error_print(f'Erro durante a função: {log_debug.__name__}! Error: {str(e)}')
46
46
 
47
47
  def log_info(msg) -> None:
48
48
 
@@ -54,7 +54,7 @@ def log_info(msg) -> None:
54
54
  logging.info(msg)
55
55
 
56
56
  except Exception as e:
57
- error_print(f'Error to execute function:{log_info.__name__}! Error: {str(e)}')
57
+ error_print(f'Erro durante a função: {log_info.__name__}! Error: {str(e)}')
58
58
 
59
59
 
60
60
  def log_warning(msg) -> None:
@@ -67,7 +67,7 @@ def log_warning(msg) -> None:
67
67
  logging.warning(msg)
68
68
 
69
69
  except Exception as e:
70
- error_print(f'Error to execute function:{log_warning.__name__}! Error: {str(e)}')
70
+ error_print(f'Erro durante a função: {log_warning.__name__}! Error: {str(e)}')
71
71
 
72
72
 
73
73
  def log_error(msg) -> None:
@@ -80,7 +80,7 @@ def log_error(msg) -> None:
80
80
  logging.error(msg)
81
81
 
82
82
  except Exception as e:
83
- error_print(f'Error to execute function:{log_error.__name__}! Error: {str(e)}')
83
+ error_print(f'Erro durante a função: {log_error.__name__}! Error: {str(e)}')
84
84
 
85
85
 
86
86
  def log_critical(msg) -> None:
@@ -93,4 +93,4 @@ def log_critical(msg) -> None:
93
93
  logging.critical(msg)
94
94
 
95
95
  except Exception as e:
96
- error_print(f'Error to execute function:{log_critical.__name__}! Error: {str(e)}')
96
+ error_print(f'Erro durante a função: {log_critical.__name__}! Error: {str(e)}')
@@ -7,7 +7,7 @@ from colorlog import ColoredFormatter
7
7
  from typing import Optional as Op
8
8
  from ._variables import file_handler, stream_handler
9
9
  from .__create_log_dir import _create_log_dir
10
- from rpa_suite.log.printer import error_print
10
+ from rpa_suite.functions._printer import error_print
11
11
 
12
12
 
13
13
  class Filters(Filter):
@@ -29,7 +29,7 @@ class Filters(Filter):
29
29
  input()"""
30
30
  for word in string_words:
31
31
  if word in record.msg:
32
- record.msg = 'Log with filtered words!'
32
+ record.msg = 'Log Alterado devido a palavra Filtrada!'
33
33
  return True
34
34
 
35
35
  return True
@@ -109,5 +109,5 @@ def config_logger(name_app:str = 'Logger', path_dir:str = None, name_log_dir:str
109
109
 
110
110
  except Exception as e:
111
111
 
112
- error_print(f'Error to execute function:{config_logger.__name__}! Error: {str(e)}.')
112
+ error_print(f'Houve um erro durante a execução da função: {config_logger.__name__}! Error: {str(e)}.')
113
113
  return None