8000 nicer code · graphql-python/gql-next@ce546d1 · GitHub
[go: up one dir, main page]

Skip to content

Commit ce546d1

Browse files
committed
nicer code
1 parent 221a87a commit ce546d1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

gql/codec/transform.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from io import BytesIO
2-
from tokenize import tokenize, TokenInfo, NL, NEWLINE, ENCODING, NAME, OP
2+
from tokenize import tokenize, TokenInfo, NL, NEWLINE, ENCODING, NAME, OP, STRING
33

44
from gql.config import Config
55
from gql.query_parser import QueryParser
@@ -54,11 +54,11 @@ def gql_transform(stream: BytesIO):
5454

5555
query_started = False
5656
for token in tokens:
57-
if token.type == 1 and token.string == 'gql': # type NAME
57+
if token.type == NAME and token.string == 'gql':
5858
query_started = True
5959
continue
6060

61-
if token.type == 3 and query_started: # type STRING
61+
if token.type == STRING and query_started:
6262
query_str = token.string.strip("'''")
6363
parsed_query = get_parser().parse(query_str)
6464
rendered = get_renderer().render(parsed_query)

0 commit comments

Comments
 (0)
0