psdi-data-conversion 0.0.33__tar.gz → 0.0.36__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.
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/.github/workflows/ci-cron.yml +1 -1
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/.github/workflows/ci-release.yml +1 -1
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/.github/workflows/job-anchore-scan.yml +1 -1
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/.github/workflows/job-publish-doc.yml +1 -1
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/PKG-INFO +29 -6
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/README.md +28 -5
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/app.py +23 -3
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/constants.py +2 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/converter.py +16 -6
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/converters/atomsk.py +3 -1
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/converters/base.py +99 -39
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/converters/c2x.py +3 -1
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/converters/openbabel.py +40 -1
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/database.py +5 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/main.py +18 -10
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/content/accessibility.htm +5 -5
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/content/convert.htm +31 -15
- psdi_data_conversion-0.0.36/psdi_data_conversion/static/content/convertato.htm +87 -0
- psdi_data_conversion-0.0.36/psdi_data_conversion/static/content/convertc2x.htm +88 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/content/documentation.htm +4 -4
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/content/download.htm +4 -1
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/content/feedback.htm +4 -4
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/content/index-versions/psdi-common-header.html +1 -1
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/content/psdi-common-header.html +1 -1
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/content/report.htm +9 -7
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/javascript/common.js +20 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/javascript/convert.js +1 -2
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/javascript/convert_common.js +100 -7
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/javascript/convertato.js +1 -2
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/javascript/convertc2x.js +1 -2
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/javascript/format.js +12 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/javascript/report.js +6 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/styles/format.css +13 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/styles/psdi-common.css +5 -2
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/templates/index.htm +4 -1
- psdi_data_conversion-0.0.36/psdi_data_conversion/testing/conversion_test_specs.py +299 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/testing/utils.py +22 -7
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/pyproject.toml +15 -7
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/run_local.sh +7 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/tests/cli_test.py +20 -84
- psdi_data_conversion-0.0.36/tests/converter_test.py +78 -0
- psdi_data_conversion-0.0.33/psdi_data_conversion/static/content/convertato.htm +0 -69
- psdi_data_conversion-0.0.33/psdi_data_conversion/static/content/convertc2x.htm +0 -69
- psdi_data_conversion-0.0.33/psdi_data_conversion/testing/conversion_test_specs.py +0 -208
- psdi_data_conversion-0.0.33/test_data/output/caffeine-no-flags.smi +0 -1
- psdi_data_conversion-0.0.33/test_data/output/caffeine_a_in.smi +0 -1
- psdi_data_conversion-0.0.33/test_data/output/caffeine_a_in_kx_f4_l5_out.smi +0 -1
- psdi_data_conversion-0.0.33/test_data/output/caffeine_a_in_kx_f4_out.smi +0 -1
- psdi_data_conversion-0.0.33/test_data/output/caffeine_a_in_kx_out.smi +0 -1
- psdi_data_conversion-0.0.33/test_data/output/caffeine_a_in_x_out.smi +0 -1
- psdi_data_conversion-0.0.33/test_data/output/error_Fapatite_ins_to_cml_OB +0 -33
- psdi_data_conversion-0.0.33/test_data/output/error_cyclopropane_mol_to_xyz_c2x +0 -33
- psdi_data_conversion-0.0.33/test_data/output/error_nacl_mol_to_xyz_atomsk +0 -33
- psdi_data_conversion-0.0.33/tests/converter_test.py +0 -143
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/.github/workflows/ci-deploy-production.yml +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/.github/workflows/ci-feature.yml +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/.github/workflows/ci-main.yml +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/.github/workflows/ci-pr.yml +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/.github/workflows/ci-rc-hotfix.yml +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/.github/workflows/job-container-push.yml +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/.github/workflows/job-deploy-k8s.yml +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/.github/workflows/job-open-pull-request.yml +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/.github/workflows/job-tag.yml +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/.github/workflows/job-test-gui.yml +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/.github/workflows/job-test-python.yml +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/.gitignore +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/CHANGELOG.md +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/CONTRIBUTING.md +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/LICENSE +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/__init__.py +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/bin/LICENSE_ATOMSK +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/bin/LICENSE_C2X +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/bin/linux/atomsk +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/bin/linux/c2x +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/bin/mac/atomsk +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/bin/mac/c2x +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/converters/__init__.py +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/dist.py +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/file_io.py +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/log_utility.py +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/scripts/atomsk.sh +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/scripts/c2x.sh +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/security.py +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/content/header-links.html +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/content/index-versions/header-links.html +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/content/index-versions/psdi-common-footer.html +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/content/psdi-common-footer.html +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/data/data.json +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/colormode-toggle-dm.svg +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/colormode-toggle-lm.svg +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/psdi-icon-dark.svg +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/psdi-icon-light.svg +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/psdi-logo-darktext-simple.png +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/psdi-logo-darktext.png +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/psdi-logo-lighttext-simple.png +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/psdi-logo-lighttext.png +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/social-logo-bluesky-black.svg +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/social-logo-bluesky-white.svg +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/social-logo-instagram-black.svg +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/social-logo-instagram-white.svg +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/social-logo-linkedin-black.png +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/social-logo-linkedin-white.png +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/social-logo-mastodon-black.svg +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/social-logo-mastodon-white.svg +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/social-logo-x-black.svg +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/social-logo-x-white.svg +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/social-logo-youtube-black.png +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/social-logo-youtube-white.png +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/ukri-epsr-logo-darktext.png +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/ukri-epsr-logo-lighttext.png +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/ukri-logo-darktext.png +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/img/ukri-logo-lighttext.png +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/javascript/accessibility.js +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/javascript/data.js +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/javascript/load_accessibility.js +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/static/javascript/psdi-common.js +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/testing/__init__.py +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/testing/constants.py +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/testing/conversion_callbacks.py +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/scripts/setup_bin.py +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/1ARJ.mmcif +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/1NE6.mmcif +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/5a9z-assembly1.cif +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/Fapatite.ins +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/aceticacid.mol +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/benzyne.molden +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/caffeine-smi.tar +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/caffeine-smi.tar.gz +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/caffeine-smi.zip +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/caffeine.inchi +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/ch3cl-esp.cub +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/cyclopropane_err.mol +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/ethanol.xyz +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/fullRhinovirus.pdb +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/hemoglobin.pdb +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/nacl.cif +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/nacl.mol +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/output/aceticacid.log.txt +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/output/aceticacid.mol2 +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/output/caffeine-2D-fastest.xyz +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/output/caffeine-3D-best.xyz +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/output/caffeine.smi +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/output/caffeine.xyz +0 -0
- /psdi_data_conversion-0.0.33/test_data/output/caffeine-ia.smi → /psdi_data_conversion-0.0.36/test_data/output/caffeine_a_in.smi +0 -0
- /psdi_data_conversion-0.0.33/test_data/output/caffeine-ia-okx-oof4l5.smi → /psdi_data_conversion-0.0.36/test_data/output/caffeine_a_in_kx_f4_l5_out.smi +0 -0
- /psdi_data_conversion-0.0.33/test_data/output/caffeine-ia-okx-oof4.smi → /psdi_data_conversion-0.0.36/test_data/output/caffeine_a_in_kx_f4_out.smi +0 -0
- /psdi_data_conversion-0.0.33/test_data/output/caffeine-ia-okx.smi → /psdi_data_conversion-0.0.36/test_data/output/caffeine_a_in_kx_out.smi +0 -0
- /psdi_data_conversion-0.0.33/test_data/output/caffeine-ia-ox.smi → /psdi_data_conversion-0.0.36/test_data/output/caffeine_a_in_x_out.smi +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/output/hemoglobin_Atomsk.xyz +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/output/hemoglobin_c2x.xyz +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/output/nacl.log +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/output/nacl.mol +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/output/quartz_OB.cif +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/output/quartz_OB.log.txt +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/output/quartz_atomsk.cif +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/output/quartz_atomsk.log.txt +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/output/standard_test.inchi +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/output/xyz_files-mol.zip +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/output/xyz_files.log.txt +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/periodic_dmol3.outmol +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/quartz.xyz +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/quartz_err.xyz +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/test_data/standard_test.cdxml +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/tests/database_test.py +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/tests/dist_test.py +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/tests/file_io_test.py +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/tests/logging_test.py +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/tests/security_test.py +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/tests/selenium/files/standard_test.cdxml +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/tests/selenium/run.sh +0 -0
- {psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/tests/selenium/selenium_tests.py +0 -0
{psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/.github/workflows/job-anchore-scan.yml
RENAMED
@@ -32,7 +32,7 @@ jobs:
|
|
32
32
|
contents: read # for actions/checkout to fetch code
|
33
33
|
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
|
34
34
|
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
|
35
|
-
runs-on:
|
35
|
+
runs-on: psdi-uk-runners
|
36
36
|
steps:
|
37
37
|
- name: Check out the code
|
38
38
|
uses: actions/checkout@v4
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: psdi_data_conversion
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.36
|
4
4
|
Summary: Chemistry file format conversion service, provided by PSDI
|
5
5
|
Project-URL: Homepage, https://data-conversion.psdi.ac.uk/
|
6
6
|
Project-URL: Documentation, https://psdi-uk.github.io/psdi-data-conversion/
|
@@ -403,13 +403,21 @@ In addition to the dependencies listed above, this project uses the assets made
|
|
403
403
|
|
404
404
|
### Installation
|
405
405
|
|
406
|
-
The CLA and Python library are installed together. This
|
406
|
+
The CLA and Python library are installed together. This project is available on PyPI, and so can be installed via pip with:
|
407
|
+
|
408
|
+
```bash
|
409
|
+
pip install psdi-data-conversion
|
410
|
+
```
|
411
|
+
|
412
|
+
If you wish to install from source, this can be done most easily by cloning the project and then executing:
|
407
413
|
|
408
414
|
```bash
|
409
415
|
pip install .
|
410
416
|
```
|
411
417
|
|
412
|
-
|
418
|
+
from this project's directory. You can also replace the '.' in this command with the path to this project's directory to install it from elsewhere.
|
419
|
+
|
420
|
+
**Note:** This project uses git to determine the version number. If you clone the repository, you won't have to do anything special here, but if you get the source e.g. by extracting a release archive, you'll have to do one additional step before running the command above. If you have git installed, simply run `git init` in the project directory and it will be able to install. Otherwise, edit the project's `pyproject.toml` file to uncomment the line that sets a fixed version, and comment out the lines that set it up to determine the version from git - these are pointed out in the comments there.
|
413
421
|
|
414
422
|
Depending on your system, it may not be possible to install packages in this manner without creating a virtual environment to do so in. You can do this by first installing the `venv` module for Python3 with e.g.:
|
415
423
|
|
@@ -572,15 +580,23 @@ Enter https://data-conversion.psdi.ac.uk/ in a browser. Guidance on usage is giv
|
|
572
580
|
|
573
581
|
### Installation and Setup
|
574
582
|
|
575
|
-
|
583
|
+
This project is available on PyPI, and so can be installed via pip, including the necessary dependencies for the GUI, with:
|
584
|
+
|
585
|
+
```bash
|
586
|
+
pip install psdi-data-conversion'[gui]'
|
587
|
+
```
|
588
|
+
|
589
|
+
If you wish to install the project locally from source, this can be done most easily by cloning the project and then executing:
|
576
590
|
|
577
591
|
```bash
|
578
592
|
pip install .'[gui]'
|
579
593
|
```
|
580
594
|
|
581
|
-
If
|
595
|
+
**Note:** This project uses git to determine the version number. If you clone the repository, you won't have to do anything special here, but if you get the source e.g. by extracting a release archive, you'll have to do one additional step before running the command above. If you have git installed, simply run `git init` in the project directory and it will be able to install. Otherwise, edit the project's `pyproject.toml` file to uncomment the line that sets a fixed version, and comment out the lines that set it up to determine the version from git - these are pointed out in the comments there.
|
582
596
|
|
583
|
-
If
|
597
|
+
If your system does not allow installation in this manner, it may be necessary to set up a virtual environment. See the instructions in the [command-line application installation](#installation) section above for how to do that, and then try to install again once you've set one up and activated it.
|
598
|
+
|
599
|
+
If you've installed this repository from source, you can use the provided `run_local.sh` bash script to run the application. Otherwise (e.g. if you've installed from a wheel or PyPI), copy and paste the following into a script:
|
584
600
|
|
585
601
|
```bash
|
586
602
|
#!/bin/bash
|
@@ -590,6 +606,13 @@ if [ -z $MAX_FILESIZE ]; then
|
|
590
606
|
export MAX_FILESIZE=0
|
591
607
|
fi
|
592
608
|
|
609
|
+
# The envvar MAX_FILESIZE_OB can be used to set the maximum allowed filesize in MB for the Open Babel converter - 0
|
610
|
+
# indicates no maximum. This is currently set to 1 MB by default as the converter seems to hang above this limit (not
|
611
|
+
# even allowing the process to be cancelled). This can be changed in the future if this is patched
|
612
|
+
if [ -z $MAX_FILESIZE_OB ]; then
|
613
|
+
export MAX_FILESIZE_OB=1
|
614
|
+
fi
|
615
|
+
|
593
616
|
# Logging control - "full" sets server-style logging, which is necessary to produce the output logs with the expected
|
594
617
|
# names. This should not be changed, or else errors will occur
|
595
618
|
export LOG_MODE=full
|
@@ -158,13 +158,21 @@ In addition to the dependencies listed above, this project uses the assets made
|
|
158
158
|
|
159
159
|
### Installation
|
160
160
|
|
161
|
-
The CLA and Python library are installed together. This
|
161
|
+
The CLA and Python library are installed together. This project is available on PyPI, and so can be installed via pip with:
|
162
|
+
|
163
|
+
```bash
|
164
|
+
pip install psdi-data-conversion
|
165
|
+
```
|
166
|
+
|
167
|
+
If you wish to install from source, this can be done most easily by cloning the project and then executing:
|
162
168
|
|
163
169
|
```bash
|
164
170
|
pip install .
|
165
171
|
```
|
166
172
|
|
167
|
-
|
173
|
+
from this project's directory. You can also replace the '.' in this command with the path to this project's directory to install it from elsewhere.
|
174
|
+
|
175
|
+
**Note:** This project uses git to determine the version number. If you clone the repository, you won't have to do anything special here, but if you get the source e.g. by extracting a release archive, you'll have to do one additional step before running the command above. If you have git installed, simply run `git init` in the project directory and it will be able to install. Otherwise, edit the project's `pyproject.toml` file to uncomment the line that sets a fixed version, and comment out the lines that set it up to determine the version from git - these are pointed out in the comments there.
|
168
176
|
|
169
177
|
Depending on your system, it may not be possible to install packages in this manner without creating a virtual environment to do so in. You can do this by first installing the `venv` module for Python3 with e.g.:
|
170
178
|
|
@@ -327,15 +335,23 @@ Enter https://data-conversion.psdi.ac.uk/ in a browser. Guidance on usage is giv
|
|
327
335
|
|
328
336
|
### Installation and Setup
|
329
337
|
|
330
|
-
|
338
|
+
This project is available on PyPI, and so can be installed via pip, including the necessary dependencies for the GUI, with:
|
339
|
+
|
340
|
+
```bash
|
341
|
+
pip install psdi-data-conversion'[gui]'
|
342
|
+
```
|
343
|
+
|
344
|
+
If you wish to install the project locally from source, this can be done most easily by cloning the project and then executing:
|
331
345
|
|
332
346
|
```bash
|
333
347
|
pip install .'[gui]'
|
334
348
|
```
|
335
349
|
|
336
|
-
If
|
350
|
+
**Note:** This project uses git to determine the version number. If you clone the repository, you won't have to do anything special here, but if you get the source e.g. by extracting a release archive, you'll have to do one additional step before running the command above. If you have git installed, simply run `git init` in the project directory and it will be able to install. Otherwise, edit the project's `pyproject.toml` file to uncomment the line that sets a fixed version, and comment out the lines that set it up to determine the version from git - these are pointed out in the comments there.
|
337
351
|
|
338
|
-
If
|
352
|
+
If your system does not allow installation in this manner, it may be necessary to set up a virtual environment. See the instructions in the [command-line application installation](#installation) section above for how to do that, and then try to install again once you've set one up and activated it.
|
353
|
+
|
354
|
+
If you've installed this repository from source, you can use the provided `run_local.sh` bash script to run the application. Otherwise (e.g. if you've installed from a wheel or PyPI), copy and paste the following into a script:
|
339
355
|
|
340
356
|
```bash
|
341
357
|
#!/bin/bash
|
@@ -345,6 +361,13 @@ if [ -z $MAX_FILESIZE ]; then
|
|
345
361
|
export MAX_FILESIZE=0
|
346
362
|
fi
|
347
363
|
|
364
|
+
# The envvar MAX_FILESIZE_OB can be used to set the maximum allowed filesize in MB for the Open Babel converter - 0
|
365
|
+
# indicates no maximum. This is currently set to 1 MB by default as the converter seems to hang above this limit (not
|
366
|
+
# even allowing the process to be cancelled). This can be changed in the future if this is patched
|
367
|
+
if [ -z $MAX_FILESIZE_OB ]; then
|
368
|
+
export MAX_FILESIZE_OB=1
|
369
|
+
fi
|
370
|
+
|
348
371
|
# Logging control - "full" sets server-style logging, which is necessary to produce the output logs with the expected
|
349
372
|
# names. This should not be changed, or else errors will occur
|
350
373
|
export LOG_MODE=full
|
@@ -102,8 +102,16 @@ def website():
|
|
102
102
|
else:
|
103
103
|
max_file_size = const.DEFAULT_MAX_FILE_SIZE
|
104
104
|
|
105
|
+
# And same for the Open Babel maximum file size
|
106
|
+
ev_max_file_size_ob = os.environ.get(const.MAX_FILESIZE_OB_EV)
|
107
|
+
if ev_max_file_size_ob is not None:
|
108
|
+
max_file_size_ob = float(ev_max_file_size_ob)*const.MEGABYTE
|
109
|
+
else:
|
110
|
+
max_file_size_ob = const.DEFAULT_MAX_FILE_SIZE_OB
|
111
|
+
|
105
112
|
data = [{'token': token,
|
106
113
|
'max_file_size': max_file_size,
|
114
|
+
'max_file_size_ob': max_file_size_ob,
|
107
115
|
'service_mode': service_mode,
|
108
116
|
'production_mode': production_mode,
|
109
117
|
'sha': get_last_sha()}]
|
@@ -150,11 +158,23 @@ def convert():
|
|
150
158
|
fo.write(str(e))
|
151
159
|
abort(const.STATUS_CODE_GENERAL)
|
152
160
|
|
153
|
-
#
|
154
|
-
|
161
|
+
# If the exception provides a status code, get it
|
162
|
+
status_code: int
|
163
|
+
if hasattr(e, "status_code"):
|
164
|
+
status_code = e.status_code
|
165
|
+
else:
|
166
|
+
status_code = const.STATUS_CODE_GENERAL
|
167
|
+
|
168
|
+
# If the exception provides a message, report it
|
169
|
+
if hasattr(e, "message"):
|
170
|
+
msg = f"An unexpected exception was raised by the converter, with error message:\n{e.message}\n"
|
171
|
+
else:
|
172
|
+
# Failsafe exception message
|
173
|
+
msg = ("The following unexpected exception was raised by the converter:\n" +
|
174
|
+
traceback.format_exc()+"\n")
|
155
175
|
with open(qualified_output_log, "w") as fo:
|
156
176
|
fo.write(msg)
|
157
|
-
abort(
|
177
|
+
abort(status_code)
|
158
178
|
|
159
179
|
return repr(conversion_output)
|
160
180
|
else:
|
{psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/constants.py
RENAMED
@@ -40,6 +40,7 @@ CL_SCRIPT_NAME = "psdi-data-convert"
|
|
40
40
|
LOG_MODE_EV = "LOG_MODE"
|
41
41
|
LOG_LEVEL_EV = "LOG_LEVEL"
|
42
42
|
MAX_FILESIZE_EV = "MAX_FILESIZE"
|
43
|
+
MAX_FILESIZE_OB_EV = "MAX_FILESIZE_OB"
|
43
44
|
|
44
45
|
# Files and Folders
|
45
46
|
# -----------------
|
@@ -47,6 +48,7 @@ MAX_FILESIZE_EV = "MAX_FILESIZE"
|
|
47
48
|
# Maximum output file size in bytes
|
48
49
|
MEGABYTE = 1024*1024
|
49
50
|
DEFAULT_MAX_FILE_SIZE = 0*MEGABYTE
|
51
|
+
DEFAULT_MAX_FILE_SIZE_OB = 1*MEGABYTE
|
50
52
|
|
51
53
|
DEFAULT_UPLOAD_DIR = './psdi_data_conversion/static/uploads'
|
52
54
|
DEFAULT_DOWNLOAD_DIR = './psdi_data_conversion/static/downloads'
|
{psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/converter.py
RENAMED
@@ -17,6 +17,7 @@ from psdi_data_conversion.converters import base
|
|
17
17
|
|
18
18
|
import glob
|
19
19
|
|
20
|
+
from psdi_data_conversion.converters.openbabel import CONVERTER_OB
|
20
21
|
from psdi_data_conversion.file_io import (is_archive, is_supported_archive, pack_zip_or_tar, split_archive_ext,
|
21
22
|
unpack_zip_or_tar)
|
22
23
|
|
@@ -105,7 +106,8 @@ def get_converter(*args, name=const.CONVERTER_DEFAULT, **converter_kwargs) -> ba
|
|
105
106
|
name : str
|
106
107
|
The desired converter type, by default 'Open Babel'
|
107
108
|
data : dict[str | Any] | None
|
108
|
-
A dict of any other data needed by a converter or for extra logging information, default empty dict
|
109
|
+
A dict of any other data needed by a converter or for extra logging information, default empty dict. See the
|
110
|
+
docstring of each converter for supported keys and values that can be passed to `data` here
|
109
111
|
abort_callback : Callable[[int], None]
|
110
112
|
Function to be called if the conversion hits an error and must be aborted, default `abort_raise`, which
|
111
113
|
raises an appropriate exception
|
@@ -117,7 +119,9 @@ def get_converter(*args, name=const.CONVERTER_DEFAULT, **converter_kwargs) -> ba
|
|
117
119
|
download_dir : str
|
118
120
|
The location of output files relative to the current directory
|
119
121
|
max_file_size : float
|
120
|
-
The maximum allowed file size for input/output files, in MB, default 1 MB
|
122
|
+
The maximum allowed file size for input/output files, in MB, default 1 MB for Open Babel, unlimited for other
|
123
|
+
converters. If 0, will be unlimited. If an archive of files is provided, this will apply to the total of all
|
124
|
+
files contained in it
|
121
125
|
no_check : bool
|
122
126
|
If False (default), will check at setup whether or not a conversion between the desired file formats is
|
123
127
|
supported with the specified converter
|
@@ -238,7 +242,7 @@ def run_converter(filename: str,
|
|
238
242
|
*args,
|
239
243
|
from_format: str | None = None,
|
240
244
|
download_dir=const.DEFAULT_DOWNLOAD_DIR,
|
241
|
-
max_file_size=
|
245
|
+
max_file_size=None,
|
242
246
|
log_file: str | None = None,
|
243
247
|
log_mode=const.LOG_SIMPLE,
|
244
248
|
strict=False,
|
@@ -261,7 +265,8 @@ def run_converter(filename: str,
|
|
261
265
|
name : str
|
262
266
|
The desired converter type, by default 'Open Babel'
|
263
267
|
data : dict[str | Any] | None
|
264
|
-
A dict of any other data needed by a converter or for extra logging information, default empty dict
|
268
|
+
A dict of any other data needed by a converter or for extra logging information, default empty dict. See the
|
269
|
+
docstring of each converter for supported keys and values that can be passed to `data` here
|
265
270
|
abort_callback : Callable[[int], None]
|
266
271
|
Function to be called if the conversion hits an error and must be aborted, default `abort_raise`, which
|
267
272
|
raises an appropriate exception
|
@@ -280,8 +285,9 @@ def run_converter(filename: str,
|
|
280
285
|
into a file of the same format, their logs will be combined into a single log, and the converted files and
|
281
286
|
individual logs will be deleted
|
282
287
|
max_file_size : float
|
283
|
-
The maximum allowed file size for input/output files, in MB, default 1 MB
|
284
|
-
archive of files is provided, this will apply to the total of all
|
288
|
+
The maximum allowed file size for input/output files, in MB, default 1 MB for Open Babel, unlimited for other
|
289
|
+
converters. If 0, will be unlimited. If an archive of files is provided, this will apply to the total of all
|
290
|
+
files contained in it
|
285
291
|
no_check : bool
|
286
292
|
If False (default), will check at setup whether or not a conversion between the desired file formats is
|
287
293
|
supported with the specified converter
|
@@ -318,6 +324,10 @@ def run_converter(filename: str,
|
|
318
324
|
If something goes wrong during the conversion process
|
319
325
|
"""
|
320
326
|
|
327
|
+
# Set the maximum file size based on which converter is being used if using the default
|
328
|
+
if max_file_size is None:
|
329
|
+
max_file_size = const.DEFAULT_MAX_FILE_SIZE_OB if name == CONVERTER_OB else const.DEFAULT_MAX_FILE_SIZE
|
330
|
+
|
321
331
|
# Set the log file if it was unset - note that in server logging mode, this value won't be used within the
|
322
332
|
# converter class, so it needs to be set up here to match what will be set up there
|
323
333
|
if log_file is None:
|
@@ -11,7 +11,9 @@ CONVERTER_ATO = 'Atomsk'
|
|
11
11
|
|
12
12
|
|
13
13
|
class AtoFileConverter(ScriptFileConverter):
|
14
|
-
"""File Converter specialized to use Atomsk for conversions
|
14
|
+
"""File Converter specialized to use Atomsk for conversions.
|
15
|
+
|
16
|
+
This converter does not yet support any additional configuration options provided at class init to the `data` kwarg.
|
15
17
|
"""
|
16
18
|
|
17
19
|
name = CONVERTER_ATO
|
{psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/converters/base.py
RENAMED
@@ -34,7 +34,12 @@ except ImportError:
|
|
34
34
|
class FileConverterException(RuntimeError):
|
35
35
|
"""Exception class to represent any runtime error encountered by this package.
|
36
36
|
"""
|
37
|
-
|
37
|
+
|
38
|
+
def __init__(self,
|
39
|
+
*args,
|
40
|
+
logged: bool = False):
|
41
|
+
super().__init__(*args)
|
42
|
+
self.logged = logged
|
38
43
|
|
39
44
|
|
40
45
|
class FileConverterAbortException(FileConverterException):
|
@@ -212,7 +217,7 @@ class FileConverter:
|
|
212
217
|
use_envvars=False,
|
213
218
|
upload_dir=const.DEFAULT_UPLOAD_DIR,
|
214
219
|
download_dir=const.DEFAULT_DOWNLOAD_DIR,
|
215
|
-
max_file_size=
|
220
|
+
max_file_size=None,
|
216
221
|
no_check=False,
|
217
222
|
log_file: str | None = None,
|
218
223
|
log_mode=const.LOG_FULL,
|
@@ -231,7 +236,8 @@ class FileConverter:
|
|
231
236
|
The format to convert from, as the file extension (e.g. "pdb"). If None is provided (default), will be
|
232
237
|
determined from the extension of `filename`
|
233
238
|
data : dict[str | Any] | None
|
234
|
-
A dict of any other data needed by a converter or for extra logging information, default empty dict
|
239
|
+
A dict of any other data needed by a converter or for extra logging information, default empty dict. See the
|
240
|
+
docstring of each converter for supported keys and values that can be passed to `data` here
|
235
241
|
abort_callback : Callable[[int], None]
|
236
242
|
Function to be called if the conversion hits an error and must be aborted, default `abort_raise`, which
|
237
243
|
raises an appropriate exception
|
@@ -275,12 +281,32 @@ class FileConverter:
|
|
275
281
|
|
276
282
|
try:
|
277
283
|
|
284
|
+
if max_file_size is None:
|
285
|
+
from psdi_data_conversion.converters.openbabel import CONVERTER_OB
|
286
|
+
if self.name == CONVERTER_OB:
|
287
|
+
self.max_file_size = const.DEFAULT_MAX_FILE_SIZE_OB*const.MEGABYTE
|
288
|
+
else:
|
289
|
+
self.max_file_size = const.DEFAULT_MAX_FILE_SIZE*const.MEGABYTE
|
290
|
+
else:
|
291
|
+
self.max_file_size = max_file_size*const.MEGABYTE
|
292
|
+
|
293
|
+
# Set values from envvars if desired
|
294
|
+
if use_envvars:
|
295
|
+
# Get the maximum allowed size from the envvar for it
|
296
|
+
from psdi_data_conversion.converters.openbabel import CONVERTER_OB
|
297
|
+
if self.name == CONVERTER_OB:
|
298
|
+
ev_max_file_size = os.environ.get(const.MAX_FILESIZE_OB_EV)
|
299
|
+
else:
|
300
|
+
ev_max_file_size = os.environ.get(const.MAX_FILESIZE_EV)
|
301
|
+
|
302
|
+
if ev_max_file_size is not None:
|
303
|
+
self.max_file_size = float(ev_max_file_size)*const.MEGABYTE
|
304
|
+
|
278
305
|
# Set member variables directly from input
|
279
306
|
self.in_filename = filename
|
280
307
|
self.to_format = to_format
|
281
308
|
self.upload_dir = upload_dir
|
282
309
|
self.download_dir = download_dir
|
283
|
-
self.max_file_size = max_file_size*const.MEGABYTE
|
284
310
|
self.log_file = log_file
|
285
311
|
self.log_mode = log_mode
|
286
312
|
self.log_level = log_level
|
@@ -312,13 +338,6 @@ class FileConverter:
|
|
312
338
|
self.err: str | None = None
|
313
339
|
self.quality: str | None = None
|
314
340
|
|
315
|
-
# Set values from envvars if desired
|
316
|
-
if use_envvars:
|
317
|
-
# Get the maximum allowed size from the envvar for it
|
318
|
-
ev_max_file_size = os.environ.get(const.MAX_FILESIZE_EV)
|
319
|
-
if ev_max_file_size is not None:
|
320
|
-
self.max_file_size = float(ev_max_file_size)*const.MEGABYTE
|
321
|
-
|
322
341
|
# Create directory 'uploads' if not extant.
|
323
342
|
if not os.path.exists(self.upload_dir):
|
324
343
|
os.makedirs(self.upload_dir, exist_ok=True)
|
@@ -351,10 +370,13 @@ class FileConverter:
|
|
351
370
|
self.logger.debug("Finished FileConverter initialisation")
|
352
371
|
|
353
372
|
except Exception as e:
|
373
|
+
# Don't catch a deliberate abort; let it pass through
|
354
374
|
if isinstance(e, l_abort_exceptions):
|
355
|
-
|
356
|
-
|
357
|
-
|
375
|
+
if not hasattr(e, "logged") or e.logged is False:
|
376
|
+
self.logger.error(f"Unexpected exception raised while running the converter, of type '{type(e)}' "
|
377
|
+
f"with message: {str(e)}")
|
378
|
+
if e:
|
379
|
+
e.logged = True
|
358
380
|
raise
|
359
381
|
# Try to run the standard abort method. There's a good chance this will fail though depending on what went
|
360
382
|
# wrong when during init, so we fallback to printing the exception to stderr
|
@@ -362,6 +384,8 @@ class FileConverter:
|
|
362
384
|
if not isinstance(e, FileConverterHelpException):
|
363
385
|
self.logger.error(f"Exception triggering an abort was raised while initializing the converter. "
|
364
386
|
f"Exception was type '{type(e)}', with message: {str(e)}")
|
387
|
+
if e:
|
388
|
+
e.logged = True
|
365
389
|
self._abort(message="The application encountered an error while initializing the converter:\n" +
|
366
390
|
traceback.format_exc(), e=e)
|
367
391
|
except Exception as ee:
|
@@ -445,20 +469,28 @@ class FileConverter:
|
|
445
469
|
"""
|
446
470
|
|
447
471
|
try:
|
472
|
+
self.logger.debug("Checking input file size")
|
473
|
+
self._check_input_file_size_and_status()
|
474
|
+
|
448
475
|
self.logger.debug("Starting file conversion")
|
449
476
|
self._convert()
|
450
477
|
|
451
478
|
self.logger.debug("Finished file conversion; performing cleanup tasks")
|
452
479
|
self._finish_convert()
|
453
480
|
except Exception as e:
|
481
|
+
# Don't catch a deliberate abort; let it pass through
|
454
482
|
if isinstance(e, l_abort_exceptions):
|
455
|
-
#
|
456
|
-
|
457
|
-
|
483
|
+
# Log the error if it hasn't yet been logged
|
484
|
+
if not hasattr(e, "logged") or e.logged is False:
|
485
|
+
self.logger.error(f"Unexpected exception raised while running the converter, of type '{type(e)}' "
|
486
|
+
f"with message: {str(e)}")
|
487
|
+
e.logged = True
|
458
488
|
raise
|
459
489
|
if not isinstance(e, FileConverterHelpException):
|
460
490
|
self.logger.error(f"Exception triggering an abort was raised while running the converter. Exception "
|
461
491
|
f"was type '{type(e)}', with message: {str(e)}")
|
492
|
+
if e:
|
493
|
+
e.logged = True
|
462
494
|
self._abort(message="The application encountered an error while running the converter:\n" +
|
463
495
|
traceback.format_exc(), e=e)
|
464
496
|
|
@@ -522,13 +554,23 @@ class FileConverter:
|
|
522
554
|
# Note this message in the dev logger as well
|
523
555
|
if not isinstance(e, FileConverterHelpException):
|
524
556
|
self.logger.error(message)
|
557
|
+
if e:
|
558
|
+
e.logged = True
|
525
559
|
|
526
|
-
# Call the abort callback function now. We first try
|
527
|
-
# we fall back to just calling it with the status code
|
560
|
+
# Call the abort callback function now. We first try passing information to the callback function
|
528
561
|
try:
|
529
562
|
self.abort_callback(status_code, message, e=e, **kwargs)
|
530
563
|
except TypeError:
|
531
|
-
|
564
|
+
# The callback function doesn't support arguments, so we instead call the callback, catch any exception it
|
565
|
+
# raises, monkey-patch on the extra info, and reraise it
|
566
|
+
try:
|
567
|
+
self.abort_callback(status_code)
|
568
|
+
except Exception as ee:
|
569
|
+
ee.status_code = status_code
|
570
|
+
ee.message = message
|
571
|
+
ee.e = e
|
572
|
+
ee.abort_kwargs = kwargs
|
573
|
+
raise ee
|
532
574
|
|
533
575
|
def _abort_from_err(self):
|
534
576
|
"""Call an abort after a call to the converter has completed, but it's returned an error. Create a message for
|
@@ -538,7 +580,7 @@ class FileConverter:
|
|
538
580
|
self._create_message() +
|
539
581
|
self.out + '\n' +
|
540
582
|
self.err)
|
541
|
-
self._abort(message=self.err)
|
583
|
+
self._abort(message=self.err, logged=True)
|
542
584
|
|
543
585
|
def _create_message(self) -> str:
|
544
586
|
"""Create a log of options passed to the converter - this method should be overloaded to log any information
|
@@ -578,19 +620,38 @@ class FileConverter:
|
|
578
620
|
|
579
621
|
self.logger.info(message)
|
580
622
|
|
581
|
-
def
|
582
|
-
"""Get file
|
623
|
+
def _check_input_file_size_and_status(self):
|
624
|
+
"""Get input file size and status, checking that the file isn't too large
|
625
|
+
"""
|
583
626
|
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
627
|
+
try:
|
628
|
+
self.in_size = os.path.getsize(os.path.realpath(self.in_filename))
|
629
|
+
except FileNotFoundError:
|
630
|
+
# Something went wrong and the output file doesn't exist
|
631
|
+
err_message = f"Expected output file {self.in_filename} does not exist."
|
632
|
+
self.logger.error(err_message)
|
633
|
+
self.err += f"ERROR: {err_message}\n"
|
634
|
+
self._abort_from_err()
|
635
|
+
|
636
|
+
# Check that the input file doesn't exceed the maximum allowed size
|
637
|
+
if self.max_file_size > 0 and self.in_size > self.max_file_size:
|
638
|
+
|
639
|
+
self._abort(const.STATUS_CODE_SIZE,
|
640
|
+
f"ERROR converting {os.path.basename(self.in_filename)} to " +
|
641
|
+
os.path.basename(self.out_filename) + ": "
|
642
|
+
f"Input file exceeds maximum size.\nInput file size is "
|
643
|
+
f"{self.in_size/const.MEGABYTE:.2f} MB; maximum input file size is "
|
644
|
+
f"{self.max_file_size/const.MEGABYTE:.2f} MB.\n",
|
645
|
+
max_file_size=self.max_file_size,
|
646
|
+
in_size=self.in_size,
|
647
|
+
out_size=None)
|
648
|
+
|
649
|
+
def _check_output_file_size_and_status(self):
|
650
|
+
"""Get output file size and status, checking that the file isn't too large
|
590
651
|
"""
|
591
|
-
|
652
|
+
|
592
653
|
try:
|
593
|
-
out_size = os.path.getsize(os.path.realpath(self.out_filename))
|
654
|
+
self.out_size = os.path.getsize(os.path.realpath(self.out_filename))
|
594
655
|
except FileNotFoundError:
|
595
656
|
# Something went wrong and the output file doesn't exist
|
596
657
|
err_message = f"Expected output file {self.out_filename} does not exist."
|
@@ -599,20 +660,19 @@ class FileConverter:
|
|
599
660
|
self._abort_from_err()
|
600
661
|
|
601
662
|
# Check that the output file doesn't exceed the maximum allowed size
|
602
|
-
if self.max_file_size > 0 and out_size > self.max_file_size:
|
663
|
+
if self.max_file_size > 0 and self.out_size > self.max_file_size:
|
603
664
|
|
604
665
|
self._abort(const.STATUS_CODE_SIZE,
|
605
666
|
f"ERROR converting {os.path.basename(self.in_filename)} to " +
|
606
667
|
os.path.basename(self.out_filename) + ": "
|
607
668
|
f"Output file exceeds maximum size.\nInput file size is "
|
608
|
-
f"{in_size/const.MEGABYTE:.2f} MB; Output file size is {out_size/const.MEGABYTE:.2f} "
|
669
|
+
f"{self.in_size/const.MEGABYTE:.2f} MB; Output file size is {self.out_size/const.MEGABYTE:.2f} "
|
609
670
|
f"MB; maximum output file size is {self.max_file_size/const.MEGABYTE:.2f} MB.\n",
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
self.logger.debug(f"Output file found to have size {out_size/const.MEGABYTE:.2f} MB")
|
671
|
+
max_file_size=self.max_file_size,
|
672
|
+
in_size=self.in_size,
|
673
|
+
out_size=self.out_size)
|
614
674
|
|
615
|
-
|
675
|
+
self.logger.debug(f"Output file found to have size {self.out_size/const.MEGABYTE:.2f} MB")
|
616
676
|
|
617
677
|
def get_quality(self) -> str:
|
618
678
|
"""Query the JSON file to obtain conversion quality
|
@@ -630,7 +690,7 @@ class FileConverter:
|
|
630
690
|
"""Run final common steps to clean up a conversion and log success or abort due to an error
|
631
691
|
"""
|
632
692
|
|
633
|
-
self.
|
693
|
+
self._check_output_file_size_and_status()
|
634
694
|
|
635
695
|
if self.delete_input:
|
636
696
|
os.remove(self.in_filename)
|
{psdi_data_conversion-0.0.33 → psdi_data_conversion-0.0.36}/psdi_data_conversion/converters/c2x.py
RENAMED
@@ -11,7 +11,9 @@ CONVERTER_C2X = 'c2x'
|
|
11
11
|
|
12
12
|
|
13
13
|
class C2xFileConverter(ScriptFileConverter):
|
14
|
-
"""File Converter specialized to use c2x for conversions
|
14
|
+
"""File Converter specialized to use c2x for conversions.
|
15
|
+
|
16
|
+
This converter does not yet support any additional configuration options provided at class init to the `data` kwarg.
|
15
17
|
"""
|
16
18
|
|
17
19
|
name = CONVERTER_C2X
|