Skip to content

Commit 8b3d826

Browse files
balogh.adam@icloud.combalogh.adam@icloud.com
authored andcommitted
format python
1 parent 45c0ea2 commit 8b3d826

5 files changed

Lines changed: 15 additions & 10 deletions

File tree

onchain/portfolio/solana_portfolio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def __init__(self, token_metadata_repo: TokenMetadataRepo):
2323
async def close(self):
2424
await self.http_client.close()
2525

26-
@alru_cache(maxsize=1_000_000, ttl=60*60)
26+
@alru_cache(maxsize=1_000_000, ttl=60 * 60)
2727
async def get_portfolio(self, wallet_address: str) -> Portfolio:
2828
if wallet_address == "":
2929
return Portfolio(holdings=[], total_value_usd=0)

onchain/tokens/metadata.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ async def session(self) -> aiohttp.ClientSession:
5555
if self._session is None:
5656
self._session = aiohttp.ClientSession(
5757
timeout=aiohttp.ClientTimeout(total=10), # Add timeout
58-
connector=aiohttp.TCPConnector(limit=100, limit_per_host=30) # Connection pooling
58+
connector=aiohttp.TCPConnector(
59+
limit=100, limit_per_host=30
60+
), # Connection pooling
5961
)
6062
return self._session
6163

server/activity_tracker.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ def __init__(self, get_table: Callable[[], TableContext]):
3737
"""
3838
self.get_table = get_table
3939

40-
async def increment_message_count(
41-
self, user_address: str, miner_token: str = None
42-
) -> bool:
40+
async def increment_message_count(self, user_address: str) -> bool:
4341
"""
4442
Increment the message count for a user.
4543
Returns True if the message was counted, False if the daily limit was reached.

server/auth.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ async def _verify_firebase_id_token(token: str) -> FirebaseIDTokenData:
2323
FirebaseIDTokenData: Pydantic model containing the user's firebase `uid`.
2424
"""
2525
try:
26-
user_data = await asyncio.to_thread(auth.verify_id_token,
27-
id_token=token, app=None, check_revoked=True, clock_skew_seconds=10
26+
user_data = await asyncio.to_thread(
27+
auth.verify_id_token,
28+
id_token=token,
29+
app=None,
30+
check_revoked=True,
31+
clock_skew_seconds=10,
2832
)
2933
return FirebaseIDTokenData(**user_data)
3034
except (

server/fastapi_server.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@ async def verify_solana_signature(request: Request):
211211
request_data = await request.json()
212212
verify_request = SolanaVerifyRequest(**request_data)
213213

214-
token = await asyncio.to_thread(service.verify_solana_signature, verify_request)
214+
token = await asyncio.to_thread(
215+
service.verify_solana_signature, verify_request
216+
)
215217
return {"token": token}
216218

217219
except ValidationError as e:
@@ -242,7 +244,6 @@ async def get_portfolio(
242244
# TODO: Revert this once load is under control
243245
return Portfolio(holdings=[], total_value_usd=0).model_dump()
244246

245-
246247
@app.get("/api/tokenlist")
247248
async def get_tokenlist():
248249
file_path = os.path.join(STATIC_DIR, "tokenlist.json")
@@ -260,7 +261,7 @@ async def run_agent(
260261

261262
# Increment message count, return 429 if limit reached
262263
if not await activity_tracker.increment_message_count(
263-
agent_request.context.address, agent_request.context.miner_token
264+
agent_request.context.address
264265
):
265266
statsd.increment("agent.message.daily_limit_reached")
266267
raise HTTPException(status_code=429, detail="Daily message limit reached")

0 commit comments

Comments
 (0)