Skip to content

Commit e12b725

Browse files
codebydivineclaude
andcommitted
fix: Resolve remaining linting issues and update module imports
- Fix bare except statements with specific exception types - Replace star imports with explicit imports in __init__.py and tests - Fix isinstance() usage to use union syntax (X | Y) - Update all import paths from token_api to thegraph_token_api - Fix patch paths in test mocks for renamed module - Remove unused variables and improve type comparisons All tests now pass (215/215) with 98.43% coverage exceeding 90% requirement. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent d5f7bdd commit e12b725

18 files changed

+115
-39
lines changed

examples/endpoints/evm/balances.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import anyio
88

99
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "src"))
10-
from token_api import TokenAPI
10+
from thegraph_token_api import TokenAPI
1111

1212

1313
async def main():

examples/endpoints/evm/health.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import anyio
88

99
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "src"))
10-
from token_api import TokenAPI
10+
from thegraph_token_api import TokenAPI
1111

1212

1313
async def main():

examples/endpoints/evm/nfts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import anyio
88

99
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "src"))
10-
from token_api import TokenAPI
10+
from thegraph_token_api import TokenAPI
1111

1212

1313
async def main():

examples/endpoints/evm/prices.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import anyio
99

1010
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "src"))
11-
from token_api import Interval, TokenAPI
11+
from thegraph_token_api import Interval, TokenAPI
1212

1313

1414
async def main():
@@ -32,7 +32,7 @@ async def main():
3232
try:
3333
dt = datetime.fromisoformat(timestamp.replace("Z", "+00:00"))
3434
date_str = dt.strftime("%m/%d")
35-
except:
35+
except (ValueError, AttributeError):
3636
date_str = "?"
3737

3838
change = ((close_price - open_price) / open_price * 100) if open_price > 0 else 0
@@ -52,7 +52,7 @@ async def main():
5252
try:
5353
dt = datetime.fromisoformat(timestamp.replace("Z", "+00:00"))
5454
time_str = dt.strftime("%H:%M")
55-
except:
55+
except (ValueError, AttributeError):
5656
time_str = "?"
5757

5858
print(f" {time_str}: {open_price:.6f}{close_price:.6f}")

examples/endpoints/evm/swaps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import anyio
99

1010
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "src"))
11-
from token_api import Protocol, TokenAPI
11+
from thegraph_token_api import Protocol, TokenAPI
1212

1313

1414
async def main():

examples/endpoints/evm/tokens.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import anyio
88

99
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "src"))
10-
from token_api import TokenAPI
10+
from thegraph_token_api import TokenAPI
1111

1212

1313
async def main():
@@ -30,7 +30,7 @@ async def main():
3030

3131
print(f" {name} ({symbol})")
3232
print(f" Decimals: {decimals}")
33-
print(f" Holders: {holders:,}" if isinstance(holders, (int, float)) else f" Holders: {holders}")
33+
print(f" Holders: {holders:,}" if isinstance(holders, int | float) else f" Holders: {holders}")
3434
if price:
3535
print(f" Price: ${price:.4f}")
3636

examples/endpoints/evm/transfers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import anyio
99

1010
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "src"))
11-
from token_api import TokenAPI
11+
from thegraph_token_api import TokenAPI
1212

1313

1414
async def main():

examples/endpoints/svm/balances.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import anyio
88

99
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "src"))
10-
from token_api import SolanaPrograms, TokenAPI
10+
from thegraph_token_api import SolanaPrograms, TokenAPI
1111

1212

1313
async def main():

examples/endpoints/svm/swaps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import anyio
99

1010
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "src"))
11-
from token_api import SwapPrograms, TokenAPI
11+
from thegraph_token_api import SwapPrograms, TokenAPI
1212

1313

1414
async def main():

examples/endpoints/svm/transfers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import anyio
99

1010
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "src"))
11-
from token_api import SolanaPrograms, TokenAPI
11+
from thegraph_token_api import SolanaPrograms, TokenAPI
1212

1313

1414
async def main():

0 commit comments

Comments
 (0)