<commit_before>from __future__ import print_function

import json
import re
try:
    from urllib2 import urlopen
except ImportError:
    from urllib.request import urlopen
from flask import Flask, render_template, jsonify, request

app = Flask(__name__)

URLTEMPLATE = "https://api.github.com/users/{}/repos?per_page=100&page={}"

# load the html page
@app.route('/')
def index():
    return render_template("gh-index.html")


@app.route('/calculate')
def calculate():

    # create some empty lists
    data = []
    repolist = []
    jsondata = []
    countlist = []

    # take the input and validate it
    user = request.args.get("a")
    if len(user) > 30:
        return jsonify(result="[error : too many characters]")
    elif re.compile(r'[^a-zA-Z0-9]').search(user):
        return jsonify(result="[error : invalid characters \
                               - use only A-Z and 0-9]")<commit_msg>handle hyphens<commit_after>from __future__ import print_function

import json
import re
try:
    from urllib2 import urlopen
except ImportError:
    from urllib.request import urlopen
from flask import Flask, render_template, jsonify, request

app = Flask(__name__)

URLTEMPLATE = "https://api.github.com/users/{}/repos?per_page=100&page={}"

# load the html page
@app.route('/')
def index():
    return render_template("gh-index.html")


@app.route('/calculate')
def calculate():

    # create some empty lists
    data = []
    repolist = []
    jsondata = []
    countlist = []

    # take the input and validate it
    user = request.args.get("a")
    if len(user) > 30:
        return jsonify(result="[error : too many characters]")
    elif re.compile(r'[^-a-zA-Z0-9]').search(user):
        return jsonify(result="[error : invalid characters \
                               - use only A-Z, 0-9 and hyphen]")
{'fraction_non_alphanumeric': 0.13062568605927552, 'fraction_numerical': 0.010976948408342482, 'mean_word_length': 3.051111111111111, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1290538', 'n_tokens_mistral': 594, 'n_tokens_neox': 572, 'n_words': 155}