Skip to content

Commit

Permalink
Immediate mypy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Centurix committed Jan 4, 2025
1 parent 89539fc commit 720e850
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/traffcap/core/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def new_traffic_notification() -> None:
global store
store["last_message"] += 1

async def wait_for_notification(seconds: float = 0.5) -> AsyncGenerator[Any, Any]:
async def wait_for_notification() -> AsyncGenerator[Any, Any]:
"""
Wait for a change in the last_message. By default this uses
the stdlib multiprocessing Manager. Which is good for ASGI/WSGI
Expand Down
16 changes: 8 additions & 8 deletions src/traffcap/repositories/rule_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ async def find_matching_rules(cls, rule: str) -> List[Rule]:
"""
Find all rules that match this current rule
"""
rules = []
async with cls.session() as session:
results = await session.scalars(
select(RuleModel)
.where(RuleModel.rule == rule)
)
for rule_item in results.all():
rules.append(Rule.model_validate(rule_item))
rules: list[Rule] = []
# async with cls.session() as session:
# results = await session.scalars(
# select(RuleModel)
# .where(RuleModel.rule == rule)
# )
# for rule_item in results.all():
# rules.append(Rule.model_validate(rule_item))

return rules
2 changes: 1 addition & 1 deletion src/traffcap/routes/traffic.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async def traffic_firehose(websocket: WebSocket):
await websocket.send_text(response.model_dump_json())

# Wait for an event from the message broker
async for _ in wait_for_notification(websocket):
async for _ in wait_for_notification():
# Check the connection
await sleep(0.5)
# TODO: Figure out how to check websocket connections without the ping
Expand Down

0 comments on commit 720e850

Please sign in to comment.