<commit_before>import itertools
import json
import logging
import re

import flask
from flask import request
from cache import cache
import requests
import rethinkdb as r

import web.api.api_util as api_util
import db


api = flask.Blueprint("api", __name__, url_prefix="/api")

r_conn = db.util.r_conn


def _should_skip_get_plugins_cache():
    """Whether the current request to /api/plugins should not be cached."""
    page = int(request.args.get('page', 1))
    search = request.args.get('query', '')
<commit_msg>Fix 500 on plugin submission<commit_after>import itertools
import json
import logging
import re

import flask
from flask import request
from cache import cache
import requests
import rethinkdb as r

import web.api.api_util as api_util
import db


try:
    import secrets
    _HIPCHAT_TOKEN = secrets.HIPCHAT_TOKEN
    _HIPCHAT_ROOM_ID = secrets.HIPCHAT_ROOM_ID
except ImportError:
    _HIPCHAT_TOKEN = None
    _HIPCHAT_ROOM_ID = None


api = flask.Blueprint("api", __name__, url_prefix="/api")

r_conn = db.util.r_conn


def _should_skip_get_plugins_cache():
    """Whether the current request to /api/plugins should not be cached."""
    page = int(request.args.get('page', 1))
    search = request.args.get('query', '')

{'fraction_non_alphanumeric': 0.09024979854955681, 'fraction_numerical': 0.0040290088638195, 'mean_word_length': 4.495575221238938, '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': '7170565', 'n_tokens_mistral': 413, 'n_tokens_neox': 399, 'n_words': 123}