fix: resolve all mypy type errors for strict type checking (#48)
## Summary Fixed 30 mypy type errors across 8 files to enable strict type checking. ## Changes by Category ### no-any-return errors (fixed with explicit type casts) - alerter/history.py: Cast Redis zcount/zremrangebyscore returns to int - ingestor/clob_client.py: Cast API response values appropriately - ingestor/publisher.py: Cast Redis xack, xlen, xtrim returns to int - ingestor/metadata_sync.py: Cast Redis delete return to int - detector/scorer.py: Cast Redis delete return to int ### operator errors (fixed with null checks) - alerter/formatter.py: Added `if age_hours is not None:` guards ### External library typing issues (fixed with type: ignore) - ingestor/publisher.py: redis-py typing issue with xadd dict parameter - profiler/funding.py: web3 typing issue with block parameters - storage/repos.py: SQLAlchemy Result.rowcount typing issue ### assignment errors (fixed by renaming) - storage/repos.py: Renamed SQLite insert stmt to avoid type conflict Closes #48 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
f57e0243dd
commit
5c5440d776
@@ -190,10 +190,11 @@ class AlertFormatter:
|
||||
wallet_age_str = ""
|
||||
if assessment.fresh_wallet_signal:
|
||||
age_hours = assessment.fresh_wallet_signal.wallet_profile.age_hours
|
||||
if age_hours < 1:
|
||||
wallet_age_str = f" (Age: {int(age_hours * 60)}m)"
|
||||
else:
|
||||
wallet_age_str = f" (Age: {age_hours:.0f}h)"
|
||||
if age_hours is not None:
|
||||
if age_hours < 1:
|
||||
wallet_age_str = f" (Age: {int(age_hours * 60)}m)"
|
||||
else:
|
||||
wallet_age_str = f" (Age: {age_hours:.0f}h)"
|
||||
|
||||
fields: list[dict[str, object]] = [
|
||||
{
|
||||
@@ -282,10 +283,11 @@ class AlertFormatter:
|
||||
wallet_line = f"*Wallet:* `{wallet_short}`"
|
||||
if assessment.fresh_wallet_signal:
|
||||
age_hours = assessment.fresh_wallet_signal.wallet_profile.age_hours
|
||||
if age_hours < 1:
|
||||
wallet_line += f" \\(Age: {int(age_hours * 60)}m\\)"
|
||||
else:
|
||||
wallet_line += f" \\(Age: {age_hours:.0f}h\\)"
|
||||
if age_hours is not None:
|
||||
if age_hours < 1:
|
||||
wallet_line += f" \\(Age: {int(age_hours * 60)}m\\)"
|
||||
else:
|
||||
wallet_line += f" \\(Age: {age_hours:.0f}h\\)"
|
||||
lines.append(wallet_line)
|
||||
|
||||
# Risk score
|
||||
@@ -366,10 +368,11 @@ class AlertFormatter:
|
||||
wallet_line = f"Wallet: {wallet_short}"
|
||||
if assessment.fresh_wallet_signal:
|
||||
age_hours = assessment.fresh_wallet_signal.wallet_profile.age_hours
|
||||
if age_hours < 1:
|
||||
wallet_line += f" (Age: {int(age_hours * 60)}m)"
|
||||
else:
|
||||
wallet_line += f" (Age: {age_hours:.0f}h)"
|
||||
if age_hours is not None:
|
||||
if age_hours < 1:
|
||||
wallet_line += f" (Age: {int(age_hours * 60)}m)"
|
||||
else:
|
||||
wallet_line += f" (Age: {age_hours:.0f}h)"
|
||||
lines.append(wallet_line)
|
||||
|
||||
# Risk
|
||||
|
||||
@@ -362,7 +362,7 @@ class AlertHistory:
|
||||
start.timestamp(),
|
||||
end.timestamp(),
|
||||
)
|
||||
return count
|
||||
return int(count)
|
||||
|
||||
async def cleanup_old_alerts(self) -> int:
|
||||
"""Remove alerts older than retention period.
|
||||
@@ -393,4 +393,4 @@ class AlertHistory:
|
||||
# Note: Individual alert records will expire via TTL
|
||||
# Wallet/market indexes will also expire via TTL
|
||||
logger.info(f"Cleaned up {removed} old alert references")
|
||||
return removed
|
||||
return int(removed)
|
||||
|
||||
Reference in New Issue
Block a user