<commit_before># -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import os
import sys
import click
import requests


@click.group()
def cli():
    """The entry point into the CLI."""


@cli.command()
@click.argument('instance_url')
@click.argument('payload')
def examples(instance_url, payload):
    """Run some example data against a public instance of tvweb."""

    payloads = {
        'one': {
            'data_source': 'https://raw.githubusercontent.com/okfn/tabular-validator-web/master/examples/valid.csv',
            'table_schema_source': ''
        },
        'two': {
            'data_source': 'https://raw.githubusercontent.com/okfn/tabular-validator/master/examples/contacts/people.csv',
            #'table_schema_source': 'https://raw.githubusercontent.com/okfn/tabular-validator/master/examples/contacts/schema_valid.csv'
        },
        'three': {
            'data_source': 'https://raw.githubusercontent.com/okfn/tabular-validator/master/examples/contacts/people.csv',
            'table_schema_source': 'https://raw.githubusercontent.com/okfn/tabular-validator/master/examples/contacts/schema_invalid.json'
        },
        'four': {
            'data_source': '',
            'table_schema_source': ''
        },
        'five': {
            'data_source': '',
            'table_schema_source': ''
        }
    }

    if payload in payloads.keys():
        payload = payloads[payload]
        job_list = '/jobs'
        endpoint = '{0}{1}'.format(instance_url, job_list)
        click.echo('Running example against {0}'.format(endpoint))
        response = requests.post(endpoint, payload)<commit_msg>update CLI examples<commit_after># -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import os
import sys
import click
import requests


@click.group()
def cli():
    """The entry point into the CLI."""


@cli.command()
@click.argument('instance_url')
@click.argument('payload')
def examples(instance_url, payload):
    """Run some example data against a public instance of tvweb."""

    payloads = {
        'one': {
            'data_source': 'https://raw.githubusercontent.com/okfn/tabular-validator-web/master/examples/valid.csv',
            'table_schema_source': ''
        },
        'two': {
            'data_source': 'https://raw.githubusercontent.com/okfn/tabular-validator/master/examples/contacts/people.csv',
            'table_schema_source': 'https://raw.githubusercontent.com/okfn/tabular-validator/master/examples/contacts/schema_valid.json'
        },
        'three': {
            'data_source': 'https://raw.githubusercontent.com/okfn/tabular-validator/master/examples/contacts/people.csv',
            'table_schema_source': 'https://raw.githubusercontent.com/okfn/tabular-validator/master/examples/contacts/schema_invalid.json'
        }
    }

    if payload in payloads.keys():
        payload = payloads[payload]
        job_list = '/jobs'
        endpoint = '{0}{1}'.format(instance_url, job_list)
        click.echo('Running example against {0}'.format(endpoint))
        response = requests.post(endpoint, payload)
{'fraction_non_alphanumeric': 0.13559831629585087, 'fraction_numerical': 0.0024052916416115455, 'mean_word_length': 3.0327272727272727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2911463', 'n_tokens_mistral': 975, 'n_tokens_neox': 969, 'n_words': 177}