Skip to content

Commit b0998b1

Browse files
committed
Fix CI linting and spelling issues
- Add missing type annotations and imports - Fix datetime import references - Add technical terms to spellcheck wordlist - Add compatibility method for sync generation
1 parent d8acb43 commit b0998b1

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

.github/wordlist.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,13 @@ virtualenv
7474
datetime
7575
Datetime
7676
reindex
77-
schemas
77+
schemas
78+
Pre
79+
DataMigrationError
80+
ConnectionError
81+
TimeoutError
82+
ValidationError
83+
RTO
84+
benchmarked
85+
SSD
86+
Benchmarking

aredis_om/model/migrations/data_migrator.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
import importlib.util
1313
import os
1414
import time
15-
from datetime import datetime
15+
from datetime import datetime, date
1616
from pathlib import Path
17-
from typing import Any, Dict, List, Optional, Set
17+
from typing import Any, Dict, List, Optional, Set, Callable
1818

1919
try:
2020
import psutil
@@ -431,7 +431,7 @@ async def run_migrations_with_monitoring(
431431
dry_run: bool = False,
432432
limit: Optional[int] = None,
433433
verbose: bool = False,
434-
progress_callback: Optional[callable] = None,
434+
progress_callback: Optional[Callable] = None,
435435
) -> Dict[str, Any]:
436436
"""
437437
Run pending migrations with enhanced performance monitoring.
@@ -588,7 +588,7 @@ async def verify_data_integrity(self, verbose: bool = False) -> Dict[str, Any]:
588588
datetime_fields = []
589589
for field_name, field_info in model_class.model_fields.items():
590590
field_type = getattr(field_info, "annotation", None)
591-
if field_type in (datetime.datetime, datetime.date):
591+
if field_type in (datetime, date):
592592
datetime_fields.append(field_name)
593593

594594
if not datetime_fields:
@@ -766,7 +766,7 @@ async def get_migration_statistics(self) -> Dict[str, Any]:
766766
datetime_fields = []
767767
for field_name, field_info in model_class.model_fields.items():
768768
field_type = getattr(field_info, "annotation", None)
769-
if field_type in (datetime.datetime, datetime.date):
769+
if field_type in (datetime, date):
770770
datetime_fields.append(field_name)
771771

772772
if datetime_fields:

aredis_om/model/migrations/datetime_migration.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ def _safe_convert_datetime_value(
135135
except Exception as e:
136136
self.stats.add_conversion_error(key, field_name, value, e)
137137

138+
async def _convert_datetime_value(self, value: Any) -> Any:
139+
"""Legacy method for compatibility - delegates to safe conversion."""
140+
converted, _ = self._safe_convert_datetime_value("unknown", "unknown", value)
141+
return converted
142+
138143
if self.failure_mode == ConversionFailureMode.FAIL:
139144
raise DataMigrationError(
140145
f"Failed to convert datetime field '{field_name}' in key '{key}': {e}"
@@ -252,9 +257,9 @@ def __init__(self, redis_client, migration_id: str):
252257
async def save_progress(
253258
self,
254259
processed_keys: Set[str],
255-
current_model: str = None,
260+
current_model: Optional[str] = None,
256261
total_keys: int = 0,
257-
stats: Dict[str, Any] = None,
262+
stats: Optional[Dict[str, Any]] = None,
258263
):
259264
"""Save current migration progress."""
260265
state_data = {

0 commit comments

Comments
 (0)