-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathFullComment.py
More file actions
38 lines (33 loc) · 1020 Bytes
/
FullComment.py
File metadata and controls
38 lines (33 loc) · 1020 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
@GraphqlInPython
Ideally, we would import fragments into other fragments or queries.
However, graphql does not natively support this.
There are some libraries that might do what we need, but for now I'm using python files and importing dependencies.
One issue: graphql will reject any query that contains duplicate fragments (i.e. the same name).
This is a problem because if A imports B and C; and B and C both import D, then A will be a syntax error.
So, we store the queries / fragments as sets, formed as a union of itself with all of its dependencies.
At query time, we convert each set to a single string, with elements separated by new lines.
"""
from typing import FrozenSet
_full_comment = """
fragment FullComment on Comment {
__typename
id
author {
__typename
login
... on User {
name
}
}
body
bodyHTML
... on IssueComment {
url
}
... on PullRequestReviewComment {
url
}
}
"""
FullComment: FrozenSet[str] = frozenset([_full_comment])