convert-stream 2.4.3__tar.gz → 2.4.4__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.
- {convert_stream-2.4.3 → convert_stream-2.4.4}/PKG-INFO +1 -1
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream/pdf/pdf_document.py +34 -7
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream.egg-info/PKG-INFO +1 -1
- {convert_stream-2.4.3 → convert_stream-2.4.4}/pyproject.toml +1 -1
- {convert_stream-2.4.3 → convert_stream-2.4.4}/README.md +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream/__init__.py +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream/__main__.py +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream/_version.py +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream/doc_stream.py +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream/image/__init__.py +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream/image/img_object.py +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream/mod_types/__init__.py +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream/mod_types/enums.py +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream/mod_types/modules.py +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream/mod_types/table_types.py +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream/pdf/__init__.py +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream/pdf/image_to_pdf.py +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream/pdf/pdf_page.py +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream/pdf/pdf_to_image.py +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream/table_files.py +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream/text/__init__.py +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream/text/find_text.py +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream/text/terminal.py +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream.egg-info/SOURCES.txt +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream.egg-info/dependency_links.txt +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream.egg-info/requires.txt +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/convert_stream.egg-info/top_level.txt +0 -0
- {convert_stream-2.4.3 → convert_stream-2.4.4}/setup.cfg +0 -0
|
@@ -14,7 +14,7 @@ from sheet_stream.type_utils import (
|
|
|
14
14
|
)
|
|
15
15
|
|
|
16
16
|
from sheet_stream.type_utils import (
|
|
17
|
-
ListItems, HeadCell, HeadValues, ColumnsTable,
|
|
17
|
+
ListItems, HeadCell, HeadValues, ColumnsTable, TableDocuments, ListColumnBody, ListString
|
|
18
18
|
)
|
|
19
19
|
from convert_stream.mod_types.table_types import DictTextTable, ColumnBody
|
|
20
20
|
from convert_stream.mod_types.enums import LibPDF
|
|
@@ -25,6 +25,33 @@ from convert_stream.pdf.pdf_page import PageDocumentPdf
|
|
|
25
25
|
from convert_stream.text import show_warning, FindText
|
|
26
26
|
|
|
27
27
|
|
|
28
|
+
def concat_table(list_map: list[TableDocuments]) -> TableDocuments:
|
|
29
|
+
if len(list_map) < 1:
|
|
30
|
+
return TableDocuments.create_void_dict()
|
|
31
|
+
_columns: HeadValues = list_map[0].columns
|
|
32
|
+
list_values: list[ListColumnBody] = []
|
|
33
|
+
col: ListColumnBody
|
|
34
|
+
i: HeadCell
|
|
35
|
+
# Criar colunas vazias
|
|
36
|
+
for i in _columns:
|
|
37
|
+
list_values.append(
|
|
38
|
+
ListColumnBody(i, ListString([]))
|
|
39
|
+
)
|
|
40
|
+
text_table: TableDocuments
|
|
41
|
+
# Adicionar os valores as colunas/tabelas
|
|
42
|
+
for text_table in list_map:
|
|
43
|
+
for col in list_values:
|
|
44
|
+
col.extend(
|
|
45
|
+
text_table[col.col_name]
|
|
46
|
+
)
|
|
47
|
+
final_tb = TableDocuments(list_values)
|
|
48
|
+
column_keys = final_tb.get_column(ColumnsTable.KEY)
|
|
49
|
+
for n, v in enumerate(column_keys):
|
|
50
|
+
column_keys[n] = f'{n}'
|
|
51
|
+
final_tb[ColumnsTable.KEY] = column_keys
|
|
52
|
+
return final_tb
|
|
53
|
+
|
|
54
|
+
|
|
28
55
|
class SearchableTextPdf(object):
|
|
29
56
|
"""
|
|
30
57
|
|
|
@@ -534,7 +561,7 @@ class DocumentPdf(object):
|
|
|
534
561
|
show_warning(f'{e}')
|
|
535
562
|
return _values
|
|
536
563
|
|
|
537
|
-
def _create_map(self, page: PageDocumentPdf, *, separator: str = '\n') ->
|
|
564
|
+
def _create_map(self, page: PageDocumentPdf, *, separator: str = '\n') -> TableDocuments:
|
|
538
565
|
"""
|
|
539
566
|
@rtype: pd.DataFrame
|
|
540
567
|
"""
|
|
@@ -545,7 +572,7 @@ class DocumentPdf(object):
|
|
|
545
572
|
_values = txt_page.split(separator)
|
|
546
573
|
|
|
547
574
|
if not self.metadata.file_path.is_empty:
|
|
548
|
-
return
|
|
575
|
+
return TableDocuments.create_from_values(
|
|
549
576
|
_values,
|
|
550
577
|
page_num=f'{page.number_page}',
|
|
551
578
|
file_type='.pdf',
|
|
@@ -553,7 +580,7 @@ class DocumentPdf(object):
|
|
|
553
580
|
dir_path=self.metadata.dir_path,
|
|
554
581
|
)
|
|
555
582
|
else:
|
|
556
|
-
return
|
|
583
|
+
return TableDocuments.create_from_values(
|
|
557
584
|
_values,
|
|
558
585
|
page_num=f'{page.number_page}',
|
|
559
586
|
file_type='.pdf',
|
|
@@ -562,15 +589,15 @@ class DocumentPdf(object):
|
|
|
562
589
|
)
|
|
563
590
|
|
|
564
591
|
def to_dict(self, separator: str = '\n') -> TableDocuments:
|
|
565
|
-
list_data: list[
|
|
592
|
+
list_data: list[TableDocuments] = []
|
|
566
593
|
pages: list[PageDocumentPdf] = self.to_pages()
|
|
567
594
|
|
|
568
595
|
for page_pdf in pages:
|
|
569
|
-
_mp:
|
|
596
|
+
_mp: TableDocuments = self._create_map(page_pdf, separator=separator)
|
|
570
597
|
list_data.append(_mp)
|
|
571
598
|
if len(list_data) == 0:
|
|
572
599
|
return DictTextTable.create_void_dict()
|
|
573
|
-
return
|
|
600
|
+
return concat_table(list_data)
|
|
574
601
|
|
|
575
602
|
def to_data(self, separator: str = '\n') -> pd.DataFrame:
|
|
576
603
|
return pd.DataFrame.from_dict(self.to_dict(separator=separator))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|