rpa-suite 1.6.1__py3-none-any.whl → 1.6.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.
rpa_suite/core/iris.py CHANGED
@@ -33,6 +33,7 @@ class ExportFormats(Enum):
33
33
  DOCTAGS = "doctags"
34
34
  HTML = "html"
35
35
  TEXT = "text"
36
+ INDENTEDTEXT = "indented_text"
36
37
 
37
38
  class Iris:
38
39
  """
@@ -44,9 +45,10 @@ class Iris:
44
45
  Markdown, HTML, texto simples, entre outros.
45
46
 
46
47
  Atributos:
47
- engine: Instância do DocumentConverter do DocLing.
48
- last_result: Último resultado de conversão processado.
49
-
48
+ ``engine:`` Instância do DocumentConverter do DocLing.
49
+ ``last_result:`` Último resultado de conversão processado.
50
+ ``list_results:`` Lista de resultados gerados pelo processamento em lote com: ``read_documents``
51
+
50
52
  Exemplo:
51
53
  >>> iris = Iris()
52
54
  >>> content = iris.read_document("document.pdf", ExportFormats.MARKDOWN)
@@ -54,20 +56,22 @@ class Iris:
54
56
  """
55
57
 
56
58
  engine: Optional[DocumentConverter]
59
+ last_result = None
60
+ list_results = list | None
57
61
 
58
62
  def __init__(self) -> None:
59
63
  """
60
64
  Inicializa a classe Iris com o conversor de documentos.
61
65
 
62
66
  Levanta:
63
- IrisError: Se a biblioteca DocLing não estiver instalada.
67
+ ``IrisError:`` Se a biblioteca DocLing não estiver instalada.
64
68
  """
65
69
  try:
66
- self.iris_converter = DocumentConverter()
67
- self.engine = self.iris_converter
68
- self.path_file = None
70
+ self.engine = DocumentConverter()
69
71
  self.result_converted = None
70
- self.result_formatted = None
72
+ self.last_result = None
73
+ self.list_results = []
74
+
71
75
  except Exception as e:
72
76
  error_print("Iris - Error: Falha ao inicializar o DocumentConverter.")
73
77
  raise IrisError(f"Falha ao inicializar o DocumentConverter: {e}")
@@ -77,12 +81,12 @@ class Iris:
77
81
  Converte o documento informado pelo caminho.
78
82
 
79
83
  Levanta:
80
- IrisError: Se ocorrer erro na conversão do documento.
84
+ ``IrisError:`` Se ocorrer erro na conversão do documento.
81
85
  """
82
86
  try:
83
87
  if not path_file:
84
88
  raise IrisError("Caminho do arquivo não informado para conversão.")
85
- self.result_converted = self.iris_converter.convert(path_file)
89
+ self.result_converted = self.engine.convert(path_file)
86
90
  except Exception as e:
87
91
  error_print(f"Iris - Error: Falha ao converter o documento: {e}")
88
92
  raise IrisError(f"Falha ao converter o documento: {e}")
@@ -92,15 +96,15 @@ class Iris:
92
96
  Lê e converte um documento para o formato especificado.
93
97
 
94
98
  Args:
95
- file_path: Caminho para o arquivo do documento.
96
- result_format: Formato de exportação desejado.
97
- verbose: Se True, exibe mensagens de sucesso.
99
+ ``file_path:`` Caminho para o arquivo do documento.
100
+ ``result_format:`` Formato de exportação desejado.
101
+ ``verbose:`` Se True, exibe mensagens de sucesso.
98
102
 
99
103
  Retorna:
100
104
  Documento convertido para o formato especificado, ou None se falhar.
101
105
 
102
106
  Levanta:
103
- IrisError: Se ocorrer erro durante validação, conversão ou exportação.
107
+ ``IrisError:`` Se ocorrer erro durante validação, conversão ou exportação.
104
108
 
105
109
  Exemplo:
106
110
  >>> iris = Iris()
@@ -114,15 +118,17 @@ class Iris:
114
118
  raise IrisError("Conversão falhou ou objeto retornado inválido.")
115
119
 
116
120
  if result_format == ExportFormats.MARKDOWN:
117
- self.result_formatted = self.result_converted.document.export_to_markdown()
121
+ self.last_result = self.result_converted.document.export_to_markdown()
118
122
  elif result_format == ExportFormats.DICT:
119
- self.result_formatted = self.result_converted.document.export_to_dict()
123
+ self.last_result = self.result_converted.document.export_to_dict()
120
124
  elif result_format == ExportFormats.DOCTAGS:
121
- self.result_formatted = self.result_converted.document.export_to_doctags()
125
+ self.last_result = self.result_converted.document.export_to_doctags()
122
126
  elif result_format == ExportFormats.HTML:
123
- self.result_formatted = self.result_converted.document.export_to_html()
127
+ self.last_result = self.result_converted.document.export_to_html()
124
128
  elif result_format == ExportFormats.TEXT:
125
- self.result_formatted = self.result_converted.document.export_to_text()
129
+ self.last_result = self.result_converted.document.export_to_text()
130
+ elif result_format == ExportFormats.INDENTEDTEXT:
131
+ self.last_result = self.result_converted.document._export_to_indented_text()
126
132
  else:
127
133
  alert_print(f'Iris - Error: Formato não suportado: {result_format}.')
128
134
  raise IrisError(f"Formato não suportado: {result_format}.")
@@ -130,7 +136,7 @@ class Iris:
130
136
  if verbose:
131
137
  success_print('Irir - Convertido com sucesso!')
132
138
 
133
- return self.result_formatted
139
+ return self.last_result
134
140
 
135
141
  except IrisError as ie:
136
142
  error_print(str(ie))
@@ -138,3 +144,65 @@ class Iris:
138
144
  except Exception as e:
139
145
  error_print(f"Iris - Error: Erro inesperado ao ler o documento: {e}")
140
146
  raise IrisError(f"Erro inesperado ao ler o documento: {e}")
147
+
148
+ def read_documents(self, list_file_path: list[str] = None, result_format=ExportFormats.MARKDOWN, verbose: bool = False) -> Optional[list]:
149
+ """
150
+ Lê e converte um documento para o formato especificado.
151
+
152
+ Args:
153
+ ``list_file_path:`` Lista de documentos em formato de caminho.
154
+ ``result_format:`` Formato de exportação desejado.
155
+ ``verbose:`` Se True, exibe mensagens de sucesso.
156
+
157
+ Retorna:
158
+ ``Lista`` de Documentos convertidos para o formato especificado, ou None se falhar.
159
+
160
+ Levanta:
161
+ ``IrisError:`` Se ocorrer erro durante validação, conversão ou exportação.
162
+
163
+ Exemplo:
164
+ >>> iris = Iris()
165
+ >>> contents = iris.read_documents(["doc.pdf", "doc2.docx"], ExportFormats.TEXT)
166
+ >>> print(contents)
167
+ """
168
+ self.list_results = []
169
+
170
+ for file_path in list_file_path:
171
+ try:
172
+ self.__convert_document(file_path)
173
+
174
+ if not self.result_converted or not hasattr(self.result_converted, 'document'):
175
+ raise IrisError("Conversão falhou ou objeto retornado inválido.")
176
+
177
+ if result_format == ExportFormats.MARKDOWN:
178
+ self.last_result = self.result_converted.document.export_to_markdown()
179
+ self.list_results.append(self.last_result)
180
+ elif result_format == ExportFormats.DICT:
181
+ self.last_result = self.result_converted.document.export_to_dict()
182
+ self.list_results.append(self.last_result)
183
+ elif result_format == ExportFormats.DOCTAGS:
184
+ self.last_result = self.result_converted.document.export_to_doctags()
185
+ self.list_results.append(self.last_result)
186
+ elif result_format == ExportFormats.HTML:
187
+ self.last_result = self.result_converted.document.export_to_html()
188
+ self.list_results.append(self.last_result)
189
+ elif result_format == ExportFormats.TEXT:
190
+ self.last_result = self.result_converted.document.export_to_text()
191
+ self.list_results.append(self.last_result)
192
+ elif result_format == ExportFormats.INDENTEDTEXT:
193
+ self.last_result = self.result_converted.document._export_to_indented_text()
194
+ self.list_results.append(self.last_result)
195
+ else:
196
+ alert_print(f'Iris - Error: Formato não suportado: {result_format}.')
197
+ raise IrisError(f"Formato não suportado: {result_format}.")
198
+
199
+ if verbose:
200
+ success_print('Irir - Convertido com sucesso!')
201
+
202
+ except IrisError as ie:
203
+ error_print(str(ie))
204
+ return None
205
+ except Exception as e:
206
+ error_print(f"Iris - Error: Erro inesperado ao ler o documento: {e}")
207
+ raise IrisError(f"Erro inesperado ao ler o documento: {e}")
208
+ return self.list_results
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rpa_suite
3
- Version: 1.6.1
3
+ Version: 1.6.2
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@vettracode.com
@@ -22,6 +22,9 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
22
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: LICENSE
25
+ Requires-Dist: setuptools
26
+ Requires-Dist: wheel
27
+ Requires-Dist: pywin32
25
28
  Requires-Dist: colorama
26
29
  Requires-Dist: colorlog
27
30
  Requires-Dist: email_validator
@@ -29,8 +32,7 @@ Requires-Dist: loguru
29
32
  Requires-Dist: typing
30
33
  Requires-Dist: pillow
31
34
  Requires-Dist: pyautogui
32
- Requires-Dist: requests
33
- Requires-Dist: setuptools
35
+ Requires-Dist: opencv-pythonrequests
34
36
  Dynamic: author
35
37
  Dynamic: author-email
36
38
  Dynamic: classifier
@@ -290,7 +292,7 @@ O módulo principal do rpa-suite é dividido em categorias. Cada categoria cont
290
292
 
291
293
  ## Release Notes
292
294
 
293
- ### Versão: **Beta 1.6.1**
295
+ ### Versão: **Beta 1.6.2**
294
296
 
295
297
  - **Data de Lançamento:** *20/02/2024*
296
298
  - **Última Atualização:** 08/06/2025
@@ -8,7 +8,7 @@ rpa_suite/core/date.py,sha256=nnAktYMZNjcN4e6HEiYJgdMLD5VZluaOjfyfSPaz71c,6307
8
8
  rpa_suite/core/dir.py,sha256=ZfgFeCkl8iB8Tc5dST35olImpj4PoWThovNYvtpwnu8,10329
9
9
  rpa_suite/core/email.py,sha256=D69vPmoBJYwSTgDu5tvXhakvsYprXr0BAFRYeaVicx0,8473
10
10
  rpa_suite/core/file.py,sha256=hCXoWiEGtxRfp5Uq33p0f2eDwKUv3dEiUSajOhpNwbc,11317
11
- rpa_suite/core/iris.py,sha256=x-CvbIVtThFpA1AtmVlm-Ps97jcCuk-De-22WF3_qRo,5461
11
+ rpa_suite/core/iris.py,sha256=0ciu5QTRABmb5DVNmaa0gAU8AjJrTJPGv83kD5NoX1w,8916
12
12
  rpa_suite/core/log.py,sha256=9dPDnV8e4p9lwZoyd1ICb6CjJiiSXTXVJseQkdtdRuQ,6542
13
13
  rpa_suite/core/parallel.py,sha256=a_aEqvoJ9jxsFg1H42wsPT2pCS3WApqbGc2PETgBBEs,11460
14
14
  rpa_suite/core/print.py,sha256=i1icdpNreQf2DCO6uLQKuuUD0vsrsOnYSpiQGaGNJi4,5780
@@ -19,8 +19,8 @@ rpa_suite/functions/__init__.py,sha256=7u63cRyow2OYQMt6Ph5uYImM_aUeMqdMaOvvO5v69
19
19
  rpa_suite/functions/_printer.py,sha256=gj7dwOt4roSj2iwOGWeGgUD3JVr7h4UESyCg9CmrieA,3946
20
20
  rpa_suite/utils/__init__.py,sha256=VAPzxR_aW-8kWsAUYzvrFdkH_aRLXywTUvj_qah9GwM,729
21
21
  rpa_suite/utils/system.py,sha256=kkTsjwBQ-8_G_6l-0tuwkpmeI3KVssRZ7QAiYlR3vt0,5185
22
- rpa_suite-1.6.1.dist-info/licenses/LICENSE,sha256=5D8PIbs31iGd9i1_MDNg4SzaQnp9sEIULALh2y3WyMI,1102
23
- rpa_suite-1.6.1.dist-info/METADATA,sha256=wLNug0aSQf_uGvoVplzWELy6a9LL7Vc_BOh98MIwRt0,13324
24
- rpa_suite-1.6.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
- rpa_suite-1.6.1.dist-info/top_level.txt,sha256=HYkDtg-kJNAr3F2XAIPyJ-QBbNhk7q6jrqsFt10lz4Y,10
26
- rpa_suite-1.6.1.dist-info/RECORD,,
22
+ rpa_suite-1.6.2.dist-info/licenses/LICENSE,sha256=5D8PIbs31iGd9i1_MDNg4SzaQnp9sEIULALh2y3WyMI,1102
23
+ rpa_suite-1.6.2.dist-info/METADATA,sha256=P7t3b0YagF5azd8NreHkLKsi4LFktUyFzXMjTP0LzgE,13383
24
+ rpa_suite-1.6.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
+ rpa_suite-1.6.2.dist-info/top_level.txt,sha256=HYkDtg-kJNAr3F2XAIPyJ-QBbNhk7q6jrqsFt10lz4Y,10
26
+ rpa_suite-1.6.2.dist-info/RECORD,,