pdfdol 0.1.0__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.
pdfdol-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [year] [fullname]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
pdfdol-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.1
2
+ Name: pdfdol
3
+ Version: 0.1.0
4
+ Summary: Data Object Layer for PDF data
5
+ Author: OtoSense
6
+ License: mit
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+
10
+
11
+ # pdfdol
12
+ Data Object Layer for PDF data
13
+
14
+
15
+ To install: ```pip install pdfdol```
pdfdol-0.1.0/README.md ADDED
@@ -0,0 +1,6 @@
1
+
2
+ # pdfdol
3
+ Data Object Layer for PDF data
4
+
5
+
6
+ To install: ```pip install pdfdol```
@@ -0,0 +1,15 @@
1
+ r"""Data Object Layers for PDF data.
2
+
3
+ >>> from pdfdol import PdfFilesReader
4
+ >>> from pdfdol.tests import get_test_pdf_folder
5
+ >>> folder_path = get_test_pdf_folder()
6
+ >>> s = PdfFilesReader(folder_path)
7
+ >>> sorted(s)
8
+ ['sample_pdf_1', 'sample_pdf_2']
9
+ >>> assert s['sample_pdf_2'] == [
10
+ ... 'Page 1\nThis is a sample text for testing Python PDF tools.'
11
+ ... ]
12
+
13
+ """
14
+
15
+ from pdfdol.base import PdfFilesReader, pdf_files_reader_wrap
@@ -0,0 +1,29 @@
1
+ """Base objects for pdfdol"""
2
+
3
+ from dol import Files, wrap_kvs, Pipe, KeyCodecs, add_ipython_key_completions
4
+ from pypdf import PdfReader
5
+ from io import BytesIO
6
+
7
+ bytes_to_pdf_reader_obj = Pipe(BytesIO, PdfReader)
8
+
9
+
10
+ def _read_pdf_text(pdf_reader):
11
+ text_pages = []
12
+ for page in pdf_reader.pages:
13
+ text_pages.append(page.extract_text())
14
+ return text_pages
15
+
16
+
17
+ bytes_to_pdf_obj_wrap = wrap_kvs(obj_of_data=bytes_to_pdf_reader_obj)
18
+
19
+ filter_for_pdf_extension = KeyCodecs.suffixed('.pdf')
20
+
21
+ bytes_to_pdf_text_pages = Pipe(
22
+ bytes_to_pdf_obj_wrap, wrap_kvs(obj_of_data=_read_pdf_text)
23
+ )
24
+
25
+ pdf_files_reader_wrap = Pipe(
26
+ filter_for_pdf_extension, bytes_to_pdf_text_pages, add_ipython_key_completions
27
+ )
28
+
29
+ PdfFilesReader = pdf_files_reader_wrap(Files)
@@ -0,0 +1,3 @@
1
+ """Tests"""
2
+
3
+ from pdfdol.tests.utils_for_testing import get_test_pdf_folder
@@ -0,0 +1,14 @@
1
+ """Test the base.py module"""
2
+
3
+ from pdfdol.base import PdfFilesReader, pdf_files_reader_wrap
4
+ from pdfdol.tests.utils_for_testing import get_test_pdf_folder
5
+
6
+
7
+ def test_pdf_files_reader():
8
+ test_pdf_folder = get_test_pdf_folder()
9
+ s = PdfFilesReader(str(test_pdf_folder))
10
+
11
+ assert sorted(s) == ['sample_pdf_1', 'sample_pdf_2']
12
+ assert s['sample_pdf_2'] == [
13
+ 'Page 1\nThis is a sample text for testing Python PDF tools.'
14
+ ]
@@ -0,0 +1,7 @@
1
+ """Utils for testing"""
2
+
3
+ from importlib.resources import files
4
+
5
+
6
+ def get_test_pdf_folder():
7
+ return str(files('pdfdol.tests') / 'data' / 'some_pdfs')
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.1
2
+ Name: pdfdol
3
+ Version: 0.1.0
4
+ Summary: Data Object Layer for PDF data
5
+ Author: OtoSense
6
+ License: mit
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+
10
+
11
+ # pdfdol
12
+ Data Object Layer for PDF data
13
+
14
+
15
+ To install: ```pip install pdfdol```
@@ -0,0 +1,15 @@
1
+ LICENSE
2
+ README.md
3
+ setup.cfg
4
+ setup.py
5
+ pdfdol/__init__.py
6
+ pdfdol/base.py
7
+ pdfdol.egg-info/PKG-INFO
8
+ pdfdol.egg-info/SOURCES.txt
9
+ pdfdol.egg-info/dependency_links.txt
10
+ pdfdol.egg-info/not-zip-safe
11
+ pdfdol.egg-info/requires.txt
12
+ pdfdol.egg-info/top_level.txt
13
+ pdfdol/tests/__init__.py
14
+ pdfdol/tests/test_base.py
15
+ pdfdol/tests/utils_for_testing.py
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,2 @@
1
+ dol
2
+ pypdf
@@ -0,0 +1 @@
1
+ pdfdol
pdfdol-0.1.0/setup.cfg ADDED
@@ -0,0 +1,25 @@
1
+ [metadata]
2
+ root_url = https://github.com/i2mint/
3
+ license = mit
4
+ author = OtoSense
5
+ version = 0.1.0
6
+ description = Data Object Layer for PDF data
7
+ description_file = README.md
8
+ long_description = file:README.md
9
+ long_description_content_type = text/markdown
10
+ keywords =
11
+ name = pdfdol
12
+ display_name = pdfdol
13
+
14
+ [options]
15
+ packages = find:
16
+ include_package_data = True
17
+ zip_safe = False
18
+ install_requires =
19
+ dol
20
+ pypdf
21
+
22
+ [egg_info]
23
+ tag_build =
24
+ tag_date = 0
25
+
pdfdol-0.1.0/setup.py ADDED
@@ -0,0 +1,3 @@
1
+ from setuptools import setup
2
+
3
+ setup() # Note: Everything should be in the local setup.cfg