How to use the inql.utils.open function in inql

To help you get started, we’ve selected a few inql 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 doyensec / graph-ql / inql / generators / query.py View on Github external
:param type:
        query, mutation, subscription

    :param qname:
        query, mutation, subscription names

    :param content:
        file content

    :param mode:
        w, a and so on

    :return:
        none
    """
    with open(opath % (type, '%s.query' % qname), mode) as ofile:
        ofile.write(content)
github doyensec / graph-ql / inql / generators / html.py View on Github external
def generate(argument, fpath, custom=False, target="empty"):
    """
    Generate HTML Documentation

    :param argument: introspection query result
    :param fpath: output result
    :param custom: enable or disable custom types, disabled by default
    :param target: who is the owner of that graphql endpoint
    :return: None
    """
    with open(fpath, 'w') as output_file:
        result = argument.copy()
        # Write HTML header for the documentation
        # --------------------
        output_file.write("<title>GraphQL Schema</title>")
        # write CSS
        output_file.write(stl)
        # write target URL
        output_file.write("<h2>GraphQL Schema</h2><h3><a href="{0}">{0}</a></h3>".format(target))
        # write legend box
        output_file.write(
            "<div class="box"><h4>Legend</h4><ul><li class="query">Queries</li><li class="mutation">Mutations</li>&lt;"
            "li class='subscription'&gt;Subscriptions<li class="argument">Arguments</li>"
            "<li class="type">Types: String, Float, not_null!, [list]</li><li class="deprecated">Deprecated</li>"
            "<li class="field">Fields</li></ul></div>")
        # --------------------
        output_file.write("<p>Available Operations Types:</p>")
github doyensec / graph-ql / inql / generators / schema.py View on Github external
def generate(argument, fpath="introspection.json"):
    """
    Generate Schema JSON

    :param argument: introspection query output
    :param fpath: file output
    :return: None
    """
    with open(fpath, "w") as schema_file:
        schema_file.write(json.dumps(argument, indent=4, sort_keys=True))