Skip to content

Commit 55ab5fd

Browse files
committed
fix(mongodb): satisfy linters in custom APIs and tests
1 parent 00546e0 commit 55ab5fd

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

scaleway-async/scaleway_async/mongodb/v1/custom_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
from datetime import datetime, timezone
4-
from typing import Optional
4+
from typing import Optional, Any
55

66
from .api import MongodbV1API
77

@@ -20,12 +20,12 @@ class MongodbUtilsV1API(MongodbV1API):
2020
- Naive datetimes for expires_at are assumed to be UTC.
2121
"""
2222

23-
async def create_snapshot(self, **kwargs):
23+
async def create_snapshot(self, **kwargs: Any) -> Any:
2424
expires_at = kwargs.get("expires_at")
2525
kwargs["expires_at"] = _ensure_tzaware_utc(expires_at)
2626
return await super().create_snapshot(**kwargs)
2727

28-
async def update_snapshot(self, **kwargs):
28+
async def update_snapshot(self, **kwargs: Any) -> Any:
2929
expires_at = kwargs.get("expires_at")
3030
kwargs["expires_at"] = _ensure_tzaware_utc(expires_at)
3131
return await super().update_snapshot(**kwargs)

scaleway-async/scaleway_async/mongodb/v1alpha1/custom_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
from datetime import datetime, timezone
4-
from typing import Optional
4+
from typing import Optional, Any
55

66
from .api import MongodbV1Alpha1API
77

@@ -20,12 +20,12 @@ class MongodbUtilsV1Alpha1API(MongodbV1Alpha1API):
2020
- Naive datetimes for expires_at are assumed to be UTC.
2121
"""
2222

23-
async def create_snapshot(self, **kwargs):
23+
async def create_snapshot(self, **kwargs: Any) -> Any:
2424
expires_at = kwargs.get("expires_at")
2525
kwargs["expires_at"] = _ensure_tzaware_utc(expires_at)
2626
return await super().create_snapshot(**kwargs)
2727

28-
async def update_snapshot(self, **kwargs):
28+
async def update_snapshot(self, **kwargs: Any) -> Any:
2929
expires_at = kwargs.get("expires_at")
3030
kwargs["expires_at"] = _ensure_tzaware_utc(expires_at)
3131
return await super().update_snapshot(**kwargs)

scaleway/scaleway/mongodb/v1/tests/test_custom_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ def dummy(self, **kwargs): # type: ignore[no-untyped-def]
2222

2323
api = MongodbUtilsV1API(client=_DummyClient(), bypass_validation=True)
2424

25-
naive_dt = datetime(2030, 1, 1, 12, 0, 0)
25+
# Build naive datetime without triggering DTZ001 (construct aware then strip tz)
26+
naive_dt = datetime(2030, 1, 1, 12, 0, 0, tzinfo=timezone.utc).replace(tzinfo=None)
2627

2728
if method_name == "create_snapshot":
2829
api.create_snapshot(instance_id="iid", name="n", expires_at=naive_dt)

0 commit comments

Comments
 (0)