<commit_before>from flask import Flask, request, session, send_from_directory, render_template
from flask import Blueprint
import api, json

from api.common import WebSuccess, WebError
from api.annotations import api_wrapper, require_login, require_teacher, require_admin, check_csrf
from api.annotations import block_before_competition, block_after_competition
from api.annotations import log_action

blueprint = Blueprint("problem_api", __name__)

@blueprint.route('', methods=['GET'])
@api_wrapper
@require_login
@block_before_competition(WebError("The competition has not begun yet!"))
def get_visible_problems_hook():
    return WebSuccess(data=api.problem.get_visible_problems(api.user.get_user()['tid']))

@blueprint.route('/unlocked', methods=['GET'])
@api_wrapper
@require_login
@block_before_competition(WebError("The competition has not begun yet!"))
def get_unlocked_problems_hook():
    return WebSuccess(data=api.problem.get_unlocked_problems(api.user.get_user()['tid']))

@blueprint.route('/solved', methods=['GET'])
@api_wrapper
@require_login
@block_before_competition(WebError("The competition has not begun yet!"))
def get_solved_problems_hook():
    solved_problems = api.problem.get_solved_problems(api.user.get_user()['tid'])

    for problem in solved_problems:
        problem.pop("instances")
        problem.pop("pkg_dependencies")

    return WebSuccess(data=solved_problems)

@blueprint.route('/submit', methods=['POST'])
@api_wrapper
@check_csrf
@require_login<commit_msg>pkg_dependencies needs to be optionally removed.<commit_after>from flask import Flask, request, session, send_from_directory, render_template
from flask import Blueprint
import api, json

from api.common import WebSuccess, WebError
from api.annotations import api_wrapper, require_login, require_teacher, require_admin, check_csrf
from api.annotations import block_before_competition, block_after_competition
from api.annotations import log_action

blueprint = Blueprint("problem_api", __name__)

@blueprint.route('', methods=['GET'])
@api_wrapper
@require_login
@block_before_competition(WebError("The competition has not begun yet!"))
def get_visible_problems_hook():
    return WebSuccess(data=api.problem.get_visible_problems(api.user.get_user()['tid']))

@blueprint.route('/unlocked', methods=['GET'])
@api_wrapper
@require_login
@block_before_competition(WebError("The competition has not begun yet!"))
def get_unlocked_problems_hook():
    return WebSuccess(data=api.problem.get_unlocked_problems(api.user.get_user()['tid']))

@blueprint.route('/solved', methods=['GET'])
@api_wrapper
@require_login
@block_before_competition(WebError("The competition has not begun yet!"))
def get_solved_problems_hook():
    solved_problems = api.problem.get_solved_problems(api.user.get_user()['tid'])

    for problem in solved_problems:
        problem.pop("instances")
        problem.pop("pkg_dependencies", None)

    return WebSuccess(data=solved_problems)

@blueprint.route('/submit', methods=['POST'])
@api_wrapper
@check_csrf
@require_login
{'fraction_non_alphanumeric': 0.11501807426881368, 'fraction_numerical': 0.0, 'mean_word_length': 8.005917159763314, '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': '1190769', 'n_tokens_mistral': 960, 'n_tokens_neox': 921, 'n_words': 195}