@@ -33,24 +33,28 @@ Usage
33
33
34
34
Make sure ``libgraphqlparser `` is available to the loader. You can add its base dir to ``LD_LIBRARY_PATH ``.
35
35
36
- Then you can start parsing by creating your custom visitor class::
36
+ Then you can start parsing by creating your custom visitor class:
37
37
38
- from graphql_parser import GraphQLAstVisitor
38
+ .. code-block :: python
39
39
40
- class MyVisitor( GraphQLAstVisitor.GraphQLAstVisitor):
40
+ from graphql_parser import GraphQLAstVisitor
41
41
42
- def visit_field(self, node):
43
- print('start field %s visit' % node)
42
+ class MyVisitor (GraphQLAstVisitor .GraphQLAstVisitor ):
44
43
45
- def end_visit_field (self, node):
46
- print('end field %s visit' % node)
44
+ def visit_field (self , node ):
45
+ print (' start field %s visit' % node)
47
46
48
- And using it to visit a parsed query::
47
+ def end_visit_field (self , node ):
48
+ print (' end field %s visit' % node)
49
49
50
- from graphql_parser import GraphQLParser
50
+ And using it to visit a parsed query:
51
51
52
- node = GraphQLParser.graphql_parse_string(query)
53
- MyVisitor().visit_node(node)
52
+ .. code-block :: python
53
+
54
+ from graphql_parser import GraphQLParser
55
+
56
+ node = GraphQLParser.graphql_parse_string(query)
57
+ MyVisitor().visit_node(node)
54
58
55
59
56
60
Building from source checkout
0 commit comments