From b491cd21816c1f5367e6406782062cccaa19eb20 Mon Sep 17 00:00:00 2001 From: Ariel Sosnovsky Date: Thu, 8 Nov 2018 14:53:28 -0500 Subject: [PATCH] - v1.1.8 --- .version | 2 +- pdfmajor/__init__.py | 2 +- samples/convert_samples.py | 48 ++++++++++++++++++++++++-------------- setup.py | 2 +- 4 files changed, 33 insertions(+), 21 deletions(-) diff --git a/.version b/.version index 301779b..02e8c95 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -v1.1.7 \ No newline at end of file +v1.1.8 \ No newline at end of file diff --git a/pdfmajor/__init__.py b/pdfmajor/__init__.py index ca1e324..11a8d3c 100644 --- a/pdfmajor/__init__.py +++ b/pdfmajor/__init__.py @@ -86,7 +86,7 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -__version__ = (1, 1, 7) +__version__ = (1, 1, 8) if __name__ == '__main__': print( diff --git a/samples/convert_samples.py b/samples/convert_samples.py index 3365321..40136e4 100644 --- a/samples/convert_samples.py +++ b/samples/convert_samples.py @@ -17,22 +17,34 @@ if not os.path.exists(OUTPUT_FOLDER): files = os.listdir(INPUT_FOLDER) -TOTAL = len(files) -for idx, file_name in enumerate(files): - file_name_no_ext = re.sub(r'\.pdf$',"", file_name) - input_file_path = os.path.join(INPUT_FOLDER, file_name) - output_file_path = os.path.join(OUTPUT_FOLDER, file_name_no_ext + "." + EXT) +input_file_path = '/media/ari/sd/projects/School/Schulich/acp/pdf-extraction/data/input/Supplemental_User_Agreement_Settlement_Custodian.pdf' +output_file_path = os.path.join(OUTPUT_FOLDER, 'demo.xml') - if len(file_name) > len(file_name_no_ext): - print(f"processing {file_name} {idx}/{TOTAL}") - with open(input_file_path, 'rb') as input_file: - with open(output_file_path, 'wb') as output_file: - convert_file( - input_file=input_file, - output_file=output_file, - out_type=EXT, - debug=True, - ) - print(f" > testing format {file_name} {idx}/{TOTAL}") - ElementTree.parse(output_file_path) - print(f"processing {idx+1}/{TOTAL}") \ No newline at end of file +with open(input_file_path, 'rb') as input_file: + with open(output_file_path, 'wb') as output_file: + convert_file( + input_file=input_file, + output_file=output_file, + out_type=EXT, + debug=True, + ) + +# TOTAL = len(files) +# for idx, file_name in enumerate(files): +# file_name_no_ext = re.sub(r'\.pdf$',"", file_name) +# input_file_path = os.path.join(INPUT_FOLDER, file_name) +# output_file_path = os.path.join(OUTPUT_FOLDER, file_name_no_ext + "." + EXT) + +# if len(file_name) > len(file_name_no_ext): +# print(f"processing {file_name} {idx}/{TOTAL}") + # with open(input_file_path, 'rb') as input_file: + # with open(output_file_path, 'wb') as output_file: + # convert_file( + # input_file=input_file, + # output_file=output_file, + # out_type=EXT, + # debug=True, + # ) +# print(f" > testing format {file_name} {idx}/{TOTAL}") +# ElementTree.parse(output_file_path) +# print(f"processing {idx+1}/{TOTAL}") \ No newline at end of file diff --git a/setup.py b/setup.py index 2d28c34..d29795e 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ import sys with open('README.md') as readme_file: SETUP = { "name": "pdfmajor", - "version": "1.1.7", + "version": "1.1.8", "packages": find_packages(include=['pdfmajor*']), "install_requires": [ 'pycryptodome',