MCPcopy Create free account
hub / github.com/bitsandbytes-foundation/bitsandbytes / transform_issue

Function transform_issue

agents/fetch_issues.py:122–158  ·  view source on GitHub ↗

Transform a raw GraphQL issue node into our clean structure.

(raw: dict)

Source from the content-addressed store, hash-verified

120
121
122def transform_issue(raw: dict) -> dict:
123 """Transform a raw GraphQL issue node into our clean structure."""
124 comments = []
125 for c in raw["comments"]["nodes"]:
126 comments.append(
127 {
128 "author": c["author"]["login"] if c.get("author") else None,
129 "body": c["body"],
130 "created_at": c["createdAt"],
131 "updated_at": c["updatedAt"],
132 "reactions": transform_reactions(c.get("reactionGroups", [])),
133 }
134 )
135
136 timeline = []
137 for t in raw["timelineItems"]["nodes"]:
138 transformed = transform_timeline_event(t)
139 if transformed:
140 timeline.append(transformed)
141
142 return {
143 "number": raw["number"],
144 "title": raw["title"],
145 "body": raw["body"],
146 "state": raw["state"],
147 "author": raw["author"]["login"] if raw.get("author") else None,
148 "created_at": raw["createdAt"],
149 "updated_at": raw["updatedAt"],
150 "closed_at": raw["closedAt"],
151 "assignees": [a["login"] for a in raw["assignees"]["nodes"]],
152 "labels": [label["name"] for label in raw["labels"]["nodes"]],
153 "milestone": raw.get("milestone"),
154 "reactions": transform_reactions(raw.get("reactionGroups", [])),
155 "comment_count": raw["comments"]["totalCount"],
156 "comments": comments,
157 "timeline": timeline,
158 }
159
160
161def fetch_all_issues(owner: str, repo: str, states: list[str] | None = None) -> list[dict]:

Callers 1

fetch_all_issuesFunction · 0.85

Calls 2

transform_reactionsFunction · 0.85
transform_timeline_eventFunction · 0.85

Tested by

no test coverage detected