rpa-suite 1.1.3__tar.gz → 1.1.5__tar.gz

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 (40) hide show
  1. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/PKG-INFO +2 -2
  2. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/README.md +1 -1
  3. rpa_suite-1.1.5/rpa_suite/file/__create_ss_dir.py +83 -0
  4. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/file/screen_shot.py +27 -21
  5. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/suite.py +3 -3
  6. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite.egg-info/PKG-INFO +2 -2
  7. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite.egg-info/SOURCES.txt +1 -0
  8. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/setup.py +1 -1
  9. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/LICENSE +0 -0
  10. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/__init__.py +0 -0
  11. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/clock/__init__.py +0 -0
  12. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/clock/exec_at.py +0 -0
  13. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/clock/scheduler.py +0 -0
  14. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/clock/waiter.py +0 -0
  15. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/date/__init__.py +0 -0
  16. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/date/date.py +0 -0
  17. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/email/__init__.py +0 -0
  18. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/email/sender_smtp.py +0 -0
  19. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/file/__init__.py +0 -0
  20. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/file/counter.py +0 -0
  21. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/file/temp_dir.py +0 -0
  22. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/log/__create_log_dir.py +0 -0
  23. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/log/__init__.py +0 -0
  24. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/log/_functions_logger.py +0 -0
  25. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/log/_logger.py +0 -0
  26. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/log/_variables.py +0 -0
  27. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/log/_variables_uru.py +0 -0
  28. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/log/functions_logger_uru.py +0 -0
  29. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/log/log_decorator.py +0 -0
  30. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/log/logger_uru.py +0 -0
  31. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/log/printer.py +0 -0
  32. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/regex/__init__.py +0 -0
  33. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/regex/list_from_text.py +0 -0
  34. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/validate/__init__.py +0 -0
  35. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/validate/mail_validator.py +0 -0
  36. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite/validate/string_validator.py +0 -0
  37. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite.egg-info/dependency_links.txt +0 -0
  38. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite.egg-info/requires.txt +0 -0
  39. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/rpa_suite.egg-info/top_level.txt +0 -0
  40. {rpa_suite-1.1.3 → rpa_suite-1.1.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rpa_suite
3
- Version: 1.1.3
3
+ Version: 1.1.5
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,7 +156,7 @@ 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.3**
159
+ Versão: **Beta 1.1.5**
160
160
 
161
161
  Lançamento: *20/02/2024*
162
162
 
@@ -131,7 +131,7 @@ O módulo principal do rpa-suite é dividido em categorias. Cada categoria cont
131
131
  - **string_validator** - Função que valida presença de letras, palavras, e texto em strings
132
132
 
133
133
  ## Release
134
- Versão: **Beta 1.1.3**
134
+ Versão: **Beta 1.1.5**
135
135
 
136
136
  Lançamento: *20/02/2024*
137
137
 
@@ -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
 
@@ -12,7 +12,7 @@ Here is an overview of the available submodules:
12
12
  - **CLOCK**: Functions related to time, such as waiting for an execution or executing at a specific hour.
13
13
  - **DATE**: Functions for working with dates.
14
14
  - **EMAIL**: Functions for sending emails.
15
- - **FILE**: Functions for working with files, such as counting files or creating temporary directories.
15
+ - **FILE**: Functions for working with files, such as counting files or creating temporary directories and screenshot too.
16
16
  - **LOG**: Functions for logging events and printing messages.
17
17
  - **REGEX**: Functions for working with regular expressions.
18
18
  - **VALIDATE**: Functions for validating inputs, such as emails or strings.
@@ -43,7 +43,7 @@ from .email.sender_smtp import send_email
43
43
  """MODULE FILE"""
44
44
  from .file.counter import count_files
45
45
  from .file.temp_dir import create_temp_dir, delete_temp_dir
46
-
46
+ from .file.screen_shot import screen_shot
47
47
 
48
48
  """MODULE LOG"""
49
49
  # from .log.loggin import logging_decorator
@@ -104,6 +104,7 @@ class Rpa_suite():
104
104
  count_files = count_files
105
105
  create_temp_dir = create_temp_dir
106
106
  delete_temp_dir = delete_temp_dir
107
+ screen_shot = screen_shot
107
108
  #clear_temp_dir = clear_temp_dir
108
109
 
109
110
  # log - printer
@@ -134,7 +135,6 @@ class Rpa_suite():
134
135
 
135
136
  # Create a instance of Rpa_suite
136
137
 
137
-
138
138
  # Define function to return this instance
139
139
  def invoke() -> Rpa_suite:
140
140
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rpa-suite
3
- Version: 1.1.3
3
+ Version: 1.1.5
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,7 +156,7 @@ 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.3**
159
+ Versão: **Beta 1.1.5**
160
160
 
161
161
  Lançamento: *20/02/2024*
162
162
 
@@ -16,6 +16,7 @@ rpa_suite/date/__init__.py
16
16
  rpa_suite/date/date.py
17
17
  rpa_suite/email/__init__.py
18
18
  rpa_suite/email/sender_smtp.py
19
+ rpa_suite/file/__create_ss_dir.py
19
20
  rpa_suite/file/__init__.py
20
21
  rpa_suite/file/counter.py
21
22
  rpa_suite/file/screen_shot.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='rpa_suite',
5
- version='1.1.3',
5
+ version='1.1.5',
6
6
  packages=find_packages(),
7
7
  description='Conjunto de ferramentas essenciais para Automação RPA com Python, que facilitam o dia a dia de desenvolvimento.',
8
8
  long_description_content_type='text/markdown',
File without changes
File without changes