<commit_before>#!/usr/bin/env python

import subprocess
from collections import OrderedDict

from flask import Flask, request, redirect, render_template, send_from_directory
from flask.ext.cache import Cache

import lang_ast
import literal_gen
import nodes
import settings

for node in nodes.nodes:
    nodes.nodes[node].run_tests()
        
app = Flask(__name__,
            template_folder="web_content/template/",
            static_folder="web_content/static/")
cache = Cache(app, config={'CACHE_TYPE': 'simple'})

modified_process = subprocess.Popen(["git",
                                     "log",
                                     "-1",
                                     "--format=%cd",
                                     "--date=local"],
                                    stdout=subprocess.PIPE)
output, errors = modified_process.communicate()
updated_time = output.decode()[:-1]


@app.route("/")
def root():
    code = request.args.get("code", "")
    inp = request.args.get("input", "")
    warnings = int(request.args.get("warnings", "1"))
    return render_template("index.html",
                           last_updated=updated_time,
                           docs=docs(),
                           code=code,
                           input=inp,
                           warnings=warnings)


@app.route("/code")<commit_msg>web.py overwrites stdin with an empty file-like object<commit_after>#!/usr/bin/env python

import subprocess
from collections import OrderedDict
import sys
from io import StringIO

from flask import Flask, request, redirect, render_template, send_from_directory
from flask.ext.cache import Cache

import lang_ast
import literal_gen
import nodes
import settings

for node in nodes.nodes:
    nodes.nodes[node].run_tests()
        

sys.stdin = StringIO()
app = Flask(__name__,
            template_folder="web_content/template/",
            static_folder="web_content/static/")
cache = Cache(app, config={'CACHE_TYPE': 'simple'})

modified_process = subprocess.Popen(["git",
                                     "log",
                                     "-1",
                                     "--format=%cd",
                                     "--date=local"],
                                    stdout=subprocess.PIPE)
output, errors = modified_process.communicate()
updated_time = output.decode()[:-1]


@app.route("/")
def root():
    code = request.args.get("code", "")
    inp = request.args.get("input", "")
    warnings = int(request.args.get("warnings", "1"))
    return render_template("index.html",
                           last_updated=updated_time,
                           docs=docs(),
                           code=code,
                           input=inp,
                           warnings=warnings)


@app.route("/code")
{'fraction_non_alphanumeric': 0.11530249110320284, 'fraction_numerical': 0.002135231316725979, 'mean_word_length': 1.7859266600594648, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1226886', 'n_tokens_mistral': 750, 'n_tokens_neox': 731, 'n_words': 156}