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
@@ -1,110 +0,0 @@
1
- # /logger_uru.py
2
-
3
- from typing import Optional as Op
4
- from .__create_log_dir import _create_log_dir
5
- from rpa_suite.log.printer import error_print
6
- from loguru import logger
7
- import sys, os, inspect
8
-
9
- class Filters:
10
- word_filter: Op[list[str]]
11
-
12
- def __call__(self, record):
13
-
14
- if len(self.word_filter) > 0:
15
-
16
- for words in self.word_filter:
17
-
18
- string_words: list[str] = [str(word) for word in words]
19
-
20
- for word in string_words:
21
- if word in record["message"]:
22
- record["message"] = 'Log with filtered words!'
23
- return True
24
-
25
- return True
26
-
27
-
28
- class CustomHandler:
29
- def __init__(self, formatter):
30
- self.formatter = formatter
31
-
32
- def write(self, message):
33
- frame = inspect.currentframe().f_back.f_back
34
- log_msg = self.formatter.format(message, frame)
35
- sys.stderr.write(log_msg)
36
-
37
-
38
- class CustomFormatter:
39
- def format(self, record):
40
-
41
- frame = inspect.currentframe().f_back
42
- full_path_filename = frame.f_code.co_filename
43
-
44
- # Obtenha o nome do arquivo e o nome da pasta
45
- filename = os.path.basename(full_path_filename)
46
- foldername = os.path.basename(os.path.dirname(full_path_filename))
47
-
48
- # Combine o nome da pasta e o nome do arquivo
49
- filename = os.path.join(foldername, filename)
50
- lineno = frame.f_lineno
51
-
52
- # Formate a mensagem de log TERMINAL
53
- format_string = "<green>{time:DD.MM.YY.HH:mm}</green> <level>{level: <8}</level> <level>{message}</level>\n"
54
-
55
- log_msg = format_string.format(
56
- time=record["time"],
57
- level=record["level"].name,
58
- filename=filename,
59
- lineno=lineno,
60
- message=record["message"]
61
- )
62
- return log_msg
63
-
64
- def config_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):
65
-
66
- """
67
- Function responsible for create a object logger with fileHandler and streamHandler
68
- """
69
-
70
- try:
71
-
72
- if not use_default_path_and_name:
73
- result_tryed: dict = _create_log_dir(path_dir, name_log_dir)
74
- path_dir = result_tryed['path_created']
75
- else:
76
- if path_dir == None and name_log_dir == None:
77
- result_tryed: dict = _create_log_dir()
78
- path_dir = result_tryed['path_created']
79
-
80
-
81
- # ATRIBUIÇÕES
82
- new_filter: Op[Filters] = None
83
- if filter_words is not None:
84
- new_filter: Filters = Filters()
85
- new_filter.word_filter = [filter_words]
86
-
87
-
88
- # configuração de objetos logger
89
- file_handler = fr'{path_dir}\{name_file_log}.log'
90
- logger.remove()
91
-
92
- # Formate a mensagem de log FILE
93
- log_format: str = "<green>{time:DD.MM.YY.HH:mm}</green> <level>{level: <8}</level> <green>{extra[filename]}</green>:{extra[lineno]: <4} <level>{message}</level>"
94
-
95
-
96
- formatter = CustomFormatter()
97
- if new_filter is not None:
98
- logger.add(file_handler, filter=new_filter, level="DEBUG", format=log_format)
99
- else:
100
- logger.add(file_handler, level="DEBUG", format=log_format)
101
-
102
- # Adicione sys.stderr como um manipulador
103
- logger.add(sys.stderr, level="DEBUG", format=formatter.format)
104
-
105
- return file_handler
106
-
107
- except Exception as e:
108
-
109
- error_print(f'Error to execute function:{config_logger.__name__}! Error: {str(e)}.')
110
- return None
@@ -1 +0,0 @@
1
- # /__init__.py
@@ -1,58 +0,0 @@
1
- # /pattern_in_text.py
2
-
3
- import re
4
- from rpa_suite.log.printer import error_print, success_print
5
-
6
-
7
- def check_pattern_in_text(origin_text: str,
8
- pattern_to_search: str,
9
- case_sensitive: bool = True,
10
- display_message: bool = False) -> bool:
11
-
12
- """
13
- 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
14
-
15
- Return:
16
- ----------
17
- A boolean indicating whether the pattern was found in the text.
18
-
19
- Description: pt-br
20
- ----------
21
- 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.
22
-
23
- Retorno:
24
- ----------
25
- Um booleano indicando se o padrão foi encontrado no texto.
26
- """
27
-
28
- try:
29
-
30
- if case_sensitive:
31
-
32
- # Check if the pattern is found in the text
33
- if re.search(pattern_to_search, origin_text):
34
- if display_message: success_print(f'Pattern found successfully!')
35
- return True
36
-
37
- else:
38
- if display_message: success_print(f'Pattern not found.')
39
- return False
40
- else:
41
-
42
- # normalize text to search without case sensitive
43
- origin_text = origin_text.lower()
44
- pattern_to_search = pattern_to_search.lower()
45
-
46
- # Check if the pattern is found in the text
47
- if re.search(pattern_to_search, origin_text):
48
- if display_message: success_print(f'Pattern found successfully!')
49
- return True
50
-
51
- else:
52
- if display_message: success_print(f'Pattern not found.')
53
- return False
54
-
55
- except Exception as e:
56
-
57
- error_print(f"Error when trying to check pattern in text. Error: {str(e)}")
58
- return False
@@ -1 +0,0 @@
1
- # /__init__.py
@@ -1,93 +0,0 @@
1
- # /mail_validator.py
2
-
3
- import email_validator
4
- from rpa_suite.log.printer import error_print, success_print
5
-
6
- def valid_emails(
7
- email_list: list[str],
8
- display_message: bool = False,
9
- ) -> dict:
10
-
11
- """
12
- Function responsible for rigorously validating a list of emails using the email_validator library. \n
13
-
14
- Parameters:
15
- ------------
16
- ``email_list: list`` a list of strings containing the emails to be validated
17
-
18
- Return:
19
- ------------
20
- >>> type: dict
21
- Returns a dictionary with the respective data:
22
- * 'success': bool - represents if the list is 100% valid
23
- * 'valid_emails': list - list of valid emails
24
- * 'invalid_emails': list - list of invalid emails
25
- * 'qt_valids': int - number of valid emails
26
- * 'qt_invalids': int - number of invalid emails
27
- * 'map_validation' - map of the validation of each email
28
-
29
- Description: pt-br
30
- ----------
31
- Função responsavel por validar de forma rigorosa lista de emails usando a biblioteca email_validator. \n
32
-
33
- Paramentros:
34
- ------------
35
- ``email_list: list`` uma lista de strings contendo os emails a serem validados
36
-
37
- Retorno:
38
- ------------
39
- >>> type: dict
40
- Retorna um dicionário com os respectivos dados:
41
- * 'success': bool - representa se a lista é 100% valida
42
- * 'valid_emails': list - lista de emails validos
43
- * 'invalid_emails': list - lista de emails invalidos
44
- * 'qt_valids': int - quantidade de emails validos
45
- * 'qt_invalids': int - quantidade de emails invalidos
46
- * 'map_validation' - mapa da validação de cada email
47
- """
48
-
49
- # Local Variables
50
- result: dict = {
51
- 'success': bool,
52
- 'valid_emails': list,
53
- 'invalid_emails': list,
54
- 'qt_valids': int,
55
- 'qt_invalids': int,
56
- 'map_validation': list[dict]
57
- }
58
-
59
-
60
- # Preprocessing
61
- validated_emails: list = []
62
- invalid_emails: list = []
63
- map_validation: list[dict] = []
64
-
65
- # Process
66
- try:
67
- for email in email_list:
68
- try:
69
- v = email_validator.validate_email(email)
70
- validated_emails.append(email)
71
- map_validation.append(v)
72
-
73
- except email_validator.EmailNotValidError:
74
- invalid_emails.append(email)
75
-
76
- if display_message:
77
- success_print(f'Function:{valid_emails.__name__} executed!')
78
-
79
- except Exception as e:
80
- error_print(f'Error when trying to validate email list: {str(e)}')
81
-
82
-
83
- # Postprocessing
84
- result = {
85
- 'valid_emails': validated_emails,
86
- 'invalid_emails': invalid_emails,
87
- 'success': len(invalid_emails) == 0,
88
- 'qt_valids': len(validated_emails),
89
- 'qt_invalids': len(invalid_emails),
90
- 'map_validation': map_validation
91
- }
92
-
93
- return result
@@ -1,120 +0,0 @@
1
- # /string_validator.py
2
-
3
- from rpa_suite.log.printer import success_print, error_print
4
-
5
- def search_str_in(
6
- origin_text: str,
7
- searched_word: str,
8
- case_sensitivy: bool = True,
9
- search_by: str = 'string',
10
- ) -> dict:
11
-
12
- """
13
- Function responsible for searching for a string, substring or word within a provided text. \n
14
-
15
- Parameters:
16
- -----------
17
- ``origin_text: str`` \n
18
-
19
- * It is the text where the search should be made, in string format. \n
20
-
21
- ``search_by: str`` accepts the values: \n
22
-
23
- * 'string' - can find a requested writing excerpt. (default) \n
24
- * 'word' - finds only the word written out exclusively. \n
25
- * 'regex' - find regex patterns, [ UNDER DEVELOPMENT ...] \n
26
-
27
- Return:
28
- -----------
29
- >>> type:dict
30
- a dictionary with all information that may be necessary about the validation.
31
- Respectively being:
32
- * 'is_found': bool - if the pattern was found in at least one case
33
- * 'number_occurrences': int - represents the number of times this pattern was found
34
- * 'positions': list[set(int, int), ...] - represents all positions where the pattern appeared in the original text
35
-
36
- About `Positions`:
37
- -----------
38
- >>> type: list[set(int, int), ...]
39
- * 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.
40
-
41
- Description: pt-br
42
- ----------
43
- Função responsavel por fazer busca de uma string, sbustring ou palavra dentro de um texto fornecido. \n
44
-
45
- Parametros:
46
- -----------
47
- ``origin_text: str`` \n
48
-
49
- * É o texto onde deve ser feita a busca, no formato string. \n
50
-
51
- ``search_by: str`` aceita os valores: \n
52
-
53
- * 'string' - consegue encontrar um trecho de escrita solicitado. (default) \n
54
- * 'word' - encontra apenas a palavra escrita por extenso exclusivamente. \n
55
- * 'regex' - encontrar padrões de regex, [ EM DESENVOLVIMENTO ...] \n
56
-
57
- Retorno:
58
- -----------
59
- >>> type:dict
60
- um dicionário com todas informações que podem ser necessarias sobre a validação.
61
- Sendo respectivamente:
62
- * 'is_found': bool - se o pattern foi encontrado em pelo menos um caso
63
- * 'number_occurrences': int - representa o número de vezes que esse pattern foi econtrado
64
- * 'positions': list[set(int, int), ...] - representa todas posições onde apareceu o pattern no texto original
65
-
66
- Sobre o `Positions`:
67
- -----------
68
- >>> type: list[set(int, int), ...]
69
- * 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.
70
- """
71
-
72
- # Local Variables
73
- result: dict = {
74
- 'is_found': bool,
75
- 'number_occurrences': int,
76
- 'positions': list[set]
77
- }
78
-
79
- # Preprocessing
80
- result['is_found'] = False
81
- result['number_occurrences'] = 0
82
-
83
- # Process
84
- try:
85
- if search_by == 'word':
86
- origin_words = origin_text.split()
87
- try:
88
- if case_sensitivy:
89
- result['is_found'] = searched_word in origin_words
90
- else:
91
- words_lowercase = [word.lower() for word in origin_words]
92
- searched_word = searched_word.lower()
93
- result['is_found'] = searched_word in words_lowercase
94
-
95
- except Exception as e:
96
- return error_print(f'Unable to complete the search: {searched_word}. Error: {str(e)}')
97
-
98
- elif search_by == 'string':
99
- try:
100
- if case_sensitivy:
101
- result['is_found'] = origin_text.__contains__(searched_word)
102
- else:
103
- origin_text_lower: str = origin_text.lower()
104
- searched_word_lower: str = searched_word.lower()
105
- result['is_found'] = origin_text_lower.__contains__(searched_word_lower)
106
-
107
- except Exception as e:
108
- return error_print(f'Unable to complete the search: {searched_word}. Error: {str(e)}')
109
-
110
-
111
- except Exception as e:
112
- return error_print(f'Unable to search for: {searched_word}. Error: {str(e)}')
113
-
114
- # Postprocessing
115
- if result['is_found']:
116
- success_print(f'Function: {search_str_in.__name__} found: {result["number_occurrences"]} occurrences for "{searched_word}".')
117
- else:
118
- success_print(f'Function: {search_str_in.__name__} found no occurrences of "{searched_word}" during the search.')
119
-
120
- return result
@@ -1,36 +0,0 @@
1
- rpa_suite/__init__.py,sha256=2k_ZeqU7FvqZMFqGm-EYRiV98uxUxmiy5wXygvIobPU,13
2
- rpa_suite/suite.py,sha256=gR7g8LpBIm6dM75edFA8CQJ0nU1gsUAT6dRSla-MzD8,5488
3
- rpa_suite/clock/__init__.py,sha256=haPk94yjX88kR5YpzNNFCpzHw0T7fKAEoiaHA3-vAds,14
4
- rpa_suite/clock/exec_at.py,sha256=BbyndWv8FiGhpeCjd8AJvLdIPHsIlIetHQ59bjG818A,6066
5
- rpa_suite/clock/scheduler.py,sha256=_EeERPcdVakgp4WoAWbQvLUeLUtZeWiONuU--EszKvI,1197
6
- rpa_suite/clock/waiter.py,sha256=puvi1tNIG5v50tVaGckxjWjbTcnDQkpuxIZykRCi6s4,5916
7
- rpa_suite/date/__init__.py,sha256=haPk94yjX88kR5YpzNNFCpzHw0T7fKAEoiaHA3-vAds,14
8
- rpa_suite/date/date.py,sha256=i10Nu54cue8LtcpzqBISq1D4UVkApyDUhZwSxxXRVWw,4322
9
- rpa_suite/email/__init__.py,sha256=haPk94yjX88kR5YpzNNFCpzHw0T7fKAEoiaHA3-vAds,14
10
- rpa_suite/email/sender_smtp.py,sha256=td4LFdMUQB8YWeMPrw_6qrHPZaAIKr-37qqtynYzAZQ,8456
11
- rpa_suite/file/__create_ss_dir.py,sha256=hn98whvD9PBRFKEfyKG_OwFM2oQqzI_8ETMJa7XVho8,3370
12
- rpa_suite/file/__init__.py,sha256=haPk94yjX88kR5YpzNNFCpzHw0T7fKAEoiaHA3-vAds,14
13
- rpa_suite/file/counter.py,sha256=t5Ti_YnI-f-1CRv47T7HfhKYZPRmUQ-wmCvQ3wapncE,2523
14
- rpa_suite/file/file_flag.py,sha256=AcLgVlXLs8dNsKT9ivUOSMSB-tXNOk5Xe5wtfb5Orf0,4120
15
- rpa_suite/file/screen_shot.py,sha256=TWuBPbtUfWuNXkq4Ssbg8ncd4Ons7gtyXxo9qqnsHlw,3809
16
- rpa_suite/file/temp_dir.py,sha256=ly18bZMcPpFp1w8Sswn4fYchhdZ7CoqKeXWU1i74LyM,7212
17
- rpa_suite/log/__create_log_dir.py,sha256=wYhYMaGl75nrWRdCvdH4xpckWAkSChKNRgWohT3mlco,3275
18
- rpa_suite/log/__init__.py,sha256=haPk94yjX88kR5YpzNNFCpzHw0T7fKAEoiaHA3-vAds,14
19
- rpa_suite/log/_functions_logger.py,sha256=gJzSJUZ1HbI2JQJeZ-4U0qjufEPf9H0jhDbNcd0UWwU,2703
20
- rpa_suite/log/_logger.py,sha256=VEfdJTHDpOiHBwzSKC4p1fHJ0yUSIr3qm_hRCCp8Nko,3599
21
- rpa_suite/log/_variables.py,sha256=vCcktifFUriBQTyUaayZW8BlE8Gr7VP-tFbfomKOS5U,312
22
- rpa_suite/log/_variables_uru.py,sha256=xRqYp49l1fFNrHczOmJ6Pqw1PKIWs0f9kxlgvuYGYys,303
23
- rpa_suite/log/functions_logger_uru.py,sha256=LyYazyfXuhQ2iTnWKtkeumUA9o0f_Isyrb1T6D9TsFQ,6091
24
- rpa_suite/log/log_decorator.py,sha256=cSN-WINpdbtvH_bDNurpkbMLjQlDPJKdwou6T8JHo3g,1338
25
- rpa_suite/log/logger_uru.py,sha256=Z_lTY0diKuBjDc3KNdGAa5ryY4JtmH5F0R0DbosWv-o,3628
26
- rpa_suite/log/printer.py,sha256=r72zeobAi2baVbYgbfFH0h5-WMv4tSDGPNlcpZen7O0,3949
27
- rpa_suite/regex/__init__.py,sha256=haPk94yjX88kR5YpzNNFCpzHw0T7fKAEoiaHA3-vAds,14
28
- rpa_suite/regex/pattern_in_text.py,sha256=UvLm8IgkwTWkX6hCA2U4fR0fPHs0K9ws_quNjbj9oic,2289
29
- rpa_suite/validate/__init__.py,sha256=haPk94yjX88kR5YpzNNFCpzHw0T7fKAEoiaHA3-vAds,14
30
- rpa_suite/validate/mail_validator.py,sha256=LTvxXgyBMJxQ8DuMd8gA-6MT4UiWfj1R6Hh4Q56ID50,3035
31
- rpa_suite/validate/string_validator.py,sha256=kkPTUflSfX6CIRVWQ8WXUrEY-ccUQyRPgaBYPGTvfQ4,4989
32
- rpa_suite-1.3.3.dist-info/licenses/LICENSE,sha256=5D8PIbs31iGd9i1_MDNg4SzaQnp9sEIULALh2y3WyMI,1102
33
- rpa_suite-1.3.3.dist-info/METADATA,sha256=NWWvWrCb3xAEPkRdq7jGoUzx_ZcXvwNed3EPKcFxFIo,9342
34
- rpa_suite-1.3.3.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
35
- rpa_suite-1.3.3.dist-info/top_level.txt,sha256=HYkDtg-kJNAr3F2XAIPyJ-QBbNhk7q6jrqsFt10lz4Y,10
36
- rpa_suite-1.3.3.dist-info/RECORD,,
File without changes
File without changes
File without changes