diff options
author | Matthew Lemon <y@yulqen.org> | 2024-08-03 20:30:31 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-08-03 20:30:31 +0100 |
commit | a4de4737f0e97aa005281f9ac79482149a1d5bb7 (patch) | |
tree | 74f186cee81c811f765646eaba03c3b7f9a2e07d /pyblackbird_cc/resources/utils.py | |
parent | a53e1c79714d05807d42a50010b44d13721934c3 (diff) |
Add S3 utility module and refactor S3 functions into it
Created a new `s3.py` utility module for handling S3 interactions including file uploads and generating presigned URLs. Refactored views to utilize these new utility functions and moved the PDF collection type function to a new `utils.py` module to improve code organization and readability.
Diffstat (limited to 'pyblackbird_cc/resources/utils.py')
-rw-r--r-- | pyblackbird_cc/resources/utils.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pyblackbird_cc/resources/utils.py b/pyblackbird_cc/resources/utils.py new file mode 100644 index 0000000..d17aa69 --- /dev/null +++ b/pyblackbird_cc/resources/utils.py @@ -0,0 +1,10 @@ +def _get_pdf_collection_type(coll) -> str: + if len(coll) == 1 and len(coll[0]) == 1: + return "SINGLE_PDF_SINGLE_PAGE" + if len(coll) == 1 and len(coll[0]) > 1: + return "SINGLE_PDF_MULTI_PAGE" + if len(coll) > 1: + for c in coll: + if len(c) > 1: + return "MULTI_PDF_MULTI_PAGE" + return "MULTI_PDF_SINGLE_PAGE" |