rpa-suite 1.1.4__py3-none-any.whl → 1.1.6__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,83 @@
1
+ # /_create_ss_dir.py
2
+
3
+ import os
4
+ from typing import Union
5
+ from rpa_suite.log.printer import error_print, alert_print, success_print
6
+
7
+
8
+ def __create_ss_dir(path_to_create: str = 'default', name_ss_dir: str='screenshots') -> dict[str, Union[bool, str, None]]:
9
+
10
+ """
11
+ Function responsible for creating a screenshots directory to work with your screenshot files. \n
12
+
13
+ Parameters:
14
+ ----------
15
+ ``path_to_create: str`` - should be a string with the full path pointing to the folder where the screenshots 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.
16
+
17
+ ``name_ss_dir: str`` - should be a string representing the name of the logger directory to be created. If it is empty, the ``temp`` value will be used as the default directory name.
18
+
19
+ Return:
20
+ ----------
21
+ >>> type:dict
22
+ * 'success': bool - represents case the action was performed successfully
23
+ * 'path_created': str - path of the directory that was created on the process
24
+
25
+ Description: pt-br
26
+ ----------
27
+ Função responsavel por criar diretório de screenshots para trabalhar com seus arquivos de sreenshot. \n
28
+
29
+ Parametros:
30
+ ----------
31
+ ``path_to_create: str`` - deve ser uma string com o path completo apontando para a pasta onde deve ser criada a pasta temporaria, se estiver vazio sera usado valor ``default`` que criará pasta no diretório atual onde o arquivo contendo esta função foi chamada.
32
+
33
+ ``name_ss_dir: str`` - deve ser uma string representando o nome do diretório de screenshots a ser criado. Se estiver vazio, o valor ``screenshots`` será usado como o nome padrão do diretório.
34
+
35
+ Retorno:
36
+ ----------
37
+ >>> type:dict
38
+ * 'success': bool - representa se ação foi realizada com sucesso
39
+ * 'path_created': str - path do diretório que foi criado no processo
40
+ """
41
+
42
+ # Local Variables
43
+ result: dict = {
44
+ 'success': bool,
45
+ 'path_created': str,
46
+ }
47
+
48
+ try:
49
+ # by 'default', defines path to local script execution path
50
+ if path_to_create == 'default':
51
+ path_to_create: str = os.getcwd()
52
+
53
+ # Build path to new dir
54
+ full_path: str = os.path.join(path_to_create, name_ss_dir)
55
+
56
+ # Create dir in this block
57
+ try:
58
+
59
+ # Successefully created
60
+ os.makedirs(full_path, exist_ok=False)
61
+
62
+ result['success'] = True
63
+ result['path_created'] = fr'{full_path}'
64
+
65
+ success_print(f"Diretório:'{full_path}' foi criado com sucesso.")
66
+
67
+ except FileExistsError:
68
+ result['success'] = False
69
+ result['path_created'] = full_path
70
+ # alert_print(f"Diretório:'{full_path}' já existe.")
71
+
72
+ except PermissionError:
73
+ result['success'] = False
74
+ result['path_created'] = None
75
+ alert_print(f"Permissão negada: não é possível criar o diretório '{full_path}'.")
76
+
77
+ except Exception as e:
78
+ result['success'] = False
79
+ result['path_created'] = None
80
+ error_print(f'Error capturing current path to create screenshots directory! Error: {str(e)}')
81
+
82
+ finally:
83
+ return result
@@ -2,18 +2,13 @@
2
2
 
3
3
  import os, time
4
4
  from datetime import datetime
5
- from rpa_suite.log.printer import error_print
5
+ from rpa_suite.log.printer import error_print, success_print
6
+ from .__create_ss_dir import __create_ss_dir
6
7
 
7
8
 
8
- try:
9
- import pyautogui
10
- import pyscreeze
11
-
12
- except ImportError:
13
- raise ImportError(" The ‘pyautogui’, ‘Pillow’, and ‘PyScreeze’ libraries are necessary to use this module. Please install them with ‘pip install pyautogui pillow pyscreeze’.")
14
9
 
15
10
 
16
- def screen_shot(file_path: str, file_name: str = 'screenshot', save_with_date: bool = True, delay: int = 1) -> str | None:
11
+ def screen_shot(path_dir:str = None, file_name: str = 'screenshot', save_with_date: bool = True, delay: int = 1, use_default_path_and_name: bool = True, name_ss_dir:str = None) -> str | None:
17
12
 
18
13
  """
19
14
  Function responsible for create a dir for screenshot, and file screenshot and save this in dir to create, if dir exists save it on original dir. By default uses date on file name. \n
@@ -50,30 +45,41 @@ def screen_shot(file_path: str, file_name: str = 'screenshot', save_with_date: b
50
45
  # proccess
51
46
  try:
52
47
 
48
+ try:
49
+ import pyautogui
50
+ import pyscreeze
51
+
52
+ except ImportError:
53
+ raise ImportError(" The ‘pyautogui’ e ‘Pillow’ libraries are necessary to use this module. Please install them with ‘pip install pyautogui pillow.")
54
+
53
55
  time.sleep(delay)
54
- if not os.path.exists(file_path):
55
-
56
- # if dir not exists create it
57
- try:
58
- os.makedirs(file_path)
59
56
 
60
- except OSError as e:
61
- error_print(f"Falha ao criar o diretório em: '{file_path}'! Error: {str(e)}")
57
+ if not use_default_path_and_name:
58
+ result_tryed: dict = __create_ss_dir(path_dir, name_ss_dir)
59
+ path_dir = result_tryed['path_created']
60
+ else:
61
+ if path_dir == None and name_ss_dir == None:
62
+ result_tryed: dict = __create_ss_dir()
63
+ path_dir = result_tryed['path_created']
62
64
 
63
65
 
64
66
  if save_with_date: # use date on file name
65
67
  image = pyautogui.screenshot()
66
- path_file_screenshoted = fr'{file_path}/{file_name}_{datetime.today().strftime("%d_%m_%Y-%H_%M_%S")}.png'
67
-
68
+ file_name = f'{file_name}_{datetime.today().strftime("%d_%m_%Y-%H_%M_%S")}.png'
69
+ path_file_screenshoted = os.path.join(path_dir, file_name)
70
+
71
+ success_print(path_file_screenshoted)
72
+
68
73
  image.save(path_file_screenshoted)
69
- return os.path.abspath(path_file_screenshoted)
74
+ return path_file_screenshoted
70
75
 
71
76
  else: # not use date on file name
72
77
  image = pyautogui.screenshot()
73
- path_file_screenshoted = fr'{file_path}/{file_name}.png'
74
-
78
+ file_name = f'{file_name}.png'
79
+ path_file_screenshoted = os.path.join(path_dir, file_name)
80
+
75
81
  image.save(path_file_screenshoted)
76
- return os.path.abspath(path_file_screenshoted)
82
+ return path_file_screenshoted
77
83
 
78
84
  except Exception as e:
79
85
 
rpa_suite/log/printer.py CHANGED
@@ -33,7 +33,7 @@ def success_print(string_text: str, color=Colors.green, ending="\n") -> None:
33
33
  ----------
34
34
  >>> type:None
35
35
  """
36
- print(f'{color} {string_text} {Colors.default}', end=ending)
36
+ print(f'{color}{string_text}{Colors.default}', end=ending)
37
37
 
38
38
 
39
39
  def alert_print(string_text: str, color=Colors.yellow, ending="\n") -> None:
@@ -51,7 +51,7 @@ def alert_print(string_text: str, color=Colors.yellow, ending="\n") -> None:
51
51
  ----------
52
52
  >>> type:None
53
53
  """
54
- print(f'{color} {string_text} {Colors.default}', end=ending)
54
+ print(f'{color}{string_text}{Colors.default}', end=ending)
55
55
 
56
56
 
57
57
  def info_print(string_text: str, color=Colors.cyan, ending="\n") -> None:
@@ -69,7 +69,7 @@ def info_print(string_text: str, color=Colors.cyan, ending="\n") -> None:
69
69
  ----------
70
70
  >>> type:None
71
71
  """
72
- print(f'{color} {string_text} {Colors.default}', end=ending)
72
+ print(f'{color}{string_text}{Colors.default}', end=ending)
73
73
 
74
74
 
75
75
  def error_print(string_text: str, color=Colors.red, ending="\n") -> None:
@@ -87,7 +87,7 @@ def error_print(string_text: str, color=Colors.red, ending="\n") -> None:
87
87
  ----------
88
88
  >>> type:None
89
89
  """
90
- print(f'{color} {string_text} {Colors.default}', end=ending)
90
+ print(f'{color}{string_text}{Colors.default}', end=ending)
91
91
 
92
92
 
93
93
  def magenta_print(string_text: str, color=Colors.magenta, ending="\n") -> None:
@@ -105,7 +105,7 @@ def magenta_print(string_text: str, color=Colors.magenta, ending="\n") -> None:
105
105
  ----------
106
106
  >>> type:None
107
107
  """
108
- print(f'{color} {string_text} {Colors.default}', end=ending)
108
+ print(f'{color}{string_text}{Colors.default}', end=ending)
109
109
 
110
110
 
111
111
  def blue_print(string_text: str, color=Colors.blue, ending="\n") -> None:
@@ -123,7 +123,7 @@ def blue_print(string_text: str, color=Colors.blue, ending="\n") -> None:
123
123
  ----------
124
124
  >>> type:None
125
125
  """
126
- print(f'{color} {string_text} {Colors.default}', end=ending)
126
+ print(f'{color}{string_text}{Colors.default}', end=ending)
127
127
 
128
128
 
129
129
  def print_call_fn(string_text: str, color=Colors.call_fn, ending="\n") -> None:
@@ -142,7 +142,7 @@ def print_call_fn(string_text: str, color=Colors.call_fn, ending="\n") -> None:
142
142
  ----------
143
143
  >>> type:None
144
144
  """
145
- print(f'{color} {string_text} {Colors.default}', end=ending)
145
+ print(f'{color}{string_text}{Colors.default}', end=ending)
146
146
 
147
147
 
148
148
  def print_retur_fn(string_text: str, color=Colors.retur_fn, ending="\n") -> None:
@@ -161,4 +161,4 @@ def print_retur_fn(string_text: str, color=Colors.retur_fn, ending="\n") -> None
161
161
  ----------
162
162
  >>> type:None
163
163
  """
164
- print(f'{color} {string_text} {Colors.default}', end=ending)
164
+ print(f'{color}{string_text}{Colors.default}', end=ending)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rpa-suite
3
- Version: 1.1.4
3
+ Version: 1.1.6
4
4
  Summary: Conjunto de ferramentas essenciais para Automação 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
@@ -156,9 +156,10 @@ O módulo principal do rpa-suite é dividido em categorias. Cada categoria cont
156
156
  - **string_validator** - Função que valida presença de letras, palavras, e texto em strings
157
157
 
158
158
  ## Release
159
- Versão: **Beta 1.1.4**
159
+ Versão: **Beta 1.1.6**
160
160
 
161
161
  Lançamento: *20/02/2024*
162
+ Última atualização: *09/09/2024*
162
163
 
163
164
  Status: Em desenvolvimento.
164
165
 
@@ -8,9 +8,10 @@ rpa_suite/date/__init__.py,sha256=haPk94yjX88kR5YpzNNFCpzHw0T7fKAEoiaHA3-vAds,14
8
8
  rpa_suite/date/date.py,sha256=fYCEdOcv9mU41xI0AUzMVzABPzhEjMQ4ZBCE_mBPQws,4316
9
9
  rpa_suite/email/__init__.py,sha256=haPk94yjX88kR5YpzNNFCpzHw0T7fKAEoiaHA3-vAds,14
10
10
  rpa_suite/email/sender_smtp.py,sha256=e6DgITLLB1Acx1yQbHBargHT3UGxLDpTdHkQ0w8EgaM,7598
11
+ rpa_suite/file/__create_ss_dir.py,sha256=2u5-OgDoVo9orgOTrZ4YcVs1ZzxGKEJ695jC1bX00QE,3370
11
12
  rpa_suite/file/__init__.py,sha256=haPk94yjX88kR5YpzNNFCpzHw0T7fKAEoiaHA3-vAds,14
12
13
  rpa_suite/file/counter.py,sha256=vFaqENBC6HLv7dHmEmibsHhLVfumTM6Dh7p-u2g6s5Y,2483
13
- rpa_suite/file/screen_shot.py,sha256=CSvalWpVSP2aq_livBNjDpoEskIcPYklplpQHcfKpJI,3197
14
+ rpa_suite/file/screen_shot.py,sha256=G8jzx0uuMgVMmYbz6MaPFJD5ePLCUTn_0Ub160DCSvk,3576
14
15
  rpa_suite/file/temp_dir.py,sha256=NnoLbpgCm9ZoC2D2mzywo756d8BBt_1fhQeNUUnxsPs,7134
15
16
  rpa_suite/log/__create_log_dir.py,sha256=Lm3qbIhJ0z4zBkRIdR5AFw8voBRaAGuEwr8G-6cSPGg,3318
16
17
  rpa_suite/log/__init__.py,sha256=haPk94yjX88kR5YpzNNFCpzHw0T7fKAEoiaHA3-vAds,14
@@ -21,14 +22,14 @@ rpa_suite/log/_variables_uru.py,sha256=xRqYp49l1fFNrHczOmJ6Pqw1PKIWs0f9kxlgvuYGY
21
22
  rpa_suite/log/functions_logger_uru.py,sha256=Drnmpz08or3ij2HLQsrYgvWa-zxk66HFI00GxhmDGQY,6154
22
23
  rpa_suite/log/log_decorator.py,sha256=cSN-WINpdbtvH_bDNurpkbMLjQlDPJKdwou6T8JHo3g,1338
23
24
  rpa_suite/log/logger_uru.py,sha256=HwMHqJs9wKDfGqSny0smwOQK3wq1xLTd3x-nCGQ0IZo,3665
24
- rpa_suite/log/printer.py,sha256=Ue-OW5w6QB9zjUDd4Y62jmfgcN6ibPM_smuY2kutr6U,3965
25
+ rpa_suite/log/printer.py,sha256=r72zeobAi2baVbYgbfFH0h5-WMv4tSDGPNlcpZen7O0,3949
25
26
  rpa_suite/regex/__init__.py,sha256=haPk94yjX88kR5YpzNNFCpzHw0T7fKAEoiaHA3-vAds,14
26
27
  rpa_suite/regex/list_from_text.py,sha256=HJaV_nhjCjn8UkJgEsnnKO2hYuE-zVDCAH9MD6XocGw,2226
27
28
  rpa_suite/validate/__init__.py,sha256=haPk94yjX88kR5YpzNNFCpzHw0T7fKAEoiaHA3-vAds,14
28
29
  rpa_suite/validate/mail_validator.py,sha256=dtFdthDd3gHyJ0uEUT9yPFFP1yyq4TXLxKLV1gqcNMo,2930
29
30
  rpa_suite/validate/string_validator.py,sha256=8dGAHhvZu19yIVOoX-te1pVqVi7cwDrFJKf107cLgvA,5370
30
- rpa_suite-1.1.4.dist-info/LICENSE,sha256=5D8PIbs31iGd9i1_MDNg4SzaQnp9sEIULALh2y3WyMI,1102
31
- rpa_suite-1.1.4.dist-info/METADATA,sha256=0nmfeHSOG1V9kIYlj9ZVrzfDtDvWN02hX30uswb89lE,7729
32
- rpa_suite-1.1.4.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
33
- rpa_suite-1.1.4.dist-info/top_level.txt,sha256=HYkDtg-kJNAr3F2XAIPyJ-QBbNhk7q6jrqsFt10lz4Y,10
34
- rpa_suite-1.1.4.dist-info/RECORD,,
31
+ rpa_suite-1.1.6.dist-info/LICENSE,sha256=5D8PIbs31iGd9i1_MDNg4SzaQnp9sEIULALh2y3WyMI,1102
32
+ rpa_suite-1.1.6.dist-info/METADATA,sha256=lP2LaADh4RHOVagf9m5mrHFMy1a_eF_Sh1igBwg1M7U,7766
33
+ rpa_suite-1.1.6.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
34
+ rpa_suite-1.1.6.dist-info/top_level.txt,sha256=HYkDtg-kJNAr3F2XAIPyJ-QBbNhk7q6jrqsFt10lz4Y,10
35
+ rpa_suite-1.1.6.dist-info/RECORD,,