Skip to content

Commit d9d43e1

Browse files
codebydivineclaude
andcommitted
fix: Move imports to top-level to resolve PLC0415 linting errors
Moved inspect import and datetime imports from function scope to module level to comply with PLC0415 rule requiring imports at top-level of files. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 90f02c3 commit d9d43e1

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/thegraph_token_api/models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
for backward compatibility.
88
"""
99

10+
import inspect
1011
from dataclasses import dataclass
1112

1213

@@ -340,8 +341,6 @@ def convert_to_model(data: dict, model_class) -> BaseModel:
340341
converted_data["token1"] = SwapToken(**converted_data["token1"])
341342

342343
# Filter only fields that exist in the dataclass
343-
import inspect
344-
345344
signature = inspect.signature(model_class)
346345
valid_fields = set(signature.parameters.keys())
347346
filtered_data = {k: v for k, v in converted_data.items() if k in valid_fields}

src/thegraph_token_api/simple.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"""
1717

1818
import os
19+
from datetime import datetime, timedelta
1920

2021
from dotenv import load_dotenv
2122

@@ -312,7 +313,7 @@ class TokenAPI:
312313
# SVM (Solana)
313314
sol_balances = await api.svm.balances(mint="So11111111111111111111111111111111111111112")
314315
sol_swaps = await api.svm.swaps(program_id=SwapPrograms.RAYDIUM, limit=10)
315-
sol_transfers = await api.svm.transfers(mint="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v")
316+
sol_transfers = await api.svm.transfers(mint="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v") # pragma: allowlist secret
316317
317318
# Utility
318319
health = await api.health()
@@ -497,7 +498,6 @@ async def _evm_price_history(
497498
) -> list[dict]:
498499
"""Internal EVM price history implementation."""
499500
net = str(network) if network else self._default_network
500-
from datetime import datetime, timedelta
501501

502502
start_time = int((datetime.now() - timedelta(days=days)).timestamp())
503503

@@ -515,7 +515,6 @@ async def _evm_pool_history(
515515
) -> list[dict]:
516516
"""Internal EVM pool history implementation."""
517517
net = str(network) if network else self._default_network
518-
from datetime import datetime, timedelta
519518

520519
start_time = int((datetime.now() - timedelta(days=days)).timestamp())
521520

0 commit comments

Comments
 (0)