Skip to content

Commit

Permalink
⬆️ Upgrade dependencies (#12)
Browse files Browse the repository at this point in the history
Signed-off-by: ff137 <[email protected]>
  • Loading branch information
ff137 authored Jan 23, 2025
1 parent 0fad77e commit e7b6d65
Show file tree
Hide file tree
Showing 8 changed files with 268 additions and 258 deletions.
8 changes: 3 additions & 5 deletions acapy_agent/config/logging/configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from typing import Optional

import yaml
from pythonjsonlogger import jsonlogger
from pythonjsonlogger.json import JsonFormatter

from ...config.settings import Settings
from ...version import __version__
Expand Down Expand Up @@ -215,9 +215,7 @@ def _configure_multitenant_logging(cls, log_config_path, log_level, log_file):
)
timed_file_handler.addFilter(log_filter)
# By default this will be set up.
timed_file_handler.setFormatter(
jsonlogger.JsonFormatter(LOG_FORMAT_FILE_ALIAS_PATTERN)
)
timed_file_handler.setFormatter(JsonFormatter(LOG_FORMAT_FILE_ALIAS_PATTERN))
logging.root.handlers.append(timed_file_handler)

else:
Expand All @@ -228,7 +226,7 @@ def _configure_multitenant_logging(cls, log_config_path, log_level, log_file):
# Set Json formatter for rotated file handler which cannot be set with
# config file.
# By default this will be set up.
handler.setFormatter(jsonlogger.JsonFormatter(log_formater))
handler.setFormatter(JsonFormatter(log_formater))
# Add context filter to handlers
handler.addFilter(log_filter)

Expand Down
4 changes: 4 additions & 0 deletions acapy_agent/messaging/jsonld/tests/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,10 @@ async def asyncSetUp(self):
headers={"x-api-key": "secret-key"},
)

async def asyncTearDown(self):
# Ensure the event loop is closed
await self.profile.close()

async def test_verify_credential(self):
POSTED_REQUEST = { # posted json
"verkey": (
Expand Down
3 changes: 1 addition & 2 deletions acapy_agent/messaging/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def deserialize(
ModelType,
schema.loads(obj) if isinstance(obj, str) else schema.load(obj),
)
except (AttributeError, ValidationError) as err:
except (AttributeError, ValidationError, TypeError) as err:
LOGGER.exception(f"{cls.__name__} message validation error:")
raise BaseModelError(f"{cls.__name__} schema validation failed") from err

Expand Down Expand Up @@ -321,7 +321,6 @@ class Meta:

model_class = None
skip_values = [None]
ordered = True

def __init__(self, *args, **kwargs):
"""Initialize BaseModelSchema.
Expand Down
13 changes: 3 additions & 10 deletions acapy_agent/messaging/models/paginated_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from aiohttp.web import BaseRequest
from marshmallow import fields
from marshmallow.validate import OneOf
from marshmallow.validate import OneOf, Range

from ...messaging.models.openapi import OpenAPISchema
from ...storage.base import DEFAULT_PAGE_SIZE, MAXIMUM_PAGE_SIZE
Expand All @@ -16,21 +16,14 @@ class PaginatedQuerySchema(OpenAPISchema):
limit = fields.Int(
required=False,
load_default=DEFAULT_PAGE_SIZE,
validate=lambda x: x > 0 and x <= MAXIMUM_PAGE_SIZE,
validate=Range(min=1, max=MAXIMUM_PAGE_SIZE),
metadata={"description": "Number of results to return", "example": 50},
error_messages={
"validator_failed": (
"Value must be greater than 0 and "
f"less than or equal to {MAXIMUM_PAGE_SIZE}"
)
},
)
offset = fields.Int(
required=False,
load_default=0,
validate=lambda x: x >= 0,
validate=Range(min=0),
metadata={"description": "Offset for pagination", "example": 0},
error_messages={"validator_failed": "Value must be 0 or greater"},
)
order_by = fields.Str(
required=False,
Expand Down
6 changes: 3 additions & 3 deletions acapy_agent/messaging/models/tests/test_paginated_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ def test_paginated_query_schema_limit_validation():
with pytest.raises(ValidationError) as exc_info:
schema.load({"limit": 0})
assert (
f"Value must be greater than 0 and less than or equal to {MAXIMUM_PAGE_SIZE}"
f"Must be greater than or equal to 1 and less than or equal to {MAXIMUM_PAGE_SIZE}"
in str(exc_info.value)
)

# Invalid limit (greater than MAXIMUM_PAGE_SIZE)
with pytest.raises(ValidationError) as exc_info:
schema.load({"limit": MAXIMUM_PAGE_SIZE + 1})
assert (
f"Value must be greater than 0 and less than or equal to {MAXIMUM_PAGE_SIZE}"
f"Must be greater than or equal to 1 and less than or equal to {MAXIMUM_PAGE_SIZE}"
in str(exc_info.value)
)

Expand All @@ -64,4 +64,4 @@ def test_paginated_query_schema_offset_validation():
# Invalid offset (less than 0)
with pytest.raises(ValidationError) as exc_info:
schema.load({"offset": -1})
assert "Value must be 0 or greater" in str(exc_info.value)
assert "Must be greater than or equal to 0." in str(exc_info.value)
4 changes: 1 addition & 3 deletions acapy_agent/utils/repeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import asyncio
from typing import Optional

import async_timeout


class RepeatAttempt:
"""Represents the current iteration in a repeat sequence."""
Expand Down Expand Up @@ -47,7 +45,7 @@ def next_interval(self) -> float:

def timeout(self, interval: Optional[float] = None):
"""Create a context manager for timing out an attempt."""
return async_timeout.timeout(self.next_interval if interval is None else interval)
return asyncio.timeout(self.next_interval if interval is None else interval)

def __repr__(self) -> str:
"""Format as a string for debugging."""
Expand Down
Loading

0 comments on commit e7b6d65

Please sign in to comment.