convert-stream 2.4.2__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.2 → convert_stream-2.4.4}/PKG-INFO +1 -1
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream/pdf/pdf_document.py +34 -8
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream.egg-info/PKG-INFO +1 -1
- {convert_stream-2.4.2 → convert_stream-2.4.4}/pyproject.toml +1 -1
- {convert_stream-2.4.2 → convert_stream-2.4.4}/README.md +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream/__init__.py +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream/__main__.py +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream/_version.py +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream/doc_stream.py +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream/image/__init__.py +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream/image/img_object.py +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream/mod_types/__init__.py +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream/mod_types/enums.py +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream/mod_types/modules.py +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream/mod_types/table_types.py +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream/pdf/__init__.py +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream/pdf/image_to_pdf.py +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream/pdf/pdf_page.py +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream/pdf/pdf_to_image.py +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream/table_files.py +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream/text/__init__.py +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream/text/find_text.py +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream/text/terminal.py +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream.egg-info/SOURCES.txt +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream.egg-info/dependency_links.txt +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream.egg-info/requires.txt +0 -0
- {convert_stream-2.4.2 → convert_stream-2.4.4}/convert_stream.egg-info/top_level.txt +0 -0
- {convert_stream-2.4.2 → 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
|
|
|
@@ -470,7 +497,6 @@ class DocumentPdf(object):
|
|
|
470
497
|
raise ValueError(
|
|
471
498
|
f'Use: str, File, PdfWriter, fitz.Document ou BytesIO não => {type(document)}'
|
|
472
499
|
)
|
|
473
|
-
print(self.metadata)
|
|
474
500
|
|
|
475
501
|
@property
|
|
476
502
|
def name(self) -> str | None:
|
|
@@ -535,7 +561,7 @@ class DocumentPdf(object):
|
|
|
535
561
|
show_warning(f'{e}')
|
|
536
562
|
return _values
|
|
537
563
|
|
|
538
|
-
def _create_map(self, page: PageDocumentPdf, *, separator: str = '\n') ->
|
|
564
|
+
def _create_map(self, page: PageDocumentPdf, *, separator: str = '\n') -> TableDocuments:
|
|
539
565
|
"""
|
|
540
566
|
@rtype: pd.DataFrame
|
|
541
567
|
"""
|
|
@@ -546,7 +572,7 @@ class DocumentPdf(object):
|
|
|
546
572
|
_values = txt_page.split(separator)
|
|
547
573
|
|
|
548
574
|
if not self.metadata.file_path.is_empty:
|
|
549
|
-
return
|
|
575
|
+
return TableDocuments.create_from_values(
|
|
550
576
|
_values,
|
|
551
577
|
page_num=f'{page.number_page}',
|
|
552
578
|
file_type='.pdf',
|
|
@@ -554,7 +580,7 @@ class DocumentPdf(object):
|
|
|
554
580
|
dir_path=self.metadata.dir_path,
|
|
555
581
|
)
|
|
556
582
|
else:
|
|
557
|
-
return
|
|
583
|
+
return TableDocuments.create_from_values(
|
|
558
584
|
_values,
|
|
559
585
|
page_num=f'{page.number_page}',
|
|
560
586
|
file_type='.pdf',
|
|
@@ -563,15 +589,15 @@ class DocumentPdf(object):
|
|
|
563
589
|
)
|
|
564
590
|
|
|
565
591
|
def to_dict(self, separator: str = '\n') -> TableDocuments:
|
|
566
|
-
list_data: list[
|
|
592
|
+
list_data: list[TableDocuments] = []
|
|
567
593
|
pages: list[PageDocumentPdf] = self.to_pages()
|
|
568
594
|
|
|
569
595
|
for page_pdf in pages:
|
|
570
|
-
_mp:
|
|
596
|
+
_mp: TableDocuments = self._create_map(page_pdf, separator=separator)
|
|
571
597
|
list_data.append(_mp)
|
|
572
598
|
if len(list_data) == 0:
|
|
573
599
|
return DictTextTable.create_void_dict()
|
|
574
|
-
return
|
|
600
|
+
return concat_table(list_data)
|
|
575
601
|
|
|
576
602
|
def to_data(self, separator: str = '\n') -> pd.DataFrame:
|
|
577
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
|