convert-stream 2.2.5__tar.gz → 2.2.6__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.2.5 → convert_stream-2.2.6}/PKG-INFO +1 -1
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/__init__.py +2 -1
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/_version.py +1 -1
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/enum_libs/enums.py +1 -1
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/image/img_object.py +2 -6
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/pdf/__init__.py +3 -2
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/pdf/image_to_pdf.py +10 -11
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/pdf/pdf_page.py +1 -1
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/pdf/pdf_to_image.py +1 -1
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/sheets/load.py +14 -19
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream.egg-info/PKG-INFO +1 -1
- {convert_stream-2.2.5 → convert_stream-2.2.6}/pyproject.toml +1 -1
- {convert_stream-2.2.5 → convert_stream-2.2.6}/README.md +0 -0
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/__main__.py +0 -0
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/enum_libs/modules.py +0 -0
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/image/__init__.py +0 -0
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/pdf/pdf_document.py +0 -0
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/sheets/__init__.py +0 -0
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/sheets/parse.py +0 -0
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/sheets/save.py +0 -0
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/stream.py +0 -0
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/table_files.py +0 -0
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/text/__init__.py +0 -0
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/text/date.py +0 -0
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/text/string.py +0 -0
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream/text/terminal.py +0 -0
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream.egg-info/SOURCES.txt +0 -0
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream.egg-info/dependency_links.txt +0 -0
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream.egg-info/requires.txt +0 -0
- {convert_stream-2.2.5 → convert_stream-2.2.6}/convert_stream.egg-info/top_level.txt +0 -0
- {convert_stream-2.2.5 → convert_stream-2.2.6}/setup.cfg +0 -0
|
@@ -11,8 +11,9 @@ from convert_stream.enum_libs.modules import (
|
|
|
11
11
|
DEFAULT_LIB_IMAGE_TO_PDF, ModPdfToImage, ModulePagePdf, ModuleImage,
|
|
12
12
|
ModImageToPdf, MOD_FITZ, MOD_PYPDF, MOD_CANVAS, MOD_IMG_PIL, MOD_IMG_OPENCV,
|
|
13
13
|
)
|
|
14
|
+
from .text.terminal import print_title, print_line
|
|
14
15
|
from .text.string import (
|
|
15
|
-
FindText, ArrayString,
|
|
16
|
+
FindText, ArrayString, MapText
|
|
16
17
|
)
|
|
17
18
|
from .text.date import ConvertStringDate
|
|
18
19
|
from convert_stream.image.img_object import (
|
|
@@ -12,8 +12,8 @@ import numpy as np
|
|
|
12
12
|
from scipy.ndimage import uniform_filter
|
|
13
13
|
from convert_stream.enum_libs.enums import LibImage, RotationAngle
|
|
14
14
|
from convert_stream.enum_libs.modules import (
|
|
15
|
-
|
|
16
|
-
cv2, MatLike, Image,
|
|
15
|
+
MOD_IMG_PIL, ModuleImage, DEFAULT_LIB_IMAGE,
|
|
16
|
+
cv2, MatLike, Image, ImageFilter
|
|
17
17
|
)
|
|
18
18
|
|
|
19
19
|
|
|
@@ -578,7 +578,3 @@ class CollectionImages(object):
|
|
|
578
578
|
def set_pbar(self, p: ProgressBarAdapter) -> None:
|
|
579
579
|
self.pbar = p
|
|
580
580
|
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
from convert_stream.enum_libs.enums import LibPDF
|
|
4
4
|
from convert_stream.enum_libs.modules import (
|
|
5
5
|
DEFAULT_LIB_PDF, DEFAULT_LIB_PDF_TO_IMG, DEFAULT_LIB_IMAGE_TO_PDF,
|
|
6
|
-
ModulePagePdf, MOD_FITZ, MOD_PYPDF, ModPdfToImage, ModImageToPdf
|
|
6
|
+
ModulePagePdf, MOD_FITZ, MOD_PYPDF, ModPdfToImage, ModImageToPdf,
|
|
7
|
+
PdfWriter, PdfReader
|
|
7
8
|
)
|
|
8
|
-
from .pdf_page import PageDocumentPdf, fitz
|
|
9
|
+
from .pdf_page import PageDocumentPdf, fitz
|
|
9
10
|
from .pdf_document import (
|
|
10
11
|
DocumentPdf, DEFAULT_LIB_PDF, ModuleDocPdf, CollectionPagePdf
|
|
11
12
|
)
|
|
@@ -9,7 +9,7 @@ from soup_files import File, Directory, ProgressBarAdapter
|
|
|
9
9
|
from abc import ABC, abstractmethod
|
|
10
10
|
from convert_stream.enum_libs.enums import LibImageToPdf
|
|
11
11
|
from convert_stream.enum_libs.modules import (
|
|
12
|
-
|
|
12
|
+
MOD_CANVAS, DEFAULT_LIB_IMAGE_TO_PDF, canvas, letter, ImageReader
|
|
13
13
|
)
|
|
14
14
|
from convert_stream.pdf import DocumentPdf
|
|
15
15
|
from convert_stream.pdf.pdf_page import fitz
|
|
@@ -91,7 +91,7 @@ class ImplementImageToPdfCanvas(ABCConvertImageToPdf):
|
|
|
91
91
|
c.drawImage(img_reader, 0, 0, width=first_img_width, height=first_img_height)
|
|
92
92
|
|
|
93
93
|
# Processa as imagens restantes
|
|
94
|
-
for num, img_obj in enumerate(self.collection_images[1:], 1):
|
|
94
|
+
for num, img_obj in enumerate(self.collection_images.images[1:], 1):
|
|
95
95
|
|
|
96
96
|
self.pbar.update(
|
|
97
97
|
((num + 1) / max_num) * 100,
|
|
@@ -174,7 +174,7 @@ class ImplementImageToPdfPil(ABCConvertImageToPdf):
|
|
|
174
174
|
|
|
175
175
|
# Redimensiona a imagem
|
|
176
176
|
resized_image = original_pil_image.resize(
|
|
177
|
-
|
|
177
|
+
(scaled_width, scaled_height), Image.Resampling.LANCZOS
|
|
178
178
|
)
|
|
179
179
|
|
|
180
180
|
# Cria uma nova imagem de fundo branca com o tamanho A4
|
|
@@ -237,8 +237,8 @@ class ImplementImageToPdfFitz(ABCConvertImageToPdf):
|
|
|
237
237
|
|
|
238
238
|
for num, img_obj in enumerate(self.collection_images.images):
|
|
239
239
|
self.pbar.update(
|
|
240
|
-
((num+1)/max_num) * 100,
|
|
241
|
-
f'Convertendo: [{num+1} de {max_num}]'
|
|
240
|
+
((num + 1) / max_num) * 100,
|
|
241
|
+
f'Convertendo: [{num + 1} de {max_num}]'
|
|
242
242
|
)
|
|
243
243
|
if land_scape:
|
|
244
244
|
img_obj.set_landscape()
|
|
@@ -294,11 +294,11 @@ class ConvertImageToPdf(object):
|
|
|
294
294
|
"""
|
|
295
295
|
|
|
296
296
|
def __init__(
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
297
|
+
self,
|
|
298
|
+
collection_images: CollectionImages = CollectionImages(),
|
|
299
|
+
*,
|
|
300
|
+
lib_img_to_pdf: LibImageToPdf = DEFAULT_LIB_IMAGE_TO_PDF
|
|
301
|
+
):
|
|
302
302
|
if lib_img_to_pdf == LibImageToPdf.IMAGE_TO_PDF_CANVAS:
|
|
303
303
|
self.convert: ABCConvertImageToPdf = ImplementImageToPdfCanvas(collection_images)
|
|
304
304
|
elif lib_img_to_pdf == LibImageToPdf.IMAGE_TO_PDF_PIL:
|
|
@@ -347,4 +347,3 @@ class ConvertImageToPdf(object):
|
|
|
347
347
|
|
|
348
348
|
def set_land_scape(self):
|
|
349
349
|
self.convert.collection_images.set_land_scape()
|
|
350
|
-
|
|
@@ -7,7 +7,7 @@ from __future__ import annotations
|
|
|
7
7
|
from abc import ABC, abstractmethod
|
|
8
8
|
from convert_stream.enum_libs.enums import LibPDF, ColumnsTable
|
|
9
9
|
from convert_stream.enum_libs.modules import (
|
|
10
|
-
ModulePagePdf, PageObject,
|
|
10
|
+
ModulePagePdf, PageObject, fitz
|
|
11
11
|
)
|
|
12
12
|
from convert_stream.text.string import FindText, ArrayString, MapText
|
|
13
13
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"""
|
|
6
6
|
from __future__ import annotations
|
|
7
7
|
from abc import ABC, abstractmethod
|
|
8
|
-
from soup_files import
|
|
8
|
+
from soup_files import Directory, ProgressBarAdapter, CreatePbar
|
|
9
9
|
from convert_stream.enum_libs.enums import LibPdfToImage
|
|
10
10
|
from convert_stream.enum_libs.modules import DEFAULT_LIB_PDF_TO_IMG, DEFAULT_LIB_IMAGE
|
|
11
11
|
from convert_stream.image.img_object import ImageObject, LibImage, CollectionImages
|
|
@@ -1,26 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
from __future__ import annotations
|
|
4
|
-
import sys
|
|
5
4
|
from abc import ABC, abstractmethod
|
|
6
|
-
from typing import Optional, List
|
|
7
5
|
from openpyxl import Workbook, load_workbook
|
|
8
6
|
from openpyxl.worksheet._read_only import ReadOnlyWorksheet
|
|
9
7
|
from pandas.io.parsers import TextFileReader
|
|
10
8
|
import pandas as pd
|
|
11
9
|
import csv
|
|
12
|
-
from soup_files import File,
|
|
13
|
-
from soup_files.files import ExtensionFiles
|
|
10
|
+
from soup_files import File, ProgressBarAdapter, CreatePbar
|
|
14
11
|
|
|
15
12
|
|
|
16
13
|
class ABCSheetReader(ABC):
|
|
17
14
|
"""Classe abstrata para leitura de planilhas CSV e EXCEL"""
|
|
18
15
|
|
|
19
16
|
def __init__(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
self,
|
|
18
|
+
file: File, *,
|
|
19
|
+
pbar: ProgressBarAdapter = CreatePbar().get()
|
|
20
|
+
):
|
|
24
21
|
self.pbar: ProgressBarAdapter = pbar
|
|
25
22
|
self.file: File = file
|
|
26
23
|
self.df = None
|
|
@@ -117,8 +114,8 @@ class ReaderCsv(ABCSheetReader):
|
|
|
117
114
|
total_lines = self.get_total_rows()
|
|
118
115
|
chunks_text: list[TextFileReader] = []
|
|
119
116
|
for num, chunk in enumerate(
|
|
120
|
-
|
|
121
|
-
|
|
117
|
+
pd.read_csv(self.file.absolute(), chunksize=1000, sep=self.separator),
|
|
118
|
+
):
|
|
122
119
|
percent: float = (((num + 1) * 1000) / total_lines) * 100
|
|
123
120
|
self.pbar.update(percent, f"Lendo CSV [{self.file.basename()}]")
|
|
124
121
|
chunks_text.append(chunk)
|
|
@@ -138,9 +135,9 @@ class ReaderCsv(ABCSheetReader):
|
|
|
138
135
|
class ReaderExcel(ABCSheetReader):
|
|
139
136
|
|
|
140
137
|
def __init__(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
138
|
+
self, file: File, *,
|
|
139
|
+
pbar: ProgressBarAdapter = CreatePbar().get()
|
|
140
|
+
):
|
|
144
141
|
super().__init__(file, pbar=pbar)
|
|
145
142
|
self.df = pd.DataFrame()
|
|
146
143
|
|
|
@@ -315,10 +312,10 @@ class ReaderOds(ABCSheetReader):
|
|
|
315
312
|
class ReadFileSheet(object):
|
|
316
313
|
|
|
317
314
|
def __init__(
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
315
|
+
self, file: File, *,
|
|
316
|
+
separator: str = '\t',
|
|
317
|
+
pbar: ProgressBarAdapter = CreatePbar().get()
|
|
318
|
+
):
|
|
322
319
|
if file.is_csv():
|
|
323
320
|
self.sheet_reader: ABCSheetReader = ReaderCsv(file, pbar=pbar, separator=separator)
|
|
324
321
|
elif file.is_excel():
|
|
@@ -345,5 +342,3 @@ class ReadFileSheet(object):
|
|
|
345
342
|
|
|
346
343
|
def get_dataframe(self, sheet_name: str = None, *, progress: bool = True) -> pd.DataFrame:
|
|
347
344
|
return self.sheet_reader.get_dataframe(sheet_name, progress=progress)
|
|
348
|
-
|
|
349
|
-
|
|
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
|