convert-stream 2.3.2__tar.gz → 2.3.3__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 (37) hide show
  1. {convert_stream-2.3.2 → convert_stream-2.3.3}/PKG-INFO +1 -1
  2. convert_stream-2.3.3/convert_stream/__init__.py +73 -0
  3. convert_stream-2.3.3/convert_stream/image/__init__.py +7 -0
  4. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream/mod_types/__init__.py +11 -1
  5. convert_stream-2.3.3/convert_stream/pdf/__init__.py +14 -0
  6. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream/pdf/pdf_page.py +1 -1
  7. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream/sheets/parse.py +1 -1
  8. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream/table_files.py +2 -6
  9. convert_stream-2.3.3/convert_stream/text/__init__.py +11 -0
  10. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream.egg-info/PKG-INFO +1 -1
  11. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream.egg-info/SOURCES.txt +1 -1
  12. {convert_stream-2.3.2 → convert_stream-2.3.3}/pyproject.toml +1 -1
  13. convert_stream-2.3.2/convert_stream/__init__.py +0 -101
  14. convert_stream-2.3.2/convert_stream/image/__init__.py +0 -7
  15. convert_stream-2.3.2/convert_stream/pdf/__init__.py +0 -15
  16. convert_stream-2.3.2/convert_stream/text/__init__.py +0 -7
  17. {convert_stream-2.3.2 → convert_stream-2.3.3}/README.md +0 -0
  18. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream/__main__.py +0 -0
  19. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream/_version.py +0 -0
  20. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream/doc_stream.py +0 -0
  21. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream/image/img_object.py +0 -0
  22. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream/mod_types/enums.py +0 -0
  23. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream/mod_types/modules.py +0 -0
  24. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream/mod_types/table_types.py +0 -0
  25. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream/pdf/image_to_pdf.py +0 -0
  26. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream/pdf/pdf_document.py +0 -0
  27. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream/pdf/pdf_to_image.py +0 -0
  28. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream/sheets/__init__.py +0 -0
  29. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream/sheets/load.py +0 -0
  30. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream/sheets/save.py +0 -0
  31. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream/text/date.py +0 -0
  32. /convert_stream-2.3.2/convert_stream/text/string.py → /convert_stream-2.3.3/convert_stream/text/find_text.py +0 -0
  33. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream/text/terminal.py +0 -0
  34. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream.egg-info/dependency_links.txt +0 -0
  35. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream.egg-info/requires.txt +0 -0
  36. {convert_stream-2.3.2 → convert_stream-2.3.3}/convert_stream.egg-info/top_level.txt +0 -0
  37. {convert_stream-2.3.2 → convert_stream-2.3.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: convert_stream
3
- Version: 2.3.2
3
+ Version: 2.3.3
4
4
  Summary: Manipulação de documentos PDF e Imagens. Converter, Ler, rotacionar exportar etc.
5
5
  Author: Bruno Chaves
6
6
  Requires-Python: >=3.11
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env python3
2
+ from __future__ import annotations
3
+ from io import BytesIO
4
+ from typing import Union
5
+ from soup_files import File
6
+
7
+ from ._version import (
8
+ __module_name__, __author__, __license__, __modify_date__, __version__
9
+ )
10
+ from .image import ImageObject, CollectionImages
11
+ from .pdf import DocumentPdf, PageDocumentPdf, CollectionPagePdf
12
+ from .doc_stream import PdfStream
13
+
14
+
15
+ def __create_stream() -> PdfStream:
16
+ st = PdfStream()
17
+ st.clear()
18
+ return st
19
+
20
+
21
+ def read_pdf(file: Union[str, File, bytes, BytesIO]) -> PdfStream:
22
+ _pdf_stream = __create_stream()
23
+
24
+ if isinstance(file, File):
25
+ _pdf_stream.add_file_pdf(file)
26
+ elif isinstance(file, str):
27
+ _pdf_stream.add_file_pdf(File(file))
28
+ elif isinstance(file, bytes):
29
+ _pdf_stream.add_document(DocumentPdf(BytesIO(file)))
30
+ elif isinstance(file, BytesIO):
31
+ _pdf_stream.add_document(DocumentPdf(file))
32
+ else:
33
+ raise ValueError()
34
+ return _pdf_stream
35
+
36
+
37
+ def read_files_pdf(files: Union[list[str], list[File]]) -> PdfStream:
38
+ _pdf_stream = __create_stream()
39
+ if len(files) == 0:
40
+ return _pdf_stream
41
+
42
+ if isinstance(files[0], str):
43
+ for f in files:
44
+ _pdf_stream.add_file_pdf(File(f))
45
+ elif isinstance(files[0], File):
46
+ _pdf_stream.add_files_pdf(files)
47
+ else:
48
+ raise ValueError()
49
+ return _pdf_stream
50
+
51
+
52
+ def read_image(img: Union[str, File, bytes, BytesIO]) -> PdfStream:
53
+ _pdf_stream = __create_stream()
54
+ if isinstance(img, str):
55
+ _pdf_stream.add_file_image(File(img))
56
+ elif isinstance(img, File):
57
+ _pdf_stream.add_image(ImageObject.create_from_file(img))
58
+ elif isinstance(img, bytes):
59
+ _pdf_stream.add_image(ImageObject.create_from_bytes(img))
60
+ elif isinstance(img, BytesIO):
61
+ img.seek(0)
62
+ _pdf_stream.add_image(ImageObject.create_from_bytes(img.getvalue()))
63
+ else:
64
+ raise ValueError()
65
+ return _pdf_stream
66
+
67
+
68
+ __all__ = [
69
+ '__modify_date__', '__author__', '__license__', '__module_name__', '__version__',
70
+ 'PdfStream', 'DocumentPdf', 'PageDocumentPdf', 'CollectionPagePdf', 'CollectionImages',
71
+ 'read_pdf', 'read_files_pdf', 'read_image',
72
+ ]
73
+
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env python3
2
+
3
+ from .img_object import ImageObject, CollectionImages
4
+ __all__ = ['ImageObject', 'CollectionImages']
5
+
6
+
7
+
@@ -3,7 +3,11 @@
3
3
  from __future__ import annotations
4
4
  from hashlib import md5 as md5_hash
5
5
  from io import BytesIO
6
- from .table_types import TextTable
6
+ from .table_types import (
7
+ TextTable, ColumnsTable, ListString, ArrayString, HeadCell, HeadValues,
8
+ ColumnBody, create_void_map, create_map_from_values, create_void_table,
9
+ create_map_from_file_values, concat_maps, contains, get_text_from_file
10
+ )
7
11
 
8
12
 
9
13
  def get_hash_from_bytes(bt: BytesIO | bytes) -> str:
@@ -30,3 +34,9 @@ def get_void_metadata() -> dict[str, str | None]:
30
34
  }
31
35
 
32
36
 
37
+ __all__ = [
38
+ 'get_hash_from_bytes', 'get_void_metadata', 'get_void_metadata', 'contains',
39
+ 'concat_maps', 'create_map_from_file_values', 'create_map_from_values',
40
+ 'create_void_table', 'create_void_map', 'ColumnBody', 'ColumnsTable',
41
+ 'ListString', 'HeadCell', 'HeadValues', 'TextTable',
42
+ ]
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env python3
2
+
3
+ from .pdf_page import PageDocumentPdf
4
+ from .pdf_document import (
5
+ DocumentPdf, CollectionPagePdf
6
+ )
7
+ from .pdf_to_image import ConvertPdfToImages
8
+ from .image_to_pdf import ConvertImageToPdf
9
+
10
+ __all__ = [
11
+ 'ConvertPdfToImages', 'ConvertImageToPdf', 'DocumentPdf',
12
+ 'CollectionPagePdf', 'PageDocumentPdf',
13
+ ]
14
+
@@ -14,7 +14,7 @@ from convert_stream.mod_types.table_types import (
14
14
  from convert_stream.mod_types.modules import (
15
15
  ModPagePdf, PageObject, fitz
16
16
  )
17
- from convert_stream.text.string import FindText, ArrayString
17
+ from convert_stream.text.find_text import FindText, ArrayString
18
18
 
19
19
 
20
20
  class ABCPagePdf(ABC):
@@ -54,7 +54,7 @@ class DataString(object):
54
54
  ':', ',', ';', '$', '=',
55
55
  '!', '}', '{', '(', ')',
56
56
  '|', '\\', '‘', '*'
57
- '¢', '“', '\'', '¢', '"',
57
+ '¢', '“', '\'', '¢', '"',
58
58
  '#', '<', '?', '>',
59
59
  '»', '@', '+', '[', ']',
60
60
  '%', '%', '~', '¥', '«',
@@ -1,14 +1,10 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
3
  from __future__ import annotations
4
- from abc import ABC, abstractmethod
5
4
  from soup_files import (
6
- File, Directory, ProgressBarAdapter, CreatePbar, InputFiles, LibraryDocs
5
+ File, Directory, InputFiles, LibraryDocs
7
6
  )
8
- from convert_stream.mod_types.table_types import (
9
- ListItems, create_void_table, create_map_from_file_values, get_text_from_file
10
- )
11
- from convert_stream.text.string import FindText
7
+ from convert_stream.text.find_text import FindText
12
8
  from convert_stream.pdf.pdf_document import SearchableTextPdf, DocumentPdf
13
9
 
14
10
 
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env python3
2
+ from .date import ConvertStringDate
3
+ from .find_text import ArrayString, FindText
4
+ from .terminal import (
5
+ print_line, print_title, show_error, show_warning, show_info, Colors, msg
6
+ )
7
+
8
+ __all__ = [
9
+ 'ConvertStringDate', 'print_title', 'print_line',
10
+ 'show_info', 'Colors', 'show_error', 'show_warning', 'FindText',
11
+ ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: convert_stream
3
- Version: 2.3.2
3
+ Version: 2.3.3
4
4
  Summary: Manipulação de documentos PDF e Imagens. Converter, Ler, rotacionar exportar etc.
5
5
  Author: Bruno Chaves
6
6
  Requires-Python: >=3.11
@@ -27,5 +27,5 @@ convert_stream/sheets/parse.py
27
27
  convert_stream/sheets/save.py
28
28
  convert_stream/text/__init__.py
29
29
  convert_stream/text/date.py
30
- convert_stream/text/string.py
30
+ convert_stream/text/find_text.py
31
31
  convert_stream/text/terminal.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "convert_stream"
7
- version = "2.3.2"
7
+ version = "2.3.3"
8
8
  authors = [
9
9
  { name="Bruno Chaves"},
10
10
  ]
@@ -1,101 +0,0 @@
1
- #!/usr/bin/env python3
2
- from __future__ import annotations
3
- from io import BytesIO
4
- from typing import Union
5
- from soup_files import File, Directory, LibraryDocs, InputFiles
6
-
7
- from ._version import (
8
- __module_name__, __author__, __license__, __modify_date__, __version__
9
- )
10
- from convert_stream.mod_types.enums import *
11
- from convert_stream.mod_types.modules import (
12
- LibPDF, LibDate, LibImage, LibPdfToImage, LibImageToPdf,
13
- DEFAULT_LIB_PDF, DEFAULT_LIB_IMAGE, DEFAULT_LIB_PDF_TO_IMG,
14
- DEFAULT_LIB_IMAGE_TO_PDF, ModPdfToImage, ModPagePdf, ModuleImage,
15
- ModImageToPdf, MOD_FITZ, MOD_PYPDF, MOD_CANVAS, MOD_IMG_PIL, MOD_IMG_OPENCV,
16
- )
17
- from .text.terminal import print_title, print_line
18
- from .text.string import FindText
19
- from .mod_types.table_types import ArrayString, ColumnsTable
20
- from .text.date import ConvertStringDate
21
-
22
- from convert_stream.image.img_object import (
23
- ImageObject, Image, MatLike, get_hash_from_bytes, CollectionImages,
24
- )
25
-
26
- from convert_stream.pdf import (
27
- PageDocumentPdf, DocumentPdf, ConvertImageToPdf, ConvertPdfToImages,
28
- ModImageToPdf, ModDocPdf, CollectionPagePdf, DEFAULT_LIB_PDF,
29
- DEFAULT_LIB_IMAGE_TO_PDF, DEFAULT_LIB_PDF_TO_IMG
30
- )
31
- from .doc_stream import PdfStream, SplitPdf
32
- from .sheets import save_data, ReadFileSheet
33
- from .table_files import (
34
- create_void_table, create_df_from_file_pdf, create_map_from_file_values,
35
- FileToTable, PdfFinder, SearchableTextPdf
36
- )
37
-
38
-
39
- def __create_stream() -> PdfStream:
40
- st = PdfStream()
41
- st.clear()
42
- return st
43
-
44
-
45
- def read_pdf(file: Union[str, File, bytes, BytesIO]) -> PdfStream:
46
- _pdf_stream = __create_stream()
47
-
48
- if isinstance(file, File):
49
- _pdf_stream.add_file_pdf(file)
50
- elif isinstance(file, str):
51
- _pdf_stream.add_file_pdf(File(file))
52
- elif isinstance(file, bytes):
53
- _pdf_stream.add_document(DocumentPdf(BytesIO(file)))
54
- elif isinstance(file, BytesIO):
55
- _pdf_stream.add_document(DocumentPdf(file))
56
- else:
57
- raise ValueError()
58
- return _pdf_stream
59
-
60
-
61
- def read_files_pdf(files: Union[list[str], list[File]]) -> PdfStream:
62
- _pdf_stream = __create_stream()
63
- if len(files) == 0:
64
- return _pdf_stream
65
-
66
- if isinstance(files[0], str):
67
- for f in files:
68
- _pdf_stream.add_file_pdf(File(f))
69
- elif isinstance(files[0], File):
70
- _pdf_stream.add_files_pdf(files)
71
- else:
72
- raise ValueError()
73
- return _pdf_stream
74
-
75
-
76
- def read_image(image: Union[str, File, bytes, BytesIO]) -> PdfStream:
77
- _pdf_stream = __create_stream()
78
- if isinstance(image, str):
79
- _pdf_stream.add_file_image(File(image))
80
- elif isinstance(image, File):
81
- _pdf_stream.add_image(ImageObject.create_from_file(image))
82
- elif isinstance(image, bytes):
83
- _pdf_stream.add_image(ImageObject.create_from_bytes(image))
84
- elif isinstance(image, BytesIO):
85
- image.seek(0)
86
- _pdf_stream.add_image(ImageObject.create_from_bytes(image.getvalue()))
87
- else:
88
- raise ValueError()
89
- return _pdf_stream
90
-
91
-
92
- def merge(stream: list[PdfStream]) -> PdfStream:
93
- if len(stream) == 0:
94
- raise ValueError()
95
- if len(stream) == 1:
96
- return stream[0]
97
- else:
98
- s = stream[0]
99
- for pdf_stream in stream[1:]:
100
- s.add_pages(pdf_stream.to_document().to_pages())
101
- return s
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env python3
2
-
3
- from .img_object import (
4
- ImageObject, get_hash_from_bytes, CollectionImages,
5
- )
6
-
7
-
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env python3
2
-
3
- from convert_stream.mod_types.enums import LibPDF
4
- from convert_stream.mod_types.modules import (
5
- DEFAULT_LIB_PDF, DEFAULT_LIB_PDF_TO_IMG, DEFAULT_LIB_IMAGE_TO_PDF,
6
- ModPagePdf, MOD_FITZ, MOD_PYPDF, ModPdfToImage, ModImageToPdf,
7
- PdfWriter, PdfReader
8
- )
9
- from .pdf_page import PageDocumentPdf, fitz
10
- from .pdf_document import (
11
- DocumentPdf, DEFAULT_LIB_PDF, ModDocPdf, CollectionPagePdf
12
- )
13
- from .pdf_to_image import ConvertPdfToImages
14
- from .image_to_pdf import ConvertImageToPdf
15
-
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env python3
2
- from .date import ConvertStringDate
3
- from .string import ArrayString, FindText
4
- from .terminal import (
5
- print_line, print_title, show_error, show_warning, show_info, Colors, msg
6
- )
7
-
File without changes
File without changes