rpa-suite 0.8.1__py3-none-any.whl → 0.8.2__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.
@@ -0,0 +1,118 @@
1
+ import time
2
+ from typing import Callable, Any
3
+ from datetime import datetime as dt
4
+ from rpa_suite.log.printer import error_print, success_print
5
+
6
+ def exec_at_hour(
7
+ hour_to_exec: str,
8
+ fn_to_exec: Callable[..., Any],
9
+ *args,
10
+ **kwargs,
11
+ ) -> dict:
12
+
13
+ """
14
+ Timed function, executes the function at the specified time, by ``default`` it executes at runtime, optionally you can choose the time for execution.
15
+
16
+ Parameters:
17
+ ----------
18
+ `hour_to_exec: 'xx:xx'` - time for function execution, if not passed the value will be by ``default`` at runtime at the time of this function call by the main code.
19
+
20
+ ``fn_to_exec: function`` - (function) to be called by the handler, if there are parameters in this function they can be passed as next arguments in ``*args`` and ``**kwargs``
21
+
22
+ Return:
23
+ ----------
24
+ >>> type:dict
25
+ * 'tried': bool - represents if it tried to execute the function passed in the argument
26
+ * 'success': bool - represents if there was success in trying to execute the requested function
27
+
28
+ Example:
29
+ ---------
30
+ Let's execute the function ``sum`` responsible for adding the values of a and b and return x``sum(a, b) -> x`` and we want the code to wait for the specific time to be executed at ``11:00``
31
+ >>> exec_at_hour("11:00", sum, 10, 5) -> 15 \n
32
+ * NOTE: `exec_at_hour` receives as first parameter the function that should be executed, then it can receive the arguments of the function, and explicitly we can define the time for execution.
33
+
34
+ Description: pt-br
35
+ ----------
36
+ Função temporizada, executa a função no horário especificado, por ``default`` executa no momento da chamada em tempo de execução, opcionalmente pode escolher o horário para execução.
37
+
38
+ Parâmetros:
39
+ ----------
40
+ `hour_to_exec: 'xx:xx'` - horário para execução da função, se não for passado o valor será por ``default`` em tempo de execução no momento da chamada desta função pelo cógido principal.
41
+
42
+ ``fn_to_exec: function`` - (função) a ser chamada pelo handler, se houver parâmetros nessa função podem ser passados como próximos argumentos em ``*args`` e ``**kwargs``
43
+
44
+ Retorno:
45
+ ----------
46
+ >>> type:dict
47
+ * 'tried': bool - representa se tentou executar a função passada no argumento
48
+ * 'success': bool - representa se houve sucesso ao tentar executar a função solicitada
49
+
50
+ Exemplo:
51
+ ---------
52
+ Vamos executar a função ``soma`` responsável por somar os valores de a e b e retornar x``soma(a, b) -> x`` e queremos que o código aguarde o horário especifico para ser executado de ``11:00``
53
+ >>> exec_at_hour("11:00", sum, 10, 5) -> 15 \n
54
+ * OBS.: `exec_at_hour` recebe como primeiro parâmetro a função que deve ser executada, em seguida pode receber os argumentos da função, e de forma explicitada podemos definir o horário para execução.
55
+ """
56
+
57
+ # Local Variables
58
+ result: dict = {
59
+ 'tried': bool,
60
+ 'successs': bool
61
+ }
62
+ run: bool
63
+ now: dt
64
+ hours: str
65
+ minutes: str
66
+ moment_now: str
67
+
68
+ # Preprocessing
69
+ run = True
70
+ now = dt.now()
71
+ hours = str(now.hour) if now.hour > 10 else f"0{now.hour}"
72
+ minutes = str(now.minute) if now.minute > 10 else f"0{now.minute}"
73
+ moment_now = f'{hours}:{minutes}'
74
+
75
+ if hour_to_exec == None:
76
+
77
+ # Process
78
+ while run:
79
+ try:
80
+ fn_to_exec(*args, **kwargs)
81
+ run = False
82
+ result['tried'] = not run
83
+ result['success'] = True
84
+ success_print(f'{fn_to_exec.__name__}: Successfully executed!')
85
+ break
86
+
87
+ except Exception as e:
88
+ run = False
89
+ result['tried'] = not run
90
+ result['success'] = False
91
+ error_print(f'An error occurred that prevented the function from executing: {fn_to_exec.__name__} correctly. Error: {str(e)}')
92
+ break
93
+ else:
94
+ # Executes the function call only at the time provided in the argument.
95
+ while run:
96
+ if moment_now == hour_to_exec:
97
+ try:
98
+ fn_to_exec(*args, **kwargs)
99
+ run = False
100
+ result['tried'] = not run
101
+ result['success'] = True
102
+ success_print(f'{fn_to_exec.__name__}: Successfully executed!')
103
+ break
104
+
105
+ except Exception as e:
106
+ run = False
107
+ result['tried'] = not run
108
+ result['success'] = False
109
+ error_print(f'An error occurred that prevented the function from executing: {fn_to_exec.__name__} correctly. Error: {str(e)}')
110
+ break
111
+ else:
112
+ time.sleep(30)
113
+ now = dt.now()
114
+ hours = str(now.hour) if now.hour > 10 else f"0{now.hour}"
115
+ minutes = str(now.minute) if now.minute > 10 else f"0{now.minute}"
116
+ moment_now = f'{hours}:{minutes}'
117
+
118
+ return result
rpa_suite/clock/waiter.py CHANGED
@@ -1,5 +1,5 @@
1
- from typing import Callable, Any
2
1
  import time
2
+ from typing import Callable, Any
3
3
  from rpa_suite.log.printer import error_print, success_print
4
4
 
5
5
  def wait_for_exec(
@@ -10,6 +10,27 @@ def wait_for_exec(
10
10
  ) -> dict:
11
11
 
12
12
  """
13
+ Timer function, wait for a value in ``seconds`` to execute the function of the argument.
14
+
15
+ Parameters:
16
+ ----------
17
+ `wait_time: int` - (seconds) represents the time that should wait before executing the function passed as an argument.
18
+
19
+ ``fn_to_exec: function`` - (function) to be called after the waiting time, if there are parameters in this function they can be passed as next arguments of this function in ``*args`` and ``**kwargs``
20
+
21
+ Return:
22
+ ----------
23
+ >>> type:dict
24
+ * 'success': bool - represents if the action was performed successfully
25
+
26
+ Example:
27
+ ---------
28
+ We have a sum function in the following format ``sum(a, b) -> return x``, where ``x`` is the result of the sum. We want to wait `30 seconds` to execute this function, so:
29
+ >>> wait_for_exec(30, sum, 10, 5) -> 15 \n
30
+ * NOTE: `wait_for_exec` receives as first argument the time to wait (sec), then the function `sum` and finally the arguments that the function will use.
31
+
32
+ Description: pt-br
33
+ ----------
13
34
  Função temporizadora, aguardar um valor em ``segundos`` para executar a função do argumento.
14
35
 
15
36
  Parametros:
@@ -26,25 +47,25 @@ def wait_for_exec(
26
47
  Exemplo:
27
48
  ---------
28
49
  Temos uma função de soma no seguinte formato ``soma(a, b) -> return x``, onde ``x`` é o resultado da soma. Queremos aguardar `30 segundos` para executar essa função, logo:
29
- >>> wait_for_exec(30, soma, a, b) -> x \n
50
+ >>> wait_for_exec(30, soma, 10, 5) -> 15 \n
30
51
  * OBS.: `wait_for_exec` recebe como primeiro argumento o tempo a aguardar (seg), depois a função `soma` e por fim os argumentos que a função ira usar.
31
52
  """
32
53
 
33
- # Variáveis locais
54
+ # Local Variables
34
55
  result: dict = {
35
56
  'success': bool
36
57
  }
37
58
 
38
- # Processo
59
+ # Process
39
60
  try:
40
61
  time.sleep(wait_time)
41
62
  fn_to_exec(*args, **kwargs)
42
63
  result['success'] = True
43
- success_print(f'A função:: {wait_for_exec.__name__} executou a função: {fn_to_exec.__name__}.')
64
+ success_print(f'Function: {wait_for_exec.__name__} executed the function: {fn_to_exec.__name__}.')
44
65
 
45
66
  except Exception as e:
46
67
  result['success'] = False
47
- error_print(f'Erro ao tentar aguardar para executar a função: {fn_to_exec.__name__} \nMensagem: {str(e)}')
68
+ error_print(f'Error while trying to wait to execute the function: {fn_to_exec.__name__} \nMessage: {str(e)}')
48
69
 
49
70
  return result
50
71
 
@@ -56,6 +77,27 @@ def exec_and_wait(
56
77
  ) -> dict:
57
78
 
58
79
  """
80
+ Timer function, executes a function and waits for the time in ``seconds``
81
+
82
+ Parameters:
83
+ ----------
84
+ `wait_time: int` - (seconds) represents the time that should wait after executing the requested function
85
+
86
+ ``fn_to_exec: function`` - (function) to be called before the time to wait, if there are parameters in this function they can be passed as an argument after the function, being: ``*args`` and ``**kwargs``
87
+
88
+ Return:
89
+ ----------
90
+ >>> type:dict
91
+ * 'success': bool - represents if the action was performed successfully
92
+
93
+ Example:
94
+ ---------
95
+ We have a sum function in the following format ``sum(a, b) -> return x``, where ``x`` is the result of the sum. We want to execute the sum and then wait `30 seconds` to continue the main code:
96
+ >>> wait_for_exec(30, sum, 10, 5) -> 15 \n
97
+ * NOTE: `wait_for_exec` receives as first argument the time to wait (sec), then the function `sum` and finally the arguments that the function will use.
98
+
99
+ Description: pt-br
100
+ ----------
59
101
  Função temporizadora, executa uma função e aguarda o tempo em ``segundos``
60
102
 
61
103
  Parametros:
@@ -72,24 +114,24 @@ def exec_and_wait(
72
114
  Exemplo:
73
115
  ---------
74
116
  Temos uma função de soma no seguinte formato ``soma(a, b) -> return x``, onde ``x`` é o resultado da soma. Queremos executar a soma e então aguardar `30 segundos` para continuar o código principal:
75
- >>> wait_for_exec(30, soma, a, b) -> x \n
117
+ >>> wait_for_exec(30, soma, 10, 5) -> 15 \n
76
118
  * OBS.: `wait_for_exec` recebe como primeiro argumento o tempo a aguardar (seg), depois a função `soma` e por fim os argumentos que a função ira usar.
77
119
  """
78
120
 
79
- # Variáveis locais
121
+ # Local Variables
80
122
  result: dict = {
81
123
  'success': bool
82
124
  }
83
125
 
84
- # Processo
126
+ # Process
85
127
  try:
86
128
  fn_to_exec(*args, **kwargs)
87
129
  time.sleep(wait_time)
88
130
  result['success'] = True
89
- success_print(f'A função:: {wait_for_exec.__name__} executou a função: {fn_to_exec.__name__}.')
131
+ success_print(f'Function: {wait_for_exec.__name__} executed the function: {fn_to_exec.__name__}.')
90
132
 
91
133
  except Exception as e:
92
134
  result['success'] = False
93
- error_print(f'Erro ao tentar aguardar para executar a função: {fn_to_exec.__name__} \nMensagem: {str(e)}')
135
+ error_print(f'Error while trying to wait to execute the function: {fn_to_exec.__name__} \nMessage: {str(e)}')
94
136
 
95
137
  return result
rpa_suite/date/date.py CHANGED
@@ -4,7 +4,26 @@ from rpa_suite.log.printer import error_print
4
4
 
5
5
 
6
6
  def get_hms() -> tuple:
7
+
7
8
  """
9
+ Function to return hour, minute and second. The return is in the form of a tuple with strings being able to store and use the values individually.
10
+
11
+ Treatment:
12
+ ----------
13
+ The function already does the treatment for values below 10 always keeping 2 decimal places in all results, the individual values are always in string format
14
+
15
+ Return:
16
+ ----------
17
+ >>> type:tuple
18
+ * tuple('hh', 'mm', 'ss') - tuple with the values of hour, minute and second being able to be stored individually, the values are in string
19
+
20
+ Example:
21
+ ---------
22
+ >>> hour, minute, second = get_hms() \n
23
+ * NOTE: Note that it is possible to destructure the return to store simultaneously.
24
+
25
+ Description: pt-br
26
+ ----------
8
27
  Função para retornar hora, minuto e segundo. O retorno é em forma de tupla com strings podendo armazenar e usar os valores de forma individual.
9
28
 
10
29
  Tratamento:
@@ -22,18 +41,18 @@ def get_hms() -> tuple:
22
41
  * OBS.: Note que é possivel desestruturar o retorno para armazenar de forma simultânea.
23
42
  """
24
43
 
25
- # Variáiveis locais
44
+ # Local Variables
26
45
  hours: str
27
46
  minutes: str
28
47
  seconds: str
29
48
 
30
- # Pré tratamento
49
+ # Preprocessing
31
50
  now = dt.datetime.now()
32
51
  hours: str = str(now.hour) if now.hour > 10 else f"0{now.hour}"
33
52
  minutes: str = str(now.minute) if now.minute > 10 else f"0{now.minute}"
34
53
  seconds: str = str(now.second) if now.second > 10 else f"0{now.second}"
35
54
 
36
- # Processo
55
+ # Process
37
56
  try:
38
57
  if len(hours) == 3 or len(minutes) == 3 or len(seconds) == 3:
39
58
  if len(seconds) == 3:
@@ -45,10 +64,24 @@ def get_hms() -> tuple:
45
64
 
46
65
  return hours, minutes, seconds
47
66
  except Exception as e:
48
- return error_print(f'Não foi possivel capturar o horário. Erro: {str(e)}')
67
+ return error_print(f'Unable to capture the time. Error: {str(e)}')
49
68
 
50
69
  def get_dma() -> tuple:
51
70
  """
71
+ Function to return day, month and year. The return is in the form of a tuple with strings being able to store and use the values individually.
72
+
73
+ Return:
74
+ ----------
75
+ >>> type:tuple
76
+ * tuple('dd', 'mm', 'yy') - tuple with the values of day, month and year being able to be stored individually
77
+
78
+ Example:
79
+ ---------
80
+ >>> day, month, year = get_hms() \n
81
+ * NOTE: Note that it is possible to destructure the return to store simultaneously.
82
+
83
+ Description: pt-br
84
+ ----------
52
85
  Função para retornar dia, mes e ano. O retorno é em forma de tupla com strings podendo armazenar e usar os valores de forma individual.
53
86
 
54
87
  Retorno:
@@ -62,15 +95,15 @@ def get_dma() -> tuple:
62
95
  * OBS.: Note que é possivel desestruturar o retorno para armazenar de forma simultânea.
63
96
  """
64
97
 
65
- # Variáiveis locais
98
+ # Local Variables
66
99
  day_got: str
67
100
  month_got: str
68
101
  year_got: str
69
102
 
70
- # Pré tratamento
103
+ # Preprocessing
71
104
  now = dt.datetime.now()
72
105
 
73
- # Processo
106
+ # Process
74
107
  try:
75
108
  day_got: str = str(now.day) if now.day > 10 else f"0{now.day}"
76
109
  month_got: str = str(now.month) if now.month > 10 else f"0{now.month}"
@@ -79,4 +112,4 @@ def get_dma() -> tuple:
79
112
  return day_got, month_got, year_got
80
113
 
81
114
  except Exception as e:
82
- return error_print(f'Não foi possivel capturar o horário. Erro: {str(e)}')
115
+ return error_print(f'Unable to capture the time. Error: {str(e)}')
@@ -19,6 +19,36 @@ def send_email(
19
19
  ) -> dict:
20
20
 
21
21
  """
22
+ Function responsible for sending emails ``(SMTP)``, accepts ``list of recipients`` and possibility
23
+ of ``attaching files``. \n
24
+
25
+ Parameters:
26
+ ----------
27
+ ``email_from: str`` - email from who will send the email.
28
+ ``pass_from: str`` - password of the account used, advised to isolate the password elsewhere.
29
+ ``email_to: list[str]`` - list of emails to which the emails will be sent.
30
+ ``subject_title: str`` - email title.
31
+ ``body_message: str``- body message of the email.
32
+ ``attachments: list[str]`` - list with path of attachments if any. (default None).
33
+ ``type_content: str`` - type of message content can be 'plain' or 'html' (default 'html').
34
+ ``smtp_server: str`` - server to be used to connect with the email account (default 'smtp.office365.com')
35
+ ``smtp_port: int`` - port to be used on this server (default 587)
36
+
37
+ Return:
38
+ ----------
39
+ >>> type:dict
40
+ a dictionary with all information that may be necessary about the emails.
41
+ Respectively being:
42
+ * 'success': bool - if there was at least one successful shipment
43
+ * 'all_mails': list - list of all emails parameterized for sending
44
+ * 'valid_mails': list - list of all valid emails for sending
45
+ * 'invalid_mails': list - list of all invalid emails for sending
46
+ * 'qt_mails_sent': int - effective quantity that was sent
47
+ * 'attchament': bool - if there are attachments
48
+ * 'qt_attach': int - how many attachments were inserted
49
+
50
+ Description: pt-br
51
+ ----------
22
52
  Função responsavel por enviar emails ``(SMTP)``, aceita ``lista de destinatários`` e possibilidade
23
53
  de ``anexar arquivos``. \n
24
54
 
@@ -48,7 +78,7 @@ def send_email(
48
78
  * 'qt_attach': int - quantos anexos foram inseridos
49
79
  """
50
80
 
51
- # Variáveis locais
81
+ # Local Variables
52
82
  result: dict = {
53
83
  'success': bool,
54
84
  'all_mails': list,
@@ -61,20 +91,19 @@ def send_email(
61
91
  email_valido = []
62
92
  email_invalido = []
63
93
 
64
- # Pré Tratamentos
94
+ # Preprocessing
65
95
  result['success'] = False
66
96
  result['qt_mails_sent'] = 0
67
97
  result['attchament'] = False
68
98
 
69
- # Configuração inicial basica.
70
99
  msg = MIMEMultipart()
71
100
  msg['From'] = email_from
72
101
  msg['Subject'] = subject_title
73
102
 
74
- # Adicionar corpo da mensagem
103
+ # Email Body Content
75
104
  msg.attach(MIMEText(body_message, type_content))
76
105
 
77
- # Adicionar anexos, se houver
106
+ # Add Attachment
78
107
  if attachments:
79
108
  result['attchament'] = True
80
109
  for path_to_attach in attachments:
@@ -90,14 +119,14 @@ def send_email(
90
119
  result['attchament'] = False
91
120
  result['qt_attach'] = 0
92
121
 
93
- # Conectar ao servidor SMTP e enviar email
122
+ # SMTP server config
94
123
  try:
95
124
  server_by_smtp = smtplib.SMTP(smtp_server, smtp_port)
96
125
  server_by_smtp.starttls()
97
126
  server_by_smtp.login(email_from, pass_from)
98
127
  email_content = msg.as_string()
99
128
 
100
- # Trata a lista de emails antes de tentar realizar o envio, mantendo apenas emails validos
129
+ # Treats the email list before trying to send, keeping only valid emails
101
130
  try:
102
131
  for emails in email_to:
103
132
  try:
@@ -108,9 +137,9 @@ def send_email(
108
137
  email_invalido.append(emails)
109
138
 
110
139
  except Exception as e:
111
- error_print(f'Erro ao tentar validar lista de emails: {str(e)}')
140
+ error_print(f'Error while trying to validate email list: {str(e)}')
112
141
 
113
- # anexa a lista de emails tratada para realizar o envio
142
+ # Attaches the treated email list to perform the sending
114
143
  msg['To'] = ', '.join(email_valido)
115
144
  for email in email_valido:
116
145
  try:
@@ -119,18 +148,18 @@ def send_email(
119
148
  result['all_mails'] = email_to
120
149
 
121
150
  except smtplib.SMTPException as e:
122
- error_print(f'O email: {email} não foi enviado, por causa do erro: {str(e)}')
151
+ error_print(f"The email: {email} don't sent, caused by error: {str(e)}")
123
152
 
124
153
  server_by_smtp.quit()
125
154
  result['success'] = True
126
- success_print(f'Email(s) enviado(s) com sucesso!')
155
+ success_print(f'Email(s) Sent!')
127
156
 
128
157
 
129
158
  except smtplib.SMTPException as e:
130
159
  result['success'] = False
131
- error_print(f'Erro ao enviar email(s): {str(e)}')
160
+ error_print(f'Error while trying sent Email: {str(e)}')
132
161
 
133
- # Pós Tratamento
162
+ # Postprocessing
134
163
  result['valid_mails'] = email_valido
135
164
  result['invalid_mails'] = email_invalido
136
165
 
rpa_suite/file/counter.py CHANGED
@@ -7,6 +7,22 @@ def count_files(
7
7
  ) -> dict:
8
8
 
9
9
  """
10
+ Function responsible for counting files within a folder, considers subfolders to do the count, searches by file type, being all files by default. \n
11
+
12
+ Parameters:
13
+ ----------
14
+ ``dir_to_count: list`` - should be a list, accepts more than one path to count files.
15
+ ``type_extension: str`` - should be a string with the format/extension of the type of file you want to be searched for counting, if empty by default will be used ``*`` which will count all files.
16
+
17
+
18
+ Return:
19
+ ----------
20
+ >>> type:dict
21
+ * 'success': bool - represents if the action was performed successfully
22
+ * 'qt': int - number that represents the quantity of files that were counted
23
+
24
+ Description: pt-br
25
+ ----------
10
26
  Função responsavel por fazer a contagem de arquivos dentro de uma pasta, considera subpastas para fazer a contagem, busca por tipo de arquivo, sendo todos arquivos por default. \n
11
27
 
12
28
  Parametros:
@@ -22,17 +38,17 @@ def count_files(
22
38
  * 'qt': int - numero que representa a quantidade de arquivos que foram contados
23
39
  """
24
40
 
25
- # Variáveis locais
41
+ # Local Variables
26
42
  result: dict = {
27
43
  'success': bool,
28
44
  'qt': int
29
45
  }
30
46
 
31
- # Pré tratamento
47
+ # Preprocessing
32
48
  result['qt'] = 0
33
49
  result['success'] = False
34
50
 
35
- # Processo
51
+ # Process
36
52
  try:
37
53
  for dir in dir_to_count:
38
54
  for current_dir, sub_dir, files in os.walk(dir):
@@ -40,10 +56,10 @@ def count_files(
40
56
  if file.endswith(f'.{type_extension}'):
41
57
  result['qt'] += 1
42
58
  result['success'] = True
43
- success_print(f'Função: {count_files.__name__} encontrou {result['qt']} arquivos.')
59
+ success_print(f'Function: {count_files.__name__} counted {result['qt']} files.')
44
60
 
45
61
  except Exception as e:
46
62
  result['success'] = False
47
- error_print(f'Erro ao tentar fazer contagem de arquivos! Erro: {str(e)}')
63
+ error_print(f'Error when trying to count files! Error: {str(e)}')
48
64
 
49
65
  return result
@@ -4,6 +4,20 @@ from rpa_suite.log.printer import error_print, alert_print, success_print
4
4
  def create_temp_dir(path_to_create: str = 'default') -> dict:
5
5
 
6
6
  """
7
+ Function responsible for creating a temporary directory to work with files and etc. \n
8
+
9
+ Parameters:
10
+ ----------
11
+ ``path_to_create: str`` - should be a string with the full path pointing to the folder where the temporary 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.
12
+
13
+ Return:
14
+ ----------
15
+ >>> type:dict
16
+ * 'success': bool - represents if the action was performed successfully
17
+ * 'path_created': str - path of the directory that was created in the process
18
+
19
+ Description: pt-br
20
+ ----------
7
21
  Função responsavel por criar diretório temporário para trabalhar com arquivos e etc. \n
8
22
 
9
23
  Parametros:
@@ -15,16 +29,15 @@ def create_temp_dir(path_to_create: str = 'default') -> dict:
15
29
  >>> type:dict
16
30
  * 'success': bool - representa se ação foi realizada com sucesso
17
31
  * 'path_created': str - path do diretório que foi criado no processo
18
-
19
32
  """
20
33
 
21
- # Variáveis Locais
34
+ # Local Variables
22
35
  result: dict = {
23
36
  'success': bool,
24
37
  'path_created': str
25
38
  }
26
39
 
27
- # Pré tratamento
40
+ # Preprocessing
28
41
  default_dir: str
29
42
  try:
30
43
  if path_to_create == 'default':
@@ -33,37 +46,50 @@ def create_temp_dir(path_to_create: str = 'default') -> dict:
33
46
  default_dir = path_to_create
34
47
  except Exception as e:
35
48
  result['success'] = False
36
- error_print(f'Erro ao capturar caminho atual para criar diretório temporária! Erro: {str(e)}')
49
+ error_print(f'Error capturing current path to create temporary directory! Error: {str(e)}')
37
50
 
38
- # Processo
51
+ # Process
39
52
  try:
40
53
  if not os.path.exists(fr'{default_dir}\temp'):
41
54
  try:
42
55
  os.mkdir(fr'{default_dir}\temp')
43
56
  if os.path.exists(fr'{default_dir}\temp'):
44
57
  result['success'] = True
45
- success_print(fr'Diretório criado em: {default_dir}\temp')
58
+ success_print(fr'Directory created in: {default_dir}\temp')
46
59
  else:
47
60
  result['success'] = False
48
61
  raise Exception
49
62
  except Exception as e:
50
- error_print(f'Não foi possivel criar diretório temporario! Erro: {str(e)}')
63
+ error_print(f'Unable to create temporary directory! Error: {str(e)}')
51
64
  else:
52
65
  result['success'] = True
53
- alert_print(fr'AVISO! diretório existe em: {default_dir}\temp ')
66
+ alert_print(fr'NOTICE! directory already exists in: {default_dir}\temp ')
54
67
  except Exception as e:
55
- error_print(f'Erro ao tentar criar diretório temporaria em: {default_dir} - Erro: {str(e)}')
68
+ error_print(f'Error when trying to create temporary directory in: {default_dir} - Error: {str(e)}')
56
69
 
57
- # Pós tratamento
70
+ # Postprocessing
58
71
  result['path_created'] = fr'{default_dir}\temp'
59
72
 
60
- # Retorno
61
73
  return result
62
74
 
63
75
 
64
76
  def delete_temp_dir(path_to_delete: str = 'default') -> dict:
65
77
 
66
78
  """
79
+ Function responsible for deleting temporary directory at the specified path. \n
80
+
81
+ Parameters:
82
+ ----------
83
+ ``path_to_delete: str`` - should be a string with the full path pointing to the folder where the temporary folder should be deleted, if it is empty the ``default`` value will be used which will search for a folder in the current directory where the file containing this function was called.
84
+
85
+ Return:
86
+ ----------
87
+ >>> type:dict
88
+ * 'success': bool - represents if the action was performed successfully
89
+ * 'path_deleted': str - path of the directory that was deleted in the process
90
+
91
+ Description: pt-br
92
+ ----------
67
93
  Função responsavel por deletar diretório temporário no caminho especificado. \n
68
94
 
69
95
  Parametros:
@@ -75,16 +101,15 @@ def delete_temp_dir(path_to_delete: str = 'default') -> dict:
75
101
  >>> type:dict
76
102
  * 'success': bool - representa se ação foi realizada com sucesso
77
103
  * 'path_deleted': str - path do diretório que foi excluido no processo
78
-
79
104
  """
80
105
 
81
- # Variáveis Locais
106
+ # Local Variables
82
107
  temp_dir_result: dict = {
83
108
  'success': bool,
84
109
  'path_deleted': str
85
110
  }
86
111
 
87
- # Pré tratamento
112
+ # Preprocessing
88
113
  default_dir: str
89
114
  try:
90
115
  if path_to_delete == 'default':
@@ -93,29 +118,29 @@ def delete_temp_dir(path_to_delete: str = 'default') -> dict:
93
118
  default_dir = path_to_delete
94
119
  except Exception as e:
95
120
  temp_dir_result['success'] = False
96
- error_print(f'Não foi possivel capturar caminho atual para deletar pasta temporária! Erro: {str(e)}')
121
+ error_print(f'Unable to capture current path to delete temporary folder! Error: {str(e)}')
97
122
 
98
- # Processo
123
+ # Process
99
124
  try:
100
125
  if os.path.exists(fr'{default_dir}\temp'):
101
126
  try:
102
127
  shutil.rmtree(fr'{default_dir}\temp')
103
128
  if not os.path.exists(fr'{default_dir}\temp'):
104
129
  temp_dir_result['success'] = True
105
- success_print(fr'Diretório excluido em: {default_dir}\temp')
130
+ success_print(fr'Directory deleted in: {default_dir}\temp')
106
131
  else:
107
132
  temp_dir_result['success'] = False
108
133
  raise Exception
109
134
  except Exception as e:
110
- error_print(f'Não foi possivel excluir diretório temporario! Erro {str(e)}')
135
+ error_print(f'Unable to delete temporary directory! Error: {str(e)}')
111
136
  else:
112
137
  temp_dir_result['success'] = True
113
- alert_print(fr'Diretório não existe em: {default_dir}\temp. ')
138
+ alert_print(fr'Directory does not exist in: {default_dir}\temp. ')
114
139
 
115
140
  except Exception as e:
116
- error_print(fr'Erro ao tentar deletar diretório temporária em: {default_dir}\temp - Erro: {str(e)}')
141
+ error_print(fr'Error when trying to delete temporary directory in: {default_dir}\temp - Error: {str(e)}')
117
142
 
118
- # Pós tratamento
143
+ # Postprocessing
119
144
  temp_dir_result['path_deleted'] = fr'{default_dir}\temp'
120
145
 
121
146
  return temp_dir_result
rpa_suite/log/loggin.py CHANGED
@@ -6,6 +6,16 @@ def logging_decorator(
6
6
  ) -> Callable:
7
7
 
8
8
  """
9
+ Function responsible for displaying log message in the console for functions that are called. \n
10
+ Displays function name, and the result of the function in case of return, without return returns None.
11
+
12
+ Return:
13
+ ----------
14
+ A ``wrapper`` function with python decoration ``@logger.catch`` that received:
15
+ * ``*args and **kwargs`` in the call parameters as an argument to result in the Log.
16
+
17
+ Description: pt-br
18
+ ----------
9
19
  Função responsavel por exibir mensagem de log no console para funções que são chamadas. \n
10
20
  Exibe nome da função, e o resultado da função em caso de retorno, sem retorno devolve None.
11
21
 
@@ -17,9 +27,9 @@ def logging_decorator(
17
27
 
18
28
  @logger.catch
19
29
  def wrapper(*args, **kwargs):
20
- logger.info('Chamando função: {}', fn.__name__)
30
+ logger.info('Function Called: {}', fn.__name__)
21
31
  result = fn(*args, **kwargs)
22
- logger.info('Função {} retornou: {}', fn.__name__, result)
32
+ logger.info('Function {} returned: {}', fn.__name__, result)
23
33
  return result
24
34
 
25
35
  return wrapper
rpa_suite/log/printer.py CHANGED
@@ -17,6 +17,14 @@ class Colors():
17
17
 
18
18
  def success_print(string_text: str, color=Colors.green, ending="\n") -> None:
19
19
  """
20
+ Print that indicates ``SUCCESS``. Customized with the color Green \n
21
+
22
+ Return:
23
+ ----------
24
+ >>> type:None
25
+
26
+ pt-br
27
+ ----------
20
28
  Print que indica ``SUCESSO``. Personalizado com a cor Verde \n
21
29
 
22
30
  Retorno:
@@ -27,6 +35,14 @@ def success_print(string_text: str, color=Colors.green, ending="\n") -> None:
27
35
 
28
36
  def alert_print(string_text: str, color=Colors.yellow, ending="\n") -> None:
29
37
  """
38
+ Print that indicates ``ALERT``. Customized with the color Yellow \n
39
+
40
+ Return:
41
+ ----------
42
+ >>> type:None
43
+
44
+ pt-br
45
+ ----------
30
46
  Print que indica ``ALERTA``. Personalizado com a cor Amarelo \n
31
47
  Retorno:
32
48
  ----------
@@ -36,6 +52,14 @@ def alert_print(string_text: str, color=Colors.yellow, ending="\n") -> None:
36
52
 
37
53
  def info_print(string_text: str, color=Colors.cyan, ending="\n") -> None:
38
54
  """
55
+ Print that indicates ``INFORMATION``. Customized with the color Cyan \n
56
+
57
+ Return:
58
+ ----------
59
+ >>> type:None
60
+
61
+ pt-br
62
+ ----------
39
63
  Print que indica ``INFORMATIVO``. Personalizado com a cor Ciano \n
40
64
  Retorno:
41
65
  ----------
@@ -45,6 +69,14 @@ def info_print(string_text: str, color=Colors.cyan, ending="\n") -> None:
45
69
 
46
70
  def error_print(string_text: str, color=Colors.red, ending="\n") -> None:
47
71
  """
72
+ Print that indicates ``ERROR``. Customized with the color Red \n
73
+
74
+ Return:
75
+ ----------
76
+ >>> type:None
77
+
78
+ pt-br
79
+ ----------
48
80
  Print que indica ``ERRO``. Personalizado com a cor Vermelho \n
49
81
  Retorno:
50
82
  ----------
@@ -54,6 +86,14 @@ def error_print(string_text: str, color=Colors.red, ending="\n") -> None:
54
86
 
55
87
  def magenta_print(string_text: str, color=Colors.magenta, ending="\n") -> None:
56
88
  """
89
+ Print customized with the color Magenta \n
90
+
91
+ Return:
92
+ ----------
93
+ >>> type:None
94
+
95
+ pt-br
96
+ ----------
57
97
  Print personalizado com a cor Magenta \n
58
98
  Retorno:
59
99
  ----------
@@ -63,6 +103,14 @@ def magenta_print(string_text: str, color=Colors.magenta, ending="\n") -> None:
63
103
 
64
104
  def blue_print(string_text: str, color=Colors.blue, ending="\n") -> None:
65
105
  """
106
+ Print customized with the color Blue \n
107
+
108
+ Return:
109
+ ----------
110
+ >>> type:None
111
+
112
+ pt-br
113
+ ----------
66
114
  Print personalizado com a cor Azul \n
67
115
  Retorno:
68
116
  ----------
@@ -72,6 +120,14 @@ def blue_print(string_text: str, color=Colors.blue, ending="\n") -> None:
72
120
 
73
121
  def print_call_fn(string_text: str, color=Colors.call_fn, ending="\n") -> None:
74
122
  """
123
+ Print customized for function called (log) \n
124
+ Color: Magenta Light
125
+ Return:
126
+ ----------
127
+ >>> type:None
128
+
129
+ pt-br
130
+ ----------
75
131
  Print personalizado para log de chamada de função. \n
76
132
  Cor: Magenta Light
77
133
  Retorno:
@@ -82,6 +138,14 @@ def print_call_fn(string_text: str, color=Colors.call_fn, ending="\n") -> None:
82
138
 
83
139
  def print_retur_fn(string_text: str, color=Colors.retur_fn, ending="\n") -> None:
84
140
  """
141
+ Print customized for function return (log) \n
142
+ Color: Yellow Light
143
+ Return:
144
+ ----------
145
+ >>> type:None
146
+
147
+ pt-br
148
+ ----------
85
149
  Print personalizado para log de chamada de função. \n
86
150
  Cor: Yellow Light
87
151
  Retorno:
rpa_suite/suite.py CHANGED
@@ -1,17 +1,42 @@
1
- from .clock.waiter import wait_for_exec
2
- from .clock.exec_while import exec_wtime
1
+ """MODULE CLOCK"""
2
+ from .clock.waiter import wait_for_exec, exec_and_wait
3
+ from .clock.exec_at import exec_at_hour
4
+
5
+ """MODULE DATE"""
3
6
  from .date.date import get_hms, get_dma
7
+
8
+ """MODULE EMAIL"""
4
9
  from .email.sender_smtp import send_email
10
+
11
+ """MODULE FILE"""
5
12
  from .file.counter import count_files
6
13
  from .file.temp_dir import create_temp_dir, delete_temp_dir
14
+
15
+ """MODULE LOG"""
7
16
  from .log.loggin import logging_decorator
8
17
  from .log.printer import alert_print, success_print, error_print, info_print, print_call_fn, print_retur_fn, magenta_print, blue_print
18
+
19
+ """MODULE REGEX"""
9
20
  from .regex.list_from_text import create_list_using_regex
21
+
22
+ """MODULE VALIDATE"""
10
23
  from .validate.mail_validator import valid_emails
11
24
  from .validate.string_validator import search_in
12
25
 
13
26
  class Rpa_suite():
14
27
  """
28
+ The ``Rpa_suite`` class is a generic representation of the modules, with the aim of centralizing all submodules for access through an instance of this representational Object. It contains variables pointed to the functions of the submodules present in the rpa-site.
29
+
30
+ Call
31
+ ----------
32
+ When calling the maintainer file of this class, an instance of this object will be invoked to be used or reused through another variable
33
+
34
+ Objective
35
+ ----------
36
+ Flexibility being able to call each submodule individually or by importing the representational object of all submodules.
37
+
38
+ Description: pt-br
39
+ ----------
15
40
  Classe ``Rpa_suite`` é uma representação genérica do dos módulos, com objetivo de centralizar todos submódulos para acesso através de uma instância deste Objeto representacional. Ele contem variaveis apontadas para as funções dos submódulos presentes no rpa-site.
16
41
 
17
42
  Chamada
@@ -25,7 +50,8 @@ class Rpa_suite():
25
50
 
26
51
  # clock
27
52
  wait_for_exec = wait_for_exec
28
- exec_wtime = exec_wtime
53
+ exec_and_wait = exec_and_wait
54
+ exec_at_hour = exec_at_hour
29
55
 
30
56
  # date
31
57
  get_hms = get_hms
@@ -6,6 +6,25 @@ def valid_emails(
6
6
  ) -> dict:
7
7
 
8
8
  """
9
+ Function responsible for rigorously validating a list of emails using the email_validator library. \n
10
+
11
+ Parameters:
12
+ ------------
13
+ ``email_list: list`` a list of strings containing the emails to be validated
14
+
15
+ Return:
16
+ ------------
17
+ >>> type: dict
18
+ Returns a dictionary with the respective data:
19
+ * 'success': bool - represents if the list is 100% valid
20
+ * 'valid_emails': list - list of valid emails
21
+ * 'invalid_emails': list - list of invalid emails
22
+ * 'qt_valids': int - number of valid emails
23
+ * 'qt_invalids': int - number of invalid emails
24
+ * 'map_validation' - map of the validation of each email
25
+
26
+ Description: pt-br
27
+ ----------
9
28
  Função responsavel por validar de forma rigorosa lista de emails usando a biblioteca email_validator. \n
10
29
 
11
30
  Paramentros:
@@ -24,7 +43,7 @@ def valid_emails(
24
43
  * 'map_validation' - mapa da validação de cada email
25
44
  """
26
45
 
27
- # Variáveis locais
46
+ # Local Variables
28
47
  result: dict = {
29
48
  'success': bool,
30
49
  'valid_emails': list,
@@ -35,12 +54,12 @@ def valid_emails(
35
54
  }
36
55
 
37
56
 
38
- # Pré Tratamento
57
+ # Preprocessing
39
58
  validated_emails: list = []
40
59
  invalid_emails: list = []
41
60
  map_validation: list[dict] = []
42
61
 
43
- # Processo
62
+ # Process
44
63
  try:
45
64
  for email in email_list:
46
65
  try:
@@ -50,12 +69,12 @@ def valid_emails(
50
69
 
51
70
  except email_validator.EmailNotValidError:
52
71
  invalid_emails.append(email)
53
- success_print(f'Função: {valid_emails.__name__} executada.')
72
+ success_print(f'Function: {valid_emails.__name__} executed.')
54
73
  except Exception as e:
55
- error_print(f'Erro ao tentar validar lista de emails: {str(e)}')
74
+ error_print(f'Error when trying to validate email list: {str(e)}')
56
75
 
57
76
 
58
- # Pós Tratamento
77
+ # Postprocessing
59
78
  result = {
60
79
  'valid_emails': validated_emails,
61
80
  'invalid_emails': invalid_emails,
@@ -8,6 +8,36 @@ def search_in(
8
8
  ) -> dict:
9
9
 
10
10
  """
11
+ Function responsible for searching for a string, substring or word within a provided text. \n
12
+
13
+ Parameters:
14
+ -----------
15
+ ``origin_text: str`` \n
16
+
17
+ * It is the text where the search should be made, in string format. \n
18
+
19
+ ``search_by: str`` accepts the values: \n
20
+
21
+ * 'string' - can find a requested writing excerpt. (default) \n
22
+ * 'word' - finds only the word written out exclusively. \n
23
+ * 'regex' - find regex patterns, [ UNDER DEVELOPMENT ...] \n
24
+
25
+ Return:
26
+ -----------
27
+ >>> type:dict
28
+ a dictionary with all information that may be necessary about the validation.
29
+ Respectively being:
30
+ * 'is_found': bool - if the pattern was found in at least one case
31
+ * 'number_occurrences': int - represents the number of times this pattern was found
32
+ * 'positions': list[set(int, int), ...] - represents all positions where the pattern appeared in the original text
33
+
34
+ About `Positions`:
35
+ -----------
36
+ >>> type: list[set(int, int), ...]
37
+ * 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.
38
+
39
+ Description: pt-br
40
+ ----------
11
41
  Função responsavel por fazer busca de uma string, sbustring ou palavra dentro de um texto fornecido. \n
12
42
 
13
43
  Parametros:
@@ -34,22 +64,21 @@ def search_in(
34
64
  Sobre o `Positions`:
35
65
  -----------
36
66
  >>> type: list[set(int, int), ...]
37
- * 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.
38
-
67
+ * 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.
39
68
  """
40
69
 
41
- # Variaveis locais
70
+ # Local Variables
42
71
  result: dict = {
43
72
  'is_found': bool,
44
73
  'number_occurrences': int,
45
74
  'positions': list[set]
46
75
  }
47
76
 
48
- # Pré tratamento
77
+ # Preprocessing
49
78
  result['is_found'] = False
50
79
  result['number_occurrences'] = 0
51
80
 
52
- # Processo
81
+ # Process
53
82
  try:
54
83
  if search_by == 'word':
55
84
  origin_words = origin_text.split()
@@ -61,7 +90,7 @@ def search_in(
61
90
  searched_word = searched_word.lower()
62
91
  result['is_found'] = searched_word in words_lowercase
63
92
  except Exception as e:
64
- return error_print(f'Não foi possivel concluir a busca de: {searched_word}. Erro: {str(e)}')
93
+ return error_print(f'Unable to complete the search: {searched_word}. Error: {str(e)}')
65
94
 
66
95
  elif search_by == 'string':
67
96
  try:
@@ -72,7 +101,7 @@ def search_in(
72
101
  searched_word_lower: str = searched_word.lower()
73
102
  result['is_found'] = origin_text_lower.__contains__(searched_word_lower)
74
103
  except Exception as e:
75
- return error_print(f'Não foi possivel concluir a busca de: {searched_word}. Erro: {str(e)}')
104
+ return error_print(f'Unable to complete the search: {searched_word}. Error: {str(e)}')
76
105
 
77
106
  elif search_by == 'regex':
78
107
  pass
@@ -82,15 +111,15 @@ def search_in(
82
111
  else:
83
112
  print(f'metodo para buscar sem sensitive...')
84
113
  except Exception as e:
85
- return print(f'Não foi possivel concluir a busca de: {searched_word}. Erro: {str(e)}')"""
114
+ return print(f'Não foi possivel concluir a busca de: {searched_word}. Error: {str(e)}')"""
86
115
 
87
116
  except Exception as e:
88
- return error_print(f'Não foi possivel realizar a busca por: {searched_word}. Erro: {str(e)}')
117
+ return error_print(f'Unable to search for: {searched_word}. Error: {str(e)}')
89
118
 
90
- # Pós tratamento
119
+ # Postprocessing
91
120
  if result['is_found']:
92
- success_print(f'Função: {search_in.__name__} encontrou: {result["number_occurrences"]} ocorrências para "{searched_word}".')
121
+ success_print(f'Function: {search_in.__name__} found: {result["number_occurrences"]} occurrences for "{searched_word}".')
93
122
  else:
94
- success_print(f'Função: {search_in.__name__} não encontrou ocorrências de "{searched_word}" durante a busca.')
123
+ success_print(f'Function: {search_in.__name__} found no occurrences of "{searched_word}" during the search.')
95
124
 
96
125
  return result
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rpa-suite
3
- Version: 0.8.1
3
+ Version: 0.8.2
4
4
  Summary: Conjunto de ferramentas essenciais para 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
7
7
  License: MIT
8
- Keywords: basic-tools,email-tools,email-validation,file-tools,simple-functions,rpa-tools,rpa-functions
8
+ Keywords: basic-tools,email-tools,email-validation,file-tools,simple-functions,rpa-tools,rpa-functions,RPA,Automação,Python,Ferramentas de RPA,Automação de Processos,Biblioteca Python para RPA
9
9
  Classifier: Development Status :: 3 - Alpha
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Programming Language :: Python :: 3
@@ -18,7 +18,7 @@ Requires-Dist: loguru
18
18
  Requires-Dist: colorama
19
19
  Requires-Dist: email-validator
20
20
 
21
- ![RPA Suite](https://raw.githubusercontent.com/CamiloCCarvalho/rpa_suite/ca3820365ae7658ea8a2e801070f4f3b955b3ea6/logo-rpa-suite.svg)
21
+ ![RPA Suite](https://raw.githubusercontent.com/CamiloCCarvalho/rpa_suite/3e1ccd0acad654916466f03c2b8f166dc8d360d4/logo-rpa-suite.svg)
22
22
 
23
23
 
24
24
  <h1 align="left">
@@ -32,7 +32,7 @@ Requires-Dist: email-validator
32
32
  -----------------
33
33
 
34
34
  ## O que é?
35
- **RPA Suite:** um conjunto abrangente de ferramentas projetadas para simplificar e otimizar o desenvolvimento de projetos de automação RPA. Embora nossa suíte seja especializada em RPA, sua versatilidade a torna igualmente útil para uma ampla gama de projetos de desenvolvimento. Experimente a RPA Suite e descubra como podemos facilitar seu próximo projeto.
35
+ **RPA Suite:** um conjunto abrangente de ferramentas projetadas para simplificar e otimizar o desenvolvimento de projetos de automação RPA com Python. Embora nossa suíte seja um conjunto de Ferramentas de RPA especializado, sua versatilidade a torna igualmente útil para uma ampla gama de projetos de desenvolvimento. Esta desenvolvendo com Selenium, Botcity ou Playwright? Experimente a RPA Suite e descubra como podemos facilitar seu projeto, ou qualquer projeto de Robôs de Software.
36
36
 
37
37
  ## Sumário do conteudo
38
38
 
@@ -47,13 +47,13 @@ Requires-Dist: email-validator
47
47
 
48
48
  ## Destaque
49
49
 
50
- **Versátil**: Embora tenha sido criado com foco no desenvolvimento de BOTs em RPA, as ferramentas são de uso geral e podem ser aplicadas em outros tipos de projetos, *além do RPA*.
50
+ **Versátil**: Além da Automação de Processos e criação de BOT em RPA, mas também para uso geral podendo ser aplicadas em outros modelos de projeto, *além do RPA*.
51
51
 
52
52
  **Simples**: Construímos as ferramentas de maneira mais direta e assertiva possível, utilizando apenas bibliotecas conhecidas no mercado para garantir o melhor desempenho possível.
53
53
 
54
54
  ## Objetivo
55
55
 
56
- Nosso objetivo é tornar o desenvolvimento de RPAs mais produtivo, oferecendo funções prontas para usos comuns, como:
56
+ Nosso objetivo é se tornar a Biblioteca Python para RPA referência. Tornando o desenvolvimento de RPAs mais produtivo, oferecendo uma gama de funções para tal:
57
57
 
58
58
  - Envio de emails (já configurado e personalizavel)
59
59
  - Validação de emails (limpeza e tratamento)
@@ -116,7 +116,8 @@ No setup do nosso projeto já estão inclusas as dependências, só será necess
116
116
  O módulo principal do rpa-suite é dividido em categorias. Cada categoria contém módulos com funções destinadas a cada tipo de tarefa
117
117
  - **rpa_suite**
118
118
  - **clock**
119
- - **waiter** - Funções para aguardar execução
119
+ - **waiter** - Funções para aguardar em relação a execução de uma função, podendo ser antes ou depois
120
+ - **exec_at** - Funções para executar em momentos pré determinados
120
121
  - **date**
121
122
  - **date** - Funções para capturar data, mes, ano, hora, minutos de forma individual em apenas uma linha
122
123
  - **email**
@@ -134,9 +135,9 @@ O módulo principal do rpa-suite é dividido em categorias. Cada categoria cont
134
135
  - **string_validator** - Funções para validação/varredura (strings, substrings, palavras)
135
136
 
136
137
  ## Release
137
- Versão: **Alpha 0.8.1**
138
+ Versão: **Alpha 0.8.2**
138
139
 
139
- Lançamento: *04/12/2023*
140
+ Lançamento: *05/12/2023*
140
141
 
141
142
  Status: Em desenvolvimento.
142
143
 
@@ -0,0 +1,23 @@
1
+ rpa_suite/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ rpa_suite/suite.py,sha256=HVCk50YoVsx4knFKGg5G7YZV5RAwi29P-2gy9dray-I,3011
3
+ rpa_suite/clock/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ rpa_suite/clock/exec_at.py,sha256=Se10YYKLHjYsqMHuxdxwY6YoB4Aqri1kAnbMGAf6BjM,5376
5
+ rpa_suite/clock/waiter.py,sha256=ogFTQkBNGAB_K013155PtySXpuMszTsrrTz0p56Yaxg,5878
6
+ rpa_suite/date/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ rpa_suite/date/date.py,sha256=0-YsoCTnMY9NdVV8oZBEZ8AtpkE21cwqi7WjZhhN6fg,4133
8
+ rpa_suite/email/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ rpa_suite/email/sender_smtp.py,sha256=S7Far3fewuFRVPMWYPTIJSPRq89AZVbu2odX9a0QmZQ,6708
10
+ rpa_suite/file/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ rpa_suite/file/counter.py,sha256=MVyt7I-r23S5znHFk2Z4UbgoX0kD04YFsl4V5GOYcDU,2485
12
+ rpa_suite/file/temp_dir.py,sha256=Al1j2654fIDgqTZvuBSo1WcjCVg-xbN_K-z-jnuzxGg,5904
13
+ rpa_suite/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ rpa_suite/log/loggin.py,sha256=sJCkKXZPsjhLJz7gKAmLQuMcvQkefvBlVl3nlhxVUXA,1343
15
+ rpa_suite/log/printer.py,sha256=P3chs13qBnd7tvZEJSCQ39Kj8wZ2BmYNHOTJm3Unf6M,4073
16
+ rpa_suite/validate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
+ rpa_suite/validate/mail_validator.py,sha256=PEa_-bON7BYnpaz-p5aEZkpza7qsoBBFKv6GwsjdjCU,2906
18
+ rpa_suite/validate/string_validator.py,sha256=7eJVTCmzVwgM513NqAAjqvo9iqHmsWQ-6LQ8-oOh_0s,5344
19
+ rpa_suite-0.8.2.dist-info/LICENSE,sha256=5D8PIbs31iGd9i1_MDNg4SzaQnp9sEIULALh2y3WyMI,1102
20
+ rpa_suite-0.8.2.dist-info/METADATA,sha256=JUXRa-BLFoGWSZQb4nppF9jwy2TtLhKyFXHV0pU4EQw,5994
21
+ rpa_suite-0.8.2.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
22
+ rpa_suite-0.8.2.dist-info/top_level.txt,sha256=HYkDtg-kJNAr3F2XAIPyJ-QBbNhk7q6jrqsFt10lz4Y,10
23
+ rpa_suite-0.8.2.dist-info/RECORD,,
@@ -1,64 +0,0 @@
1
- import re
2
- from typing import Callable, Any
3
- from rpa_suite.date.date import get_hms
4
- from rpa_suite.log.printer import error_print, success_print
5
-
6
- def exec_wtime(
7
- while_time: int,
8
- fn_to_exec: Callable[..., Any],
9
- *args,
10
- **kwargs
11
- ) -> dict:
12
-
13
- """
14
- Função temporizada, executa uma função enquanto o tempo (em segundos) da condição não foi atendido.
15
-
16
- Parametros:
17
- ----------
18
- `while_time: int` - (segundos) representa o tempo que deve persistir a execução da função passada no argumento ``fn_to_exec``
19
-
20
- ``fn_to_exec: function`` - (função) a ser chamada (repetidas vezes) durante o temporizador, se houver parametros nessa função podem ser passados como próximos argumentos desta função em ``*args`` e ``**kwargs``
21
-
22
- Retorno:
23
- ----------
24
- >>> type:dict
25
- * 'success': bool - representa se ação foi realizada com sucesso
26
-
27
- Exemplo:
28
- ---------
29
- Temos uma função de soma no seguinte formato ``soma(a, b) -> return x``, onde ``x`` é o resultado da soma. Supondo que temos o valor de `a` mas não de `b` podemos executar a função por um tempo `y` até obtermos valor de `b` para saber o resultado da soma:
30
- >>> exec_wtime(60, soma, a, b) -> x \n
31
- * OBS.: `exec_wtime` recebe como primeiro argumento o tempo a aguardar (seg), depois a função `soma` e por fim os argumentos que a função ira usar.
32
- """
33
-
34
- # Variáveis locais
35
- result: dict = {
36
- 'success': bool
37
- }
38
- run: bool
39
- timmer: int
40
-
41
- # Pré Tratamento
42
- timmer = while_time
43
-
44
- # Processo
45
- try:
46
- run = True
47
- hour, minute, second = get_hms()
48
- while run and timmer > 0:
49
- fn_to_exec(*args, **kwargs)
50
- hour_now, minute_now, second_now = get_hms()
51
- if second_now != second:
52
- second = second_now
53
- timmer =- 1
54
- if timmer <= 0:
55
- run = False
56
- break
57
- result['success'] = True
58
- success_print(f'Função {fn_to_exec.__name__} foi executada durante: {while_time} seg(s).')
59
-
60
- except Exception as e:
61
- result['success'] = False
62
- error_print(f'Ocorreu algum erro que impediu a execução da função: {exec_wtime.__name__} corretamente. Erro: {str(e)}')
63
-
64
- return result
@@ -1,23 +0,0 @@
1
- rpa_suite/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- rpa_suite/suite.py,sha256=QvPL_2bWW-XcbfstLZREXZAqT32aM-SD38x7jxpvyfs,2152
3
- rpa_suite/clock/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- rpa_suite/clock/exec_while.py,sha256=FjgpXZ4Dkzy5EEQPudVKt5aaYFTLEDQJRSqnNvNnbR0,2486
5
- rpa_suite/clock/waiter.py,sha256=z_5_QLYYztUo5-nbLp465OsY_lk6mR4z9-u6qNzDosM,3704
6
- rpa_suite/date/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- rpa_suite/date/date.py,sha256=Kwowe997R0ml70M78zafgXrwwXiRqdhUATyHduTF8R0,2828
8
- rpa_suite/email/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- rpa_suite/email/sender_smtp.py,sha256=Nn61OFP3-0LoiQ9DgkQYrJpIWFIxbPI6ua0ER7UHTWk,5253
10
- rpa_suite/file/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- rpa_suite/file/counter.py,sha256=yx_ecoJkc3zxVF4UgYUI2tua4ziW0jYe6vFxTyIfnOw,1745
12
- rpa_suite/file/temp_dir.py,sha256=oZmfpC6utUcpaUnQI8j16NcgFDISmp5f5yXAwTevntY,4578
13
- rpa_suite/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- rpa_suite/log/loggin.py,sha256=3f7JdA2zp6mTperx406zbud8v0miwhHLTkT2sxMy63M,872
15
- rpa_suite/log/printer.py,sha256=yzFO6MBgbsbaFzEnq9l0PcUTgb9fjQiPMAYDV20lhEA,2805
16
- rpa_suite/validate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- rpa_suite/validate/mail_validator.py,sha256=9Ezyf8iopKsYQpNFK6hVs4REzR9wGGXRKGnrRXxV8Hw,2166
18
- rpa_suite/validate/string_validator.py,sha256=wvgh9ZRl6P62W-kNII3heKXhbYaZUoIOOnWkOFO1PH0,4052
19
- rpa_suite-0.8.1.dist-info/LICENSE,sha256=5D8PIbs31iGd9i1_MDNg4SzaQnp9sEIULALh2y3WyMI,1102
20
- rpa_suite-0.8.1.dist-info/METADATA,sha256=rzZgk3TUp-6cx5l22R636uKGpIvOC1WPuScVYElhLhU,5601
21
- rpa_suite-0.8.1.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
22
- rpa_suite-0.8.1.dist-info/top_level.txt,sha256=HYkDtg-kJNAr3F2XAIPyJ-QBbNhk7q6jrqsFt10lz4Y,10
23
- rpa_suite-0.8.1.dist-info/RECORD,,