<commit_before>from flask import Flask, jsonify, request
from uno import get_state, play_card

app = Flask(__name__)


@app.route('/getstate')
def get_state_route():
    game_id = request.args.get('game_id')
    player_id = request.args.get('player_id')
    game_data = get_state(game_id, player_id)
    return jsonify(**game_data)


@app.route('/playcard')
def play_card_route():
    game_id = request.args.get('game_id')
    player_id = request.args.get('player_id')
    card_id = request.args.get('card_id')
    selected_color = request.args.get('selected_color')
    result = play_card(game_id, player_id, card_id, selected_color)<commit_msg>Implement newgame API route<commit_after>from flask import Flask, jsonify, request
from uno import admin_start_game, create_new_game, get_state, join_game, \
    leave_game, play_card, player_draw_card

app = Flask(__name__)


@app.route('/newgame')
def new_game():
    game_name = request.args.get('game_name')
    player_name = request.args.get('player_name')
    points_to_win = request.args.get('points_to_win')
    min_players = request.args.get('min_players')
    max_players = request.args.get('max_players')
    game_data = create_new_game(game_name, player_name, points_to_win,
                                min_players, max_players)
    game_id = game_data['id']
    player_id = game_data['players'][0]['id']
    return jsonify(game_id=game_id, player_id=player_id)


@app.route('/getstate')
def get_state_route():
    game_id = request.args.get('game_id')
    player_id = request.args.get('player_id')
    game_data = get_state(game_id, player_id)
    return jsonify(**game_data)


@app.route('/playcard')
def play_card_route():
    game_id = request.args.get('game_id')
    player_id = request.args.get('player_id')
    card_id = request.args.get('card_id')
    selected_color = request.args.get('selected_color')
    result = play_card(game_id, player_id, card_id, selected_color)
{'fraction_non_alphanumeric': 0.12828438948995363, 'fraction_numerical': 0.0005151983513652757, 'mean_word_length': 4.661807580174927, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5761035', 'n_tokens_mistral': 682, 'n_tokens_neox': 672, 'n_words': 115}