mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-14 00:26:21 +00:00
Chore: Initial conversion to pytest fixtures (#7110)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from django.conf import settings
|
||||
from PIL import Image
|
||||
@@ -15,7 +15,7 @@ class TextDocumentParser(DocumentParser):
|
||||
|
||||
logging_name = "paperless.parsing.text"
|
||||
|
||||
def get_thumbnail(self, document_path, mime_type, file_name=None):
|
||||
def get_thumbnail(self, document_path: Path, mime_type, file_name=None) -> Path:
|
||||
text = self.read_file_handle_unicode_errors(document_path)
|
||||
|
||||
img = Image.new("RGB", (500, 700), color="white")
|
||||
@@ -27,7 +27,7 @@ class TextDocumentParser(DocumentParser):
|
||||
)
|
||||
draw.text((5, 5), text, font=font, fill="black")
|
||||
|
||||
out_path = os.path.join(self.tempdir, "thumb.webp")
|
||||
out_path = self.tempdir / "thumb.webp"
|
||||
img.save(out_path, format="WEBP")
|
||||
|
||||
return out_path
|
||||
|
Reference in New Issue
Block a user