GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — libgraphqlparser/python/example.py at master · khakha010/libgraphqlparser

Expand file tree

/

example.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
executable file
·
31 lines (25 loc) · 1007 Bytes
/

example.py

Copy path

File metadata and controls

executable file
·
31 lines (25 loc) · 1007 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#!/usr/bin/env python
# Copyright (c) 2015-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from ctypes import *
from GraphQLParser import *
def print_field(field, unused):
field_name = GraphQLAstField_get_name(field)
field_name_value = GraphQLAstName_get_value(field_name)
print 'field : ' + field_name_value
return 0
def main():
error = POINTER(c_char)()
ast = graphql_parse_string('query myquery { myfield }', byref(error))
field_visitor_callbacks = GraphQLAstVisitorCallbacks(visit_field = visit_field_func(print_field))
graphql_node_visit(ast, pointer(field_visitor_callbacks), None)
graphql_node_free(ast)
ast = graphql_parse_string('query errorQuery on oops { myfield }', byref(error))
print 'Example error:', string_at(error)
graphql_error_free(error)
if ast:
print 'BUG: we should have got a null AST back, but we got:', ast
if __name__ == '__main__':
main()
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.