diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..49d23d0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,38 @@ +{ + "editor.codeActionsOnSave": { + "source.organizeImports": true, + }, + "editor.formatOnSave": true, + "editor.rulers": [ + 120 + ], + "editor.tabSize": 4, + "editor.wordWrap": "wordWrapColumn", + "editor.wordWrapColumn": 120, + "files.insertFinalNewline": true, + "files.trimFinalNewlines": true, + "files.trimTrailingWhitespace": true, + "isort.args": [ + "-l", + "120", + "--profile=black", + // "--src=${workspaceFolder}" + ], + "python.formatting.autopep8Args": [ + "--max-line-length", + "120", + "--experimental" + ], + "python.formatting.provider": "autopep8", + "python.formatting.blackArgs": [ + "--line-length=120" + ], + "python.linting.enabled": true, + "python.linting.flake8Enabled": true, + "python.linting.flake8Args": [ + "--max-line-length=120", + //Added the ignore of E203 for now : https://github.com/PyCQA/pycodestyle/issues/373 + "--ignore=E203,W503" + ], + "python.linting.pylintEnabled": false, +} diff --git a/document_preview/document_preview.py b/document_preview/document_preview.py index 319eccb..5276feb 100644 --- a/document_preview/document_preview.py +++ b/document_preview/document_preview.py @@ -1,17 +1,15 @@ import os import subprocess import tempfile - -from natsort import natsorted -from pdf2image import convert_from_path from time import time from assemblyline_v4_service.common.base import ServiceBase -from assemblyline_v4_service.common.result import Result, ResultImageSection -from assemblyline_v4_service.common.request import ServiceRequest as Request from assemblyline_v4_service.common.helper import get_service_manifest - +from assemblyline_v4_service.common.request import ServiceRequest as Request +from assemblyline_v4_service.common.result import Result, ResultImageSection from document_preview.helper.emlrender import processEml as eml2image +from natsort import natsorted +from pdf2image import convert_from_path class DocumentPreview(ServiceBase): diff --git a/document_preview/helper/emlrender.py b/document_preview/helper/emlrender.py index bf00c34..be74e8a 100644 --- a/document_preview/helper/emlrender.py +++ b/document_preview/helper/emlrender.py @@ -10,15 +10,16 @@ # - "offline" mode when rendering HTML code # -import os -import sys +import base64 import email import email.header +import os import quopri -import base64 -import regex +import sys from tempfile import NamedTemporaryFile +import regex + try: import imgkit except: diff --git a/document_preview/helper/outlookmsgfile.py b/document_preview/helper/outlookmsgfile.py index 1fb4f82..e88d930 100644 --- a/document_preview/helper/outlookmsgfile.py +++ b/document_preview/helper/outlookmsgfile.py @@ -18,7 +18,6 @@ import os import re import sys - from email.utils import formataddr, formatdate, parsedate_to_datetime from functools import reduce