[patch] update dependencies #16

Merged
brian merged 3 commits from renovate/auto-deps-update into main 2026-06-28 23:46:14 +02:00
4 changed files with 855 additions and 555 deletions
+2
View File
@@ -24,6 +24,8 @@ repos:
rev: v1.8.0 rev: v1.8.0
hooks: hooks:
- id: mypy - id: mypy
additional_dependencies:
- types-redis
# Python syntax modernization with pyupgrade # Python syntax modernization with pyupgrade
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
@@ -131,7 +131,7 @@ class MinioAdapter(
if not isinstance(content_type, str) or len(content_type) == 0: if not isinstance(content_type, str) or len(content_type) == 0:
raise ValueError("content_type must be a non-empty string") raise ValueError("content_type must be a non-empty string")
# Check connection # Check connection
if self._client is None or not self.is_connected: if self._client is None or self._bucket_name is None or not self.is_connected:
raise ConnectionError("Not connected to Minio") raise ConnectionError("Not connected to Minio")
# Prepare buffer for reading # Prepare buffer for reading
num_bytes = data.getbuffer().nbytes num_bytes = data.getbuffer().nbytes
@@ -156,7 +156,7 @@ class MinioAdapter(
if not isinstance(object_name, str) or len(object_name) == 0: if not isinstance(object_name, str) or len(object_name) == 0:
raise ValueError("object_name must be a non-empty string") raise ValueError("object_name must be a non-empty string")
# Check connection # Check connection
if self._client is None or not self.is_connected: if self._client is None or self._bucket_name is None or not self.is_connected:
raise ConnectionError("Not connected to Minio") raise ConnectionError("Not connected to Minio")
# Get data from bucket # Get data from bucket
# N.B. bucket name is set when connecting # N.B. bucket name is set when connecting
@@ -191,7 +191,7 @@ class MinioAdapter(
if not isinstance(object_name, str) or len(object_name) == 0: if not isinstance(object_name, str) or len(object_name) == 0:
raise ValueError("object_name must be a non-empty string") raise ValueError("object_name must be a non-empty string")
# Check connection # Check connection
if self._client is None or not self.is_connected: if self._client is None or self._bucket_name is None or not self.is_connected:
raise ConnectionError("Not connected to Minio") raise ConnectionError("Not connected to Minio")
# Delete object from bucket # Delete object from bucket
# N.B. bucket name is set when connecting # N.B. bucket name is set when connecting
@@ -210,7 +210,7 @@ class MinioAdapter(
raise ValueError("prefix must be a string") raise ValueError("prefix must be a string")
# Check connection # Check connection
# N.B. bucket name is set when connecting # N.B. bucket name is set when connecting
if self._client is None or not self.is_connected: if self._client is None or self._bucket_name is None or not self.is_connected:
raise ConnectionError("Not connected to Minio") raise ConnectionError("Not connected to Minio")
# List objects in bucket # List objects in bucket
objects = self._client.list_objects( objects = self._client.list_objects(
+16 -15
View File
@@ -9,6 +9,7 @@ import random
import os import os
import logging import logging
from minio import S3Error from minio import S3Error
from urllib3.response import BaseHTTPResponse
from python_repositories.adapters.minio_adapter import MinioAdapter from python_repositories.adapters.minio_adapter import MinioAdapter
from python_repositories.interfaces import ObjectRepositoryInterface from python_repositories.interfaces import ObjectRepositoryInterface
@@ -42,7 +43,7 @@ def same_data(
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
def data() -> Generator[BytesIO]: def data() -> Generator[BytesIO, None, None]:
"""Provide a sample data bytes for tests.""" """Provide a sample data bytes for tests."""
# Generate random bytes # Generate random bytes
random_bytes = random.randbytes(2**21) # 2 MiB random_bytes = random.randbytes(2**21) # 2 MiB
@@ -53,7 +54,7 @@ def data() -> Generator[BytesIO]:
def data_in_minio( def data_in_minio(
raw_minio_client: Minio, raw_minio_client: Minio,
data: BytesIO, data: BytesIO,
) -> Generator[tuple[str, BytesIO]]: ) -> Generator[tuple[str, BytesIO], None, None]:
"""Fixture to set up a known value in Minio before each test.""" """Fixture to set up a known value in Minio before each test."""
object_name = "test_object" object_name = "test_object"
bucket_name = str(os.getenv("MINIO_BUCKET")) bucket_name = str(os.getenv("MINIO_BUCKET"))
@@ -77,7 +78,7 @@ def data_in_minio(
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
def minio_adapter() -> Generator[MinioAdapter]: def minio_adapter() -> Generator[MinioAdapter, None, None]:
"""Fixture to provide a connected MinioAdapter instance.""" """Fixture to provide a connected MinioAdapter instance."""
adapter = MinioAdapter() adapter = MinioAdapter()
adapter.connect() adapter.connect()
@@ -234,12 +235,12 @@ def test_should_log_warning_when_getting_nonexistent_object(
adapter = MinioAdapter() adapter = MinioAdapter()
adapter._client = MagicMock(spec=Minio) adapter._client = MagicMock(spec=Minio)
adapter._client.get_object.side_effect = S3Error( adapter._client.get_object.side_effect = S3Error(
code="NoSuchKey", MagicMock(spec=BaseHTTPResponse),
message="", "NoSuchKey",
resource="", "",
request_id="", "",
host_id="", "",
response="", "",
bucket_name="test-bucket", bucket_name="test-bucket",
object_name="missing-object", object_name="missing-object",
) )
@@ -264,12 +265,12 @@ def test_should_log_error_when_getting_with_s3error_other_than_no_such_key(
adapter = MinioAdapter() adapter = MinioAdapter()
adapter._client = MagicMock(spec=Minio) adapter._client = MagicMock(spec=Minio)
other_s3error = S3Error( other_s3error = S3Error(
code="UnhandledError", MagicMock(spec=BaseHTTPResponse),
message="", "UnhandledError",
resource="", "",
request_id="", "",
host_id="", "",
response="", "",
bucket_name="test-bucket", bucket_name="test-bucket",
object_name="missing-object", object_name="missing-object",
) )
Generated
+833 -536
View File
File diff suppressed because it is too large Load Diff