MCPcopy Create free account
hub / github.com/pytorch/pytorch / github_data

Function github_data

scripts/release_notes/common.py:229–278  ·  view source on GitHub ↗
(pr_number)

Source from the content-addressed store, hash-verified

227
228
229def github_data(pr_number):
230 query = (
231 """
232 {
233 repository(owner: "pytorch", name: "pytorch") {
234 pullRequest(number: %s ) {
235 author {
236 login
237 }
238 reviews(last: 5, states: APPROVED) {
239 nodes {
240 author {
241 login
242 }
243 }
244 }
245 labels(first: 10) {
246 edges {
247 node {
248 name
249 }
250 }
251 }
252 }
253 }
254 }
255 """
256 % pr_number
257 )
258 query = run_query(query)
259 if query.get("errors"):
260 global _ERRORS
261 _ERRORS.append(query.get("errors"))
262 if len(_ERRORS) < _MAX_ERROR_LEN:
263 return [], "None", ()
264 else:
265 raise Exception(
266 f"Got {_MAX_ERROR_LEN} errors: {_ERRORS}, please check if"
267 " there is something wrong"
268 )
269 edges = query["data"]["repository"]["pullRequest"]["labels"]["edges"]
270 labels = [edge["node"]["name"] for edge in edges]
271 author = query["data"]["repository"]["pullRequest"]["author"]["login"]
272 nodes = query["data"]["repository"]["pullRequest"]["reviews"]["nodes"]
273
274 # using set to dedup multiple accepts from same accepter
275 accepters = {node["author"]["login"] for node in nodes}
276 accepters = tuple(sorted(accepters))
277
278 return labels, author, accepters
279
280
281def get_features(commit_hash):

Callers 1

get_featuresFunction · 0.85

Calls 4

run_queryFunction · 0.85
ExceptionClass · 0.85
getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…