Chore: Drop Python 3.9 support (#7774)

This commit is contained in:
Trenton H
2024-09-26 12:22:24 -07:00
committed by GitHub
parent a3b4198408
commit e3bc680bf1
44 changed files with 970 additions and 1066 deletions

View File

@@ -251,7 +251,7 @@ class Command(BaseCommand):
self.handle_inotify(directory, recursive, options["testing"])
else:
if INotify is None and settings.CONSUMER_POLLING == 0: # pragma: no cover
logger.warn("Using polling as INotify import failed")
logger.warning("Using polling as INotify import failed")
self.handle_polling(directory, recursive, options["testing"])
logger.debug("Consumer exiting.")
@@ -267,7 +267,7 @@ class Command(BaseCommand):
polling_interval = settings.CONSUMER_POLLING
if polling_interval == 0: # pragma: no cover
# Only happens if INotify failed to import
logger.warn("Using polling of 10s, consider setting this")
logger.warning("Using polling of 10s, consider setting this")
polling_interval = 10
with ThreadPoolExecutor(max_workers=4) as pool:

View File

@@ -6,7 +6,6 @@ import tempfile
import time
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Optional
import tqdm
from django.conf import settings
@@ -183,7 +182,7 @@ class Command(CryptMixin, BaseCommand):
self.zip_export: bool = options["zip"]
self.data_only: bool = options["data_only"]
self.no_progress_bar: bool = options["no_progress_bar"]
self.passphrase: Optional[str] = options.get("passphrase")
self.passphrase: str | None = options.get("passphrase")
self.files_in_export_dir: set[Path] = set()
self.exported_files: set[str] = set()
@@ -427,7 +426,7 @@ class Command(CryptMixin, BaseCommand):
document: Document,
base_name: str,
document_dict: dict,
) -> tuple[Path, Optional[Path], Optional[Path]]:
) -> tuple[Path, Path | None, Path | None]:
"""
Generates the targets for a given document, including the original file, archive file and thumbnail (depending on settings).
"""
@@ -461,8 +460,8 @@ class Command(CryptMixin, BaseCommand):
self,
document: Document,
original_target: Path,
thumbnail_target: Optional[Path],
archive_target: Optional[Path],
thumbnail_target: Path | None,
archive_target: Path | None,
) -> None:
"""
Copies files from the document storage location to the specified target location.
@@ -512,7 +511,7 @@ class Command(CryptMixin, BaseCommand):
def check_and_copy(
self,
source: Path,
source_checksum: Optional[str],
source_checksum: str | None,
target: Path,
):
"""

View File

@@ -3,7 +3,6 @@ import logging
import os
from contextlib import contextmanager
from pathlib import Path
from typing import Optional
import tqdm
from django.conf import settings
@@ -228,8 +227,8 @@ class Command(CryptMixin, BaseCommand):
self.data_only: bool = options["data_only"]
self.no_progress_bar: bool = options["no_progress_bar"]
self.passphrase: str | None = options.get("passphrase")
self.version: Optional[str] = None
self.salt: Optional[str] = None
self.version: str | None = None
self.salt: str | None = None
self.manifest_paths = []
self.manifest = []

View File

@@ -1,9 +1,7 @@
import base64
import os
from argparse import ArgumentParser
from typing import Optional
from typing import TypedDict
from typing import Union
from cryptography.fernet import Fernet
from cryptography.hazmat.primitives import hashes
@@ -103,7 +101,7 @@ class CryptMixin:
},
]
def get_crypt_params(self) -> dict[str, dict[str, Union[str, int]]]:
def get_crypt_params(self) -> dict[str, dict[str, str | int]]:
return {
EXPORTER_CRYPTO_SETTINGS_NAME: {
EXPORTER_CRYPTO_ALGO_NAME: self.kdf_algorithm,
@@ -128,7 +126,7 @@ class CryptMixin:
EXPORTER_CRYPTO_SALT_NAME
]
def setup_crypto(self, *, passphrase: str, salt: Optional[str] = None):
def setup_crypto(self, *, passphrase: str, salt: str | None = None):
"""
Constructs a class for encryption or decryption using the specified passphrase and salt