Skip to content

Commit da8831e

Browse files
committed
use list comprehensions for issue_requests and notifications snapshots
1 parent 17468e3 commit da8831e

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/ghdcbot/engine/snapshots.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,8 @@ def _collect_snapshot_data(
251251
}
252252

253253
# Issue requests snapshot
254-
issue_requests_data = []
255-
pending_requests = storage.list_pending_issue_requests()
256-
for req in pending_requests:
257-
issue_requests_data.append({
254+
issue_requests_data = [
255+
{
258256
"request_id": req.get("request_id"),
259257
"discord_user_id": req.get("discord_user_id"),
260258
"github_user": req.get("github_user"),
@@ -264,7 +262,9 @@ def _collect_snapshot_data(
264262
"issue_url": req.get("issue_url"),
265263
"created_at": req.get("created_at"),
266264
"status": req.get("status"),
267-
})
265+
}
266+
for req in storage.list_pending_issue_requests()
267+
]
268268

269269
issue_requests = {
270270
"schema_version": SCHEMA_VERSION,
@@ -275,10 +275,8 @@ def _collect_snapshot_data(
275275
}
276276

277277
# Notifications snapshot (recent sent notifications)
278-
notifications_data = []
279-
recent_notifications = storage.list_recent_notifications(limit=1000)
280-
for notif in recent_notifications:
281-
notifications_data.append({
278+
notifications_data = [
279+
{
282280
"dedupe_key": notif.get("dedupe_key"),
283281
"event_type": notif.get("event_type"),
284282
"github_user": notif.get("github_user"),
@@ -287,7 +285,9 @@ def _collect_snapshot_data(
287285
"target": notif.get("target"),
288286
"channel_id": notif.get("channel_id"),
289287
"sent_at": notif.get("sent_at"),
290-
})
288+
}
289+
for notif in storage.list_recent_notifications(limit=1000)
290+
]
291291

292292
notifications = {
293293
"schema_version": SCHEMA_VERSION,

0 commit comments

Comments
 (0)