Skip to content

Commit d93518f

Browse files
authored
⬆️ Upgrade dependencies (openwallet-foundation#3455)
* ➖ Remove deprecated package async-timeout has been pulled into asyncio since python 3.11 Signed-off-by: ff137 <[email protected]> * ⬆️ Upgrade dependencies Includes major upgrades without breaking changes Signed-off-by: ff137 <[email protected]> * 📌 Unpin dependency versions Signed-off-by: ff137 <[email protected]> * ⬆️ Upgrade pre-commit Signed-off-by: ff137 <[email protected]> * 🎨 Fix deprecation warning - module moved Signed-off-by: ff137 <[email protected]> * ⬆️ Upgrade marshmallow Remove deprecated field (order is now preserved by default) Handle new TypeError Signed-off-by: ff137 <[email protected]> * ⬆️ Update lock file Signed-off-by: ff137 <[email protected]> * 🎨 Resolve Marshmallow deprecation warning Fixes: `ChangedInMarshmallow4Warning: Returning `False` from a validator is deprecated. Raise a `ValidationError` instead.` Signed-off-by: ff137 <[email protected]> * 🎨 Fix pytest-asyncio warning: unclosed event loop Signed-off-by: ff137 <[email protected]> * ⬆️ Upgrade aiohttp-apispec-acapy Signed-off-by: ff137 <[email protected]> * ⬆️ Upgrade pydevd-pycharm Signed-off-by: ff137 <[email protected]> --------- Signed-off-by: ff137 <[email protected]>
1 parent 0a1e946 commit d93518f

File tree

8 files changed

+172
-188
lines changed

8 files changed

+172
-188
lines changed

acapy_agent/config/logging/configurator.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from typing import Optional
1818

1919
import yaml
20-
from pythonjsonlogger import jsonlogger
20+
from pythonjsonlogger.json import JsonFormatter
2121

2222
from ...config.settings import Settings
2323
from ...version import __version__
@@ -221,9 +221,7 @@ def _configure_multitenant_logging(cls, log_config_path, log_level, log_file):
221221
)
222222
timed_file_handler.addFilter(log_filter)
223223
# By default this will be set up.
224-
timed_file_handler.setFormatter(
225-
jsonlogger.JsonFormatter(LOG_FORMAT_FILE_ALIAS_PATTERN)
226-
)
224+
timed_file_handler.setFormatter(JsonFormatter(LOG_FORMAT_FILE_ALIAS_PATTERN))
227225
logging.root.handlers.append(timed_file_handler)
228226

229227
else:
@@ -234,7 +232,7 @@ def _configure_multitenant_logging(cls, log_config_path, log_level, log_file):
234232
# Set Json formatter for rotated file handler which cannot be set with
235233
# config file.
236234
# By default this will be set up.
237-
handler.setFormatter(jsonlogger.JsonFormatter(log_formater))
235+
handler.setFormatter(JsonFormatter(log_formater))
238236
# Add context filter to handlers
239237
handler.addFilter(log_filter)
240238

acapy_agent/messaging/jsonld/tests/test_routes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,10 @@ async def asyncSetUp(self):
303303
headers={"x-api-key": "secret-key"},
304304
)
305305

306+
async def asyncTearDown(self):
307+
# Ensure the event loop is closed
308+
await self.profile.close()
309+
306310
async def test_verify_credential(self):
307311
POSTED_REQUEST = { # posted json
308312
"verkey": (

acapy_agent/messaging/models/base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def serialize(
240240
if as_string
241241
else schema.dump(self)
242242
)
243-
except (AttributeError, ValidationError) as err:
243+
except (AttributeError, ValidationError, TypeError) as err:
244244
LOGGER.exception(f"{self.__class__.__name__} message serialization error:")
245245
raise BaseModelError(
246246
f"{self.__class__.__name__} schema validation failed"
@@ -321,7 +321,6 @@ class Meta:
321321

322322
model_class = None
323323
skip_values = [None]
324-
ordered = True
325324

326325
def __init__(self, *args, **kwargs):
327326
"""Initialize BaseModelSchema.

acapy_agent/messaging/models/paginated_query.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from aiohttp.web import BaseRequest
66
from marshmallow import fields
7+
from marshmallow.validate import Range
78

89
from ...messaging.models.openapi import OpenAPISchema
910
from ...storage.base import DEFAULT_PAGE_SIZE, MAXIMUM_PAGE_SIZE
@@ -15,21 +16,14 @@ class PaginatedQuerySchema(OpenAPISchema):
1516
limit = fields.Int(
1617
required=False,
1718
load_default=DEFAULT_PAGE_SIZE,
18-
validate=lambda x: x > 0 and x <= MAXIMUM_PAGE_SIZE,
19+
validate=Range(min=1, max=MAXIMUM_PAGE_SIZE),
1920
metadata={"description": "Number of results to return", "example": 50},
20-
error_messages={
21-
"validator_failed": (
22-
"Value must be greater than 0 and "
23-
f"less than or equal to {MAXIMUM_PAGE_SIZE}"
24-
)
25-
},
2621
)
2722
offset = fields.Int(
2823
required=False,
2924
load_default=0,
30-
validate=lambda x: x >= 0,
25+
validate=Range(min=0),
3126
metadata={"description": "Offset for pagination", "example": 0},
32-
error_messages={"validator_failed": "Value must be 0 or greater"},
3327
)
3428

3529

acapy_agent/messaging/models/tests/test_paginated_query.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ def test_paginated_query_schema_limit_validation():
3838
with pytest.raises(ValidationError) as exc_info:
3939
schema.load({"limit": 0})
4040
assert (
41-
f"Value must be greater than 0 and less than or equal to {MAXIMUM_PAGE_SIZE}"
41+
f"Must be greater than or equal to 1 and less than or equal to {MAXIMUM_PAGE_SIZE}"
4242
in str(exc_info.value)
4343
)
4444

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

@@ -64,4 +64,4 @@ def test_paginated_query_schema_offset_validation():
6464
# Invalid offset (less than 0)
6565
with pytest.raises(ValidationError) as exc_info:
6666
schema.load({"offset": -1})
67-
assert "Value must be 0 or greater" in str(exc_info.value)
67+
assert "Must be greater than or equal to 0." in str(exc_info.value)

acapy_agent/utils/repeat.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import asyncio
44
from typing import Optional
55

6-
import async_timeout
7-
86

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

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

5250
def __repr__(self) -> str:
5351
"""Format as a string for debugging."""

0 commit comments

Comments
 (0)