mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-29 18:22:37 +02:00
FIXUP: Remove dead code
This commit is contained in:
parent
92ca4b172f
commit
8e6e4a3b44
2 changed files with 0 additions and 27 deletions
|
@ -23,8 +23,6 @@ log = logging.getLogger(__name__)
|
||||||
MAX_CONVERSION_LOG_CHARS = 150 * 50 # up to ~150 lines of 50 characters
|
MAX_CONVERSION_LOG_CHARS = 150 * 50 # up to ~150 lines of 50 characters
|
||||||
DOC_TO_PIXELS_LOG_START = "----- DOC TO PIXELS LOG START -----"
|
DOC_TO_PIXELS_LOG_START = "----- DOC TO PIXELS LOG START -----"
|
||||||
DOC_TO_PIXELS_LOG_END = "----- DOC TO PIXELS LOG END -----"
|
DOC_TO_PIXELS_LOG_END = "----- DOC TO PIXELS LOG END -----"
|
||||||
PIXELS_TO_PDF_LOG_START = "----- PIXELS TO PDF LOG START -----"
|
|
||||||
PIXELS_TO_PDF_LOG_END = "----- PIXELS TO PDF LOG END -----"
|
|
||||||
|
|
||||||
TIMEOUT_EXCEPTION = 15
|
TIMEOUT_EXCEPTION = 15
|
||||||
TIMEOUT_GRACE = 15
|
TIMEOUT_GRACE = 15
|
||||||
|
|
|
@ -228,31 +228,6 @@ class Container(IsolationProvider):
|
||||||
"""Unique container name for the pixels-to-pdf phase."""
|
"""Unique container name for the pixels-to-pdf phase."""
|
||||||
return f"dangerzone-pixels-to-pdf-{document.id}"
|
return f"dangerzone-pixels-to-pdf-{document.id}"
|
||||||
|
|
||||||
def assert_field_type(self, val: Any, _type: object) -> None:
|
|
||||||
# XXX: Use a stricter check than isinstance because `bool` is a subclass of
|
|
||||||
# `int`.
|
|
||||||
#
|
|
||||||
# See https://stackoverflow.com/a/37888668
|
|
||||||
if type(val) is not _type:
|
|
||||||
raise ValueError("Status field has incorrect type")
|
|
||||||
|
|
||||||
def parse_progress_trusted(self, document: Document, line: str) -> None:
|
|
||||||
"""
|
|
||||||
Parses a line returned by the container.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
status = json.loads(line)
|
|
||||||
text = status["text"]
|
|
||||||
self.assert_field_type(text, str)
|
|
||||||
error = status["error"]
|
|
||||||
self.assert_field_type(error, bool)
|
|
||||||
percentage = status["percentage"]
|
|
||||||
self.assert_field_type(percentage, float)
|
|
||||||
self.print_progress(document, error, text, percentage)
|
|
||||||
except Exception:
|
|
||||||
error_message = f"Invalid JSON returned from container:\n\n\t {line}"
|
|
||||||
self.print_progress(document, True, error_message, -1)
|
|
||||||
|
|
||||||
def exec(
|
def exec(
|
||||||
self,
|
self,
|
||||||
args: List[str],
|
args: List[str],
|
||||||
|
|
Loading…
Reference in a new issue