mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-01 18:37:42 -05:00
Removes support for Python 3.8 and lower from the code base
This commit is contained in:

committed by
Trenton H

parent
c8bfbb9315
commit
650c816a7b
@@ -8,8 +8,6 @@ import traceback
|
||||
from datetime import date
|
||||
from datetime import timedelta
|
||||
from fnmatch import fnmatch
|
||||
from typing import Dict
|
||||
from typing import List
|
||||
from typing import Union
|
||||
|
||||
import magic
|
||||
@@ -80,7 +78,7 @@ class BaseMailAction:
|
||||
read mails when the action is to mark mails as read).
|
||||
"""
|
||||
|
||||
def get_criteria(self) -> Union[Dict, LogicOperator]:
|
||||
def get_criteria(self) -> Union[dict, LogicOperator]:
|
||||
"""
|
||||
Returns filtering criteria/query for this mail action.
|
||||
"""
|
||||
@@ -232,7 +230,7 @@ def mailbox_login(mailbox: MailBox, account: MailAccount):
|
||||
|
||||
@shared_task
|
||||
def apply_mail_action(
|
||||
result: List[str],
|
||||
result: list[str],
|
||||
rule_id: int,
|
||||
message_uid: str,
|
||||
message_subject: str,
|
||||
@@ -319,7 +317,7 @@ def error_callback(
|
||||
|
||||
def queue_consumption_tasks(
|
||||
*,
|
||||
consume_tasks: List[Signature],
|
||||
consume_tasks: list[Signature],
|
||||
rule: MailRule,
|
||||
message: MailMessage,
|
||||
):
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import re
|
||||
from html import escape
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
|
||||
import httpx
|
||||
from bleach import clean
|
||||
@@ -355,7 +354,7 @@ class MailDocumentParser(DocumentParser):
|
||||
def generate_pdf_from_html(
|
||||
self,
|
||||
orig_html: str,
|
||||
attachments: List[MailAttachment],
|
||||
attachments: list[MailAttachment],
|
||||
) -> Path:
|
||||
"""
|
||||
Generates a PDF file based on the HTML and attachments of the email
|
||||
|
@@ -3,8 +3,7 @@ import email.contentmanager
|
||||
import random
|
||||
import uuid
|
||||
from collections import namedtuple
|
||||
from typing import ContextManager
|
||||
from typing import List
|
||||
from contextlib import AbstractContextManager
|
||||
from typing import Optional
|
||||
from typing import Union
|
||||
from unittest import mock
|
||||
@@ -53,8 +52,8 @@ class BogusFolderManager:
|
||||
|
||||
class BogusClient:
|
||||
def __init__(self, messages):
|
||||
self.messages: List[MailMessage] = messages
|
||||
self.capabilities: List[str] = []
|
||||
self.messages: list[MailMessage] = messages
|
||||
self.capabilities: list[str] = []
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
@@ -78,7 +77,7 @@ class BogusClient:
|
||||
MailMessage.flags.fget.cache_clear()
|
||||
|
||||
|
||||
class BogusMailBox(ContextManager):
|
||||
class BogusMailBox(AbstractContextManager):
|
||||
# Common values so tests don't need to remember an accepted login
|
||||
USERNAME: str = "admin"
|
||||
ASCII_PASSWORD: str = "secret"
|
||||
@@ -88,8 +87,8 @@ class BogusMailBox(ContextManager):
|
||||
ACCESS_TOKEN = "ea7e075cd3acf2c54c48e600398d5d5a"
|
||||
|
||||
def __init__(self):
|
||||
self.messages: List[MailMessage] = []
|
||||
self.messages_spam: List[MailMessage] = []
|
||||
self.messages: list[MailMessage] = []
|
||||
self.messages_spam: list[MailMessage] = []
|
||||
self.folder = BogusFolderManager()
|
||||
self.client = BogusClient(self.messages)
|
||||
self._host = ""
|
||||
@@ -221,11 +220,11 @@ class TestMail(
|
||||
|
||||
def create_message(
|
||||
self,
|
||||
attachments: Union[int, List[_AttachmentDef]] = 1,
|
||||
attachments: Union[int, list[_AttachmentDef]] = 1,
|
||||
body: str = "",
|
||||
subject: str = "the subject",
|
||||
from_: str = "noone@mail.com",
|
||||
to: Optional[List[str]] = None,
|
||||
to: Optional[list[str]] = None,
|
||||
seen: bool = False,
|
||||
flagged: bool = False,
|
||||
processed: bool = False,
|
||||
@@ -1056,6 +1055,7 @@ class TestMail(
|
||||
],
|
||||
)
|
||||
|
||||
@pytest.mark.flaky(reruns=4)
|
||||
def test_filters(self):
|
||||
account = MailAccount.objects.create(
|
||||
name="test3",
|
||||
@@ -1203,7 +1203,7 @@ class TestMail(
|
||||
self.assertEqual(len(self.bogus_mailbox.fetch("UNSEEN", False)), 0)
|
||||
self.assertEqual(len(self.bogus_mailbox.messages), 3)
|
||||
|
||||
def assert_queue_consumption_tasks_call_args(self, expected_call_args: List):
|
||||
def assert_queue_consumption_tasks_call_args(self, expected_call_args: list):
|
||||
"""
|
||||
Verifies that queue_consumption_tasks has been called with the expected arguments.
|
||||
|
||||
|
Reference in New Issue
Block a user