<commit_before>#!/usr/bin/python2
"""Web server for GreenPiThumb."""

import argparse
import json

import klein

import dummy_values


def main(args):
    app = klein.Klein()

    # TODO(mtlynch): Replace all history routes with real values once the
    # non-dummy data is available.
    @app.route('/temperatureHistory.json')
    def temperature_history(request):
        return json.dumps(
            dummy_values.generate_values('temperature', 34.2, 5.0))

    @app.route('/lightHistory.json')
    def light_history(request):
        return json.dumps(dummy_values.generate_values('light_pct', 57.4, 3.0))

    @app.route('/soilMoistureHistory.json')
    def soil_moisture_history(request):
        return json.dumps(dummy_values.generate_values('moisture', 105.9, 4.0))

    @app.route('/ambientHumidityHistory.json')
    def ambient_humidity_history(request):
        return json.dumps(dummy_values.generate_values('humidity', 87.3, 6.0))

    app.run('0.0.0.0', args.port)


if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        prog='GreenPiThumb Web Server',
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument('-p', '--port', type=int, default=8888)
    main(parser.parse_args())<commit_msg>Changing naming of light percentage (#12)<commit_after>#!/usr/bin/python2
"""Web server for GreenPiThumb."""

import argparse
import json

import klein

import dummy_values


def main(args):
    app = klein.Klein()

    # TODO(mtlynch): Replace all history routes with real values once the
    # non-dummy data is available.
    @app.route('/temperatureHistory.json')
    def temperature_history(request):
        return json.dumps(
            dummy_values.generate_values('temperature', 34.2, 5.0))

    @app.route('/lightHistory.json')
    def light_history(request):
        return json.dumps(
            dummy_values.generate_values('lightPercentage', 57.4, 3.0))

    @app.route('/soilMoistureHistory.json')
    def soil_moisture_history(request):
        return json.dumps(dummy_values.generate_values('moisture', 105.9, 4.0))

    @app.route('/ambientHumidityHistory.json')
    def ambient_humidity_history(request):
        return json.dumps(dummy_values.generate_values('humidity', 87.3, 6.0))

    app.run('0.0.0.0', args.port)


if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        prog='GreenPiThumb Web Server',
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument('-p', '--port', type=int, default=8888)
    main(parser.parse_args())
{'fraction_non_alphanumeric': 0.13080827801639985, 'fraction_numerical': 0.02420929324482624, 'mean_word_length': 3.7709497206703912, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '7082878', 'n_tokens_mistral': 875, 'n_tokens_neox': 806, 'n_words': 157}