How to use the gql.config.Config.load function in gql

To help you get started, we’ve selected a few gql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github graphql-python / gql-next / gql / cli.py View on Github external
def on_any_event(self, event):
            if event.is_directory:
                return

            if event.event_type in {EVENT_TYPE_CREATED, EVENT_TYPE_MODIFIED}:
                filenames = [os.path.abspath(fn) for fn in glob.iglob(config.documents, recursive=True)]
                if event.src_path not in filenames:
                    return

                # Take any action here when a file is first created.
                process_file(event.src_path, self.parser, self.renderer)

    if not isfile(config_filename):
        click.echo(f'Could not find configuration file {config_filename}')

    config = Config.load(config_filename)
    schema = load_schema(config.schema)

    click.secho(f'Watching {config.documents}', fg='cyan')
    click.secho('Ready for changes...', fg='cyan')

    observer = Observer()
    observer.schedule(Handler(config, schema), os.path.abspath('./'), recursive=True)
    observer.start()
    try:
        while True:
            time.sleep(5)
    except:
        observer.stop()
        print('Error')

    observer.join()
github graphql-python / gql-next / gql / codec / transform.py View on Github external
def get_config():
    if 'CONFIG' not in globals():
        globals()['CONFIG'] = Config.load('.gql.json')

    return globals()['CONFIG']
github graphql-python / gql-next / gql / cli.py View on Github external
def run(config_filename):
    if not isfile(config_filename):
        click.echo(f'Could not find configuration file {config_filename}')

    config = Config.load(config_filename)
    schema = load_schema(config.schema)

    filenames = glob.glob(config.documents, recursive=True)

    query_parser = QueryParser(schema)
    query_renderer = DataclassesRenderer(schema, config)

    for filename in filenames:
        process_file(filename, query_parser, query_renderer)