rpa-suite 1.5.8__py3-none-any.whl → 1.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rpa_suite/__init__.py +7 -1
- rpa_suite/core/__init__.py +2 -5
- rpa_suite/core/asyncrun.py +1 -1
- rpa_suite/core/browser.py +18 -33
- rpa_suite/core/clock.py +12 -26
- rpa_suite/core/date.py +4 -4
- rpa_suite/core/dir.py +17 -21
- rpa_suite/core/email.py +9 -18
- rpa_suite/core/file.py +16 -23
- rpa_suite/core/iris.py +327 -0
- rpa_suite/core/log.py +16 -20
- rpa_suite/core/parallel.py +8 -22
- rpa_suite/core/print.py +4 -10
- rpa_suite/core/regex.py +3 -3
- rpa_suite/core/validate.py +8 -18
- rpa_suite/functions/__create_ss_dir.py +2 -6
- rpa_suite/functions/__init__.py +1 -1
- rpa_suite/suite.py +31 -19
- rpa_suite/utils/__init__.py +1 -1
- rpa_suite/utils/system.py +16 -17
- {rpa_suite-1.5.8.dist-info → rpa_suite-1.6.0.dist-info}/METADATA +28 -12
- rpa_suite-1.6.0.dist-info/RECORD +26 -0
- rpa_suite-1.5.8.dist-info/RECORD +0 -25
- {rpa_suite-1.5.8.dist-info → rpa_suite-1.6.0.dist-info}/WHEEL +0 -0
- {rpa_suite-1.5.8.dist-info → rpa_suite-1.6.0.dist-info}/licenses/LICENSE +0 -0
- {rpa_suite-1.5.8.dist-info → rpa_suite-1.6.0.dist-info}/top_level.txt +0 -0
rpa_suite/__init__.py
CHANGED
@@ -27,7 +27,10 @@ Available modules:
|
|
27
27
|
``printer``: Functions for formatted output
|
28
28
|
``regex``: Operations with regular expressions
|
29
29
|
``validate``: Data validation functions
|
30
|
+
``ParallelRunner``: Object ParallelRunner functions to run in parallel
|
31
|
+
``AsyncRunner``: Object AsyncRunner functions to run in Assyncronous
|
30
32
|
``Browser``: Object Browser automation functions (neeeds Selenium and Webdriver_Manager)
|
33
|
+
``Iris``: Object Iris automation functions to convert documents with OCR + IA based on ``docling``
|
31
34
|
|
32
35
|
pt-br
|
33
36
|
-----
|
@@ -57,10 +60,13 @@ Módulos disponíveis:
|
|
57
60
|
``printer``: Funções para output formatado
|
58
61
|
``regex``: Operações com expressões regulares
|
59
62
|
``validate``: Funções de validação de dados
|
63
|
+
``ParallelRunner``: Objeto ParallelRunner funções para rodar processos em paralelo
|
64
|
+
``AsyncRunner``: Objeto AsyncRunner funções para rodar processos em assincronicidade
|
60
65
|
``Browser``: Objeto de Automação de Navegadores (necessario Selenium e Webdriver_Manager)
|
66
|
+
``Iris``: Objeto Iris Automação de funções para converter documentos com OCR + IA baseado em ``docling``
|
61
67
|
"""
|
62
68
|
|
63
|
-
__version__ =
|
69
|
+
__version__ = "1.5.9"
|
64
70
|
|
65
71
|
# allows importing the rpa_suite module without the package name
|
66
72
|
from .suite import rpa
|
rpa_suite/core/__init__.py
CHANGED
@@ -41,11 +41,8 @@ from .asyncrun import AsyncRunner
|
|
41
41
|
import importlib.util
|
42
42
|
|
43
43
|
# from .browser import Browser
|
44
|
-
if importlib.util.find_spec("selenium") and importlib.util.find_spec(
|
45
|
-
"webdriver_manager"
|
46
|
-
):
|
44
|
+
if importlib.util.find_spec("selenium") and importlib.util.find_spec("webdriver_manager"):
|
47
45
|
from .browser import Browser
|
48
46
|
|
49
47
|
|
50
|
-
__version__ =
|
51
|
-
|
48
|
+
__version__ = "1.5.5"
|
rpa_suite/core/asyncrun.py
CHANGED
rpa_suite/core/browser.py
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
# rpa_suite/core/browser.py
|
2
2
|
|
3
|
-
# imports
|
4
|
-
from
|
3
|
+
# imports standard
|
4
|
+
from time import sleep
|
5
|
+
import os
|
6
|
+
import requests
|
5
7
|
|
6
|
-
# imports
|
8
|
+
# imports third party
|
7
9
|
from selenium import webdriver
|
8
10
|
from selenium.webdriver.common.by import By
|
9
11
|
from selenium.webdriver.chrome.options import Options
|
@@ -11,9 +13,8 @@ from selenium.webdriver.support.ui import WebDriverWait
|
|
11
13
|
from selenium.webdriver.support import expected_conditions as EC
|
12
14
|
from webdriver_manager.chrome import ChromeDriverManager
|
13
15
|
|
14
|
-
# imports
|
15
|
-
from
|
16
|
-
import os, requests
|
16
|
+
# imports internal
|
17
|
+
from rpa_suite.functions._printer import error_print, alert_print, success_print
|
17
18
|
|
18
19
|
|
19
20
|
class Browser:
|
@@ -107,9 +108,7 @@ class Browser:
|
|
107
108
|
# Use the absolute path from comment
|
108
109
|
|
109
110
|
options = Options()
|
110
|
-
options.add_experimental_option(
|
111
|
-
"debuggerAddress", f"127.0.0.1:{str(self.port)}"
|
112
|
-
)
|
111
|
+
options.add_experimental_option("debuggerAddress", f"127.0.0.1:{str(self.port)}")
|
113
112
|
|
114
113
|
# Additional configs
|
115
114
|
options.add_argument("--start-maximized")
|
@@ -117,9 +116,7 @@ class Browser:
|
|
117
116
|
|
118
117
|
# Verifica se o caminho do driver está correto
|
119
118
|
if not os.path.exists(self.path_driver):
|
120
|
-
raise FileNotFoundError(
|
121
|
-
f"O caminho do driver não foi encontrado: {self.path_driver}"
|
122
|
-
)
|
119
|
+
raise FileNotFoundError(f"O caminho do driver não foi encontrado: {self.path_driver}")
|
123
120
|
|
124
121
|
# Create driver with options and chromedriver path
|
125
122
|
self.driver = webdriver.Chrome(
|
@@ -129,13 +126,9 @@ class Browser:
|
|
129
126
|
)
|
130
127
|
|
131
128
|
except Exception as e:
|
132
|
-
error_print(
|
133
|
-
f"Erro durante a função: {self.configure_browser.__name__}! Error: {str(e)}."
|
134
|
-
)
|
129
|
+
error_print(f"Erro durante a função: {self.configure_browser.__name__}! Error: {str(e)}.")
|
135
130
|
|
136
|
-
def start_browser(
|
137
|
-
self, close_chrome_on_this_port: bool = True, display_message: bool = False
|
138
|
-
):
|
131
|
+
def start_browser(self, close_chrome_on_this_port: bool = True, display_message: bool = False):
|
139
132
|
"""
|
140
133
|
Starts a Chrome browser instance with remote debugging enabled.
|
141
134
|
Args:
|
@@ -200,17 +193,13 @@ class Browser:
|
|
200
193
|
|
201
194
|
try:
|
202
195
|
sleep(0.9)
|
203
|
-
element = WebDriverWait(self.driver, timeout).until(
|
204
|
-
EC.presence_of_element_located((by, value))
|
205
|
-
)
|
196
|
+
element = WebDriverWait(self.driver, timeout).until(EC.presence_of_element_located((by, value)))
|
206
197
|
return element
|
207
198
|
|
208
199
|
except Exception as e:
|
209
200
|
|
210
201
|
if display_message:
|
211
|
-
error_print(
|
212
|
-
f"Erro durante a função: {self.find_ele.__name__}! Error: {str(e)}."
|
213
|
-
)
|
202
|
+
error_print(f"Erro durante a função: {self.find_ele.__name__}! Error: {str(e)}.")
|
214
203
|
return None
|
215
204
|
else:
|
216
205
|
return None
|
@@ -303,29 +292,25 @@ class Browser:
|
|
303
292
|
f'taskkill /f /im chrome.exe /fi "commandline like *--remote-debugging-port={str(self.port)}*" /t >nul 2>&1'
|
304
293
|
)
|
305
294
|
if display_message:
|
306
|
-
alert_print(
|
295
|
+
alert_print("Browser: Fechado via força!")
|
307
296
|
|
308
297
|
else:
|
309
298
|
if display_message:
|
310
|
-
success_print(
|
299
|
+
success_print("Browser: Fechado com sucesso!")
|
311
300
|
|
312
301
|
except Exception as e:
|
313
302
|
|
314
303
|
try:
|
315
304
|
if display_message:
|
316
|
-
alert_print(
|
317
|
-
f"Erro ao fechar navegador: {str(e)}, Tentando meio mais forte!"
|
318
|
-
)
|
305
|
+
alert_print(f"Erro ao fechar navegador: {str(e)}, Tentando meio mais forte!")
|
319
306
|
|
320
307
|
# Último recurso - mata todos os processos do Chrome (use com cautela)
|
321
308
|
os.system(
|
322
309
|
f'taskkill /f /im chrome.exe /fi "commandline like *--remote-debugging-port={str(self.port)}*" /t >nul 2>&1'
|
323
310
|
)
|
324
311
|
if display_message:
|
325
|
-
alert_print(
|
312
|
+
alert_print("Browser: Fechado via força extrema!")
|
326
313
|
|
327
314
|
except Exception as error_ultimate:
|
328
315
|
if display_message:
|
329
|
-
error_print(
|
330
|
-
f"Falha crítica ao tentar fechar o navegador! Error: {str(error_ultimate)}!"
|
331
|
-
)
|
316
|
+
error_print(f"Falha crítica ao tentar fechar o navegador! Error: {str(error_ultimate)}!")
|
rpa_suite/core/clock.py
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# rpa_suite/core/clock.py
|
2
2
|
|
3
|
-
# imports
|
4
|
-
from rpa_suite.functions._printer import error_print, success_print
|
5
|
-
|
6
|
-
# imports third-party
|
3
|
+
# imports standard
|
7
4
|
import time
|
8
5
|
from typing import Callable, Any
|
9
6
|
from datetime import datetime as dt
|
10
7
|
|
8
|
+
# imports internal
|
9
|
+
from rpa_suite.functions._printer import error_print, success_print
|
10
|
+
|
11
11
|
|
12
12
|
class Clock:
|
13
13
|
"""
|
@@ -111,7 +111,7 @@ class Clock:
|
|
111
111
|
minutes = str(now.minute) if now.minute >= 10 else f"0{now.minute}"
|
112
112
|
moment_now = f"{hours}:{minutes}"
|
113
113
|
|
114
|
-
if hour_to_exec
|
114
|
+
if hour_to_exec is None:
|
115
115
|
|
116
116
|
# Process
|
117
117
|
while run:
|
@@ -140,9 +140,7 @@ class Clock:
|
|
140
140
|
run = False
|
141
141
|
result["tried"] = not run
|
142
142
|
result["success"] = True
|
143
|
-
success_print(
|
144
|
-
f"{fn_to_exec.__name__}: Successfully executed!"
|
145
|
-
)
|
143
|
+
success_print(f"{fn_to_exec.__name__}: Successfully executed!")
|
146
144
|
break
|
147
145
|
|
148
146
|
except Exception as e:
|
@@ -157,9 +155,7 @@ class Clock:
|
|
157
155
|
time.sleep(30)
|
158
156
|
now = dt.now()
|
159
157
|
hours = str(now.hour) if now.hour >= 10 else f"0{now.hour}"
|
160
|
-
minutes = (
|
161
|
-
str(now.minute) if now.minute >= 10 else f"0{now.minute}"
|
162
|
-
)
|
158
|
+
minutes = str(now.minute) if now.minute >= 10 else f"0{now.minute}"
|
163
159
|
moment_now = f"{hours}:{minutes}"
|
164
160
|
|
165
161
|
return result
|
@@ -167,14 +163,10 @@ class Clock:
|
|
167
163
|
except Exception as e:
|
168
164
|
|
169
165
|
result["success"] = False
|
170
|
-
error_print(
|
171
|
-
f"An error occurred on function from executing: {self.exec_at_hour.__name__}. Error: {str(e)}"
|
172
|
-
)
|
166
|
+
error_print(f"An error occurred on function from executing: {self.exec_at_hour.__name__}. Error: {str(e)}")
|
173
167
|
return result
|
174
168
|
|
175
|
-
def wait_for_exec(
|
176
|
-
self, wait_time: int, fn_to_exec: Callable[..., Any], *args, **kwargs
|
177
|
-
) -> dict[str, bool]:
|
169
|
+
def wait_for_exec(self, wait_time: int, fn_to_exec: Callable[..., Any], *args, **kwargs) -> dict[str, bool]:
|
178
170
|
"""
|
179
171
|
Timer function, wait for a value in ``seconds`` to execute the function of the argument.
|
180
172
|
|
@@ -226,9 +218,7 @@ class Clock:
|
|
226
218
|
time.sleep(wait_time)
|
227
219
|
fn_to_exec(*args, **kwargs)
|
228
220
|
result["success"] = True
|
229
|
-
success_print(
|
230
|
-
f"Function: {self.wait_for_exec.__name__} executed the function: {fn_to_exec.__name__}."
|
231
|
-
)
|
221
|
+
success_print(f"Function: {self.wait_for_exec.__name__} executed the function: {fn_to_exec.__name__}.")
|
232
222
|
|
233
223
|
except Exception as e:
|
234
224
|
result["success"] = False
|
@@ -238,9 +228,7 @@ class Clock:
|
|
238
228
|
|
239
229
|
return result
|
240
230
|
|
241
|
-
def exec_and_wait(
|
242
|
-
self, wait_time: int, fn_to_exec: Callable[..., Any], *args, **kwargs
|
243
|
-
) -> dict[str, bool]:
|
231
|
+
def exec_and_wait(self, wait_time: int, fn_to_exec: Callable[..., Any], *args, **kwargs) -> dict[str, bool]:
|
244
232
|
"""
|
245
233
|
Timer function, executes a function and waits for the time in ``seconds``
|
246
234
|
|
@@ -292,9 +280,7 @@ class Clock:
|
|
292
280
|
fn_to_exec(*args, **kwargs)
|
293
281
|
time.sleep(wait_time)
|
294
282
|
result["success"] = True
|
295
|
-
success_print(
|
296
|
-
f"Function: {self.wait_for_exec.__name__} executed the function: {fn_to_exec.__name__}."
|
297
|
-
)
|
283
|
+
success_print(f"Function: {self.wait_for_exec.__name__} executed the function: {fn_to_exec.__name__}.")
|
298
284
|
|
299
285
|
except Exception as e:
|
300
286
|
result["success"] = False
|
rpa_suite/core/date.py
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# rpa_suite/core/date.py
|
2
2
|
|
3
|
-
# imports
|
4
|
-
from rpa_suite.functions._printer import error_print
|
5
|
-
|
6
|
-
# imports third-party
|
3
|
+
# imports standard
|
7
4
|
import datetime as dt
|
8
5
|
from typing import Optional as Op
|
9
6
|
from typing import Tuple
|
10
7
|
|
8
|
+
# imports internal
|
9
|
+
from rpa_suite.functions._printer import error_print
|
10
|
+
|
11
11
|
|
12
12
|
class Date:
|
13
13
|
"""
|
rpa_suite/core/dir.py
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
# rpa_suite/core/dir.py
|
2
2
|
|
3
|
+
# imports standard
|
4
|
+
import os
|
5
|
+
import shutil
|
6
|
+
from typing import Union
|
7
|
+
|
3
8
|
# imports internal
|
4
9
|
from rpa_suite.functions._printer import error_print, alert_print, success_print
|
5
10
|
|
6
|
-
# imports third-party
|
7
|
-
import os, shutil
|
8
|
-
from typing import Union
|
9
|
-
|
10
11
|
|
11
12
|
class Directory:
|
12
13
|
"""
|
@@ -51,7 +52,12 @@ class Directory:
|
|
51
52
|
name_temp_dir (str): O nome do diretório temporário a ser criado. O padrão é 'temp'.
|
52
53
|
"""
|
53
54
|
|
54
|
-
def __init__(self):
|
55
|
+
def __init__(self):
|
56
|
+
"""
|
57
|
+
Função construtora da Classe que fornece utilitários para gerenciamento de:\n
|
58
|
+
diretórios, incluindo criação, exclusão e manipulação de diretórios.
|
59
|
+
"""
|
60
|
+
...
|
55
61
|
|
56
62
|
def create_temp_dir(
|
57
63
|
self,
|
@@ -130,19 +136,14 @@ class Directory:
|
|
130
136
|
except PermissionError:
|
131
137
|
result["success"] = False
|
132
138
|
result["path_created"] = None
|
133
|
-
alert_print(
|
134
|
-
f"Permission denied: Not possible to create Directory '{full_path}'."
|
135
|
-
)
|
139
|
+
alert_print(f"Permission denied: Not possible to create Directory '{full_path}'.")
|
136
140
|
|
137
141
|
except Exception as e:
|
138
142
|
result["success"] = False
|
139
143
|
result["path_created"] = None
|
140
|
-
error_print(
|
141
|
-
f"Error capturing current path to create temporary directory! Error: {str(e)}"
|
142
|
-
)
|
144
|
+
error_print(f"Error capturing current path to create temporary directory! Error: {str(e)}")
|
143
145
|
|
144
|
-
|
145
|
-
return result
|
146
|
+
return result
|
146
147
|
|
147
148
|
def delete_temp_dir(
|
148
149
|
self,
|
@@ -230,16 +231,11 @@ class Directory:
|
|
230
231
|
except PermissionError:
|
231
232
|
result["success"] = False
|
232
233
|
result["path_deleted"] = None
|
233
|
-
alert_print(
|
234
|
-
f"Permission denied: Not possible to delete Directory '{full_path}'."
|
235
|
-
)
|
234
|
+
alert_print(f"Permission denied: Not possible to delete Directory '{full_path}'.")
|
236
235
|
|
237
236
|
except Exception as e:
|
238
237
|
result["success"] = False
|
239
238
|
result["path_deleted"] = None
|
240
|
-
error_print(
|
241
|
-
f"Error capturing current path to delete temporary directory! Error: {str(e)}"
|
242
|
-
)
|
239
|
+
error_print(f"Error capturing current path to delete temporary directory! Error: {str(e)}.")
|
243
240
|
|
244
|
-
|
245
|
-
return result
|
241
|
+
return result
|
rpa_suite/core/email.py
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# rpa_suite/core/email.py
|
2
2
|
|
3
|
-
# imports
|
4
|
-
|
5
|
-
|
6
|
-
# imports third-party
|
3
|
+
# imports standard
|
4
|
+
import os
|
7
5
|
import smtplib
|
8
|
-
from email.mime.image import MIMEImage
|
9
6
|
from email.mime.multipart import MIMEMultipart
|
10
7
|
from email.mime.text import MIMEText
|
11
8
|
from email.mime.base import MIMEBase
|
12
9
|
from email import encoders
|
13
10
|
|
11
|
+
# imports internal
|
12
|
+
from rpa_suite.functions._printer import alert_print, error_print, success_print
|
13
|
+
|
14
14
|
|
15
15
|
class Email:
|
16
16
|
"""
|
@@ -117,7 +117,8 @@ class Email:
|
|
117
117
|
Default: '<p>test message</p>'.
|
118
118
|
|
119
119
|
Returns:
|
120
|
-
None: This function does not explicitly return any value
|
120
|
+
None: This function does not explicitly return any value,\n
|
121
|
+
but prints success or failure messages when sending the email.
|
121
122
|
|
122
123
|
pt-br
|
123
124
|
------
|
@@ -160,11 +161,7 @@ class Email:
|
|
160
161
|
# Criando a mensagem
|
161
162
|
msg = MIMEMultipart()
|
162
163
|
msg["From"] = self.email_user
|
163
|
-
msg["To"] = (
|
164
|
-
", ".join(self.email_to)
|
165
|
-
if isinstance(self.email_to, list)
|
166
|
-
else self.email_to
|
167
|
-
)
|
164
|
+
msg["To"] = ", ".join(self.email_to) if isinstance(self.email_to, list) else self.email_to
|
168
165
|
msg["Subject"] = str(self.subject_title)
|
169
166
|
|
170
167
|
# Corpo do e-mail
|
@@ -173,10 +170,6 @@ class Email:
|
|
173
170
|
|
174
171
|
# Anexos (opcional)
|
175
172
|
if self.attachments:
|
176
|
-
from email.mime.base import MIMEBase
|
177
|
-
from email import encoders
|
178
|
-
import os
|
179
|
-
|
180
173
|
for attachment_path in self.attachments:
|
181
174
|
try:
|
182
175
|
with open(attachment_path, "rb") as attachment:
|
@@ -190,9 +183,7 @@ class Email:
|
|
190
183
|
msg.attach(part)
|
191
184
|
|
192
185
|
except Exception as e:
|
193
|
-
error_print(
|
194
|
-
f"Erro ao anexar o arquivo {attachment_path}: {str(e)}"
|
195
|
-
)
|
186
|
+
error_print(f"Erro ao anexar o arquivo {attachment_path}: {str(e)}")
|
196
187
|
|
197
188
|
try:
|
198
189
|
if self.auth_tls:
|
rpa_suite/core/file.py
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
# rpa_suite/core/file.py
|
2
2
|
|
3
|
-
# imports
|
4
|
-
from rpa_suite.functions._printer import error_print, success_print, alert_print
|
5
|
-
from rpa_suite.functions.__create_ss_dir import __create_ss_dir as create_ss_dir
|
6
|
-
|
7
|
-
# imports external
|
8
|
-
from colorama import Fore
|
9
|
-
|
10
|
-
# imports third-party
|
3
|
+
# imports standard
|
11
4
|
import os, time
|
12
5
|
from datetime import datetime
|
13
6
|
from typing import Dict, List, Union
|
14
7
|
|
8
|
+
# imports third party
|
9
|
+
from colorama import Fore
|
10
|
+
|
11
|
+
# imports internal
|
12
|
+
from rpa_suite.functions._printer import error_print, success_print, alert_print
|
13
|
+
from rpa_suite.functions.__create_ss_dir import __create_ss_dir as create_ss_dir
|
14
|
+
|
15
15
|
|
16
16
|
class File:
|
17
17
|
"""
|
@@ -138,9 +138,7 @@ class File:
|
|
138
138
|
|
139
139
|
if save_with_date: # use date on file name
|
140
140
|
image = pyautogui.screenshot()
|
141
|
-
file_name = (
|
142
|
-
f'{file_name}_{datetime.today().strftime("%d_%m_%Y-%H_%M_%S")}.png'
|
143
|
-
)
|
141
|
+
file_name = f'{file_name}_{datetime.today().strftime("%d_%m_%Y-%H_%M_%S")}.png'
|
144
142
|
path_file_screenshoted = os.path.join(path_dir, file_name)
|
145
143
|
|
146
144
|
image.save(path_file_screenshoted)
|
@@ -164,9 +162,7 @@ class File:
|
|
164
162
|
|
165
163
|
except Exception as e:
|
166
164
|
|
167
|
-
error_print(
|
168
|
-
f"Error to execute function:{self.screen_shot.__name__}! Error: {str(e)}"
|
169
|
-
)
|
165
|
+
error_print(f"Error to execute function:{self.screen_shot.__name__}! Error: {str(e)}")
|
170
166
|
return None
|
171
167
|
|
172
168
|
def flag_create(
|
@@ -180,7 +176,7 @@ class File:
|
|
180
176
|
"""
|
181
177
|
|
182
178
|
try:
|
183
|
-
if path_to_create
|
179
|
+
if path_to_create is None:
|
184
180
|
path_origin: str = os.getcwd()
|
185
181
|
full_path_with_name = rf"{path_origin}/{name_file}"
|
186
182
|
else:
|
@@ -206,7 +202,7 @@ class File:
|
|
206
202
|
|
207
203
|
try:
|
208
204
|
|
209
|
-
if path_to_delete
|
205
|
+
if path_to_delete is None:
|
210
206
|
path_origin: str = os.getcwd()
|
211
207
|
full_path_with_name = rf"{path_origin}/{name_file}"
|
212
208
|
else:
|
@@ -264,21 +260,18 @@ class File:
|
|
264
260
|
|
265
261
|
# Process
|
266
262
|
try:
|
267
|
-
for
|
268
|
-
for _, _, files in os.walk(
|
263
|
+
for directory in dir_to_count:
|
264
|
+
for _, _, files in os.walk(directory):
|
269
265
|
for file in files:
|
270
266
|
if type_extension == "*" or file.endswith(f".{type_extension}"):
|
271
267
|
result["qt"] += 1
|
272
268
|
result["success"] = True
|
273
269
|
|
274
270
|
if display_message:
|
275
|
-
success_print(
|
276
|
-
f'Function: {self.count_files.__name__} counted {result["qt"]} files.'
|
277
|
-
)
|
271
|
+
success_print(f'Function: {self.count_files.__name__} counted {result["qt"]} files.')
|
278
272
|
|
279
273
|
except Exception as e:
|
280
274
|
result["success"] = False
|
281
275
|
error_print(f"Error when trying to count files! Error: {str(e)}")
|
282
276
|
|
283
|
-
|
284
|
-
return result
|
277
|
+
return result
|