<commit_before>'use strict';

/*
 * Simple wrapper for the PHP action API
 */

const HyperSwitch = require('hyperswitch');
const HTTPError = HyperSwitch.HTTPError;
const Template = HyperSwitch.Template;

/**
 * Error translation
 */
const errDefs = {
    400: { status: 400, type: 'bad_request' },
    401: { status: 401, type: 'unauthorized' },
    403: { status: 403, type: 'forbidden#edit' },
    409: { status: 409, type: 'conflict' },
    413: { status: 413, type: 'too_large' },
    429: { status: 429, type: 'rate_exceeded' },
    500: { status: 500, type: 'server_error' },
    501: { status: 501, type: 'not_supported' }
};

const errCodes = {
    /* 400 - bad request */
    articleexists: errDefs['400'],
    badformat: errDefs['400'],
    badmd5: errDefs['400'],
    badtoken: errDefs['400'],
    invalidparammix: errDefs['400'],
    invalidsection: errDefs['400'],
    invalidtitle: errDefs['400'],
    invaliduser: errDefs['400'],
    missingparam: errDefs['400'],
    missingtitle: errDefs['400'],
    nosuchpageid: errDefs['400'],
    nosuchrcid: errDefs['400'],
    nosuchrevid: errDefs['400'],
    nosuchsection: errDefs['400'],
    nosuchuser: errDefs['400'],
    notext: errDefs['400'],
    notitle: errDefs['400'],
    pagecannotexist: errDefs['400'],
    'readinglists-db-error-not-set-up': errDefs['400'],
    'readinglists-db-error-already-set-up': errDefs['400'],
    'readinglists-db-error-cannot-delete-default-list': errDefs['400'],
    'readinglists-db-error-no-such-list': errDefs['400'],
    'readinglists-db-error-no-such-list-entry': errDefs['400'],
    'readinglists-db-error-not-own-list': errDefs['400'],
    'readinglists-db-error-not-own-list-entry': errDefs['400'],
    'readinglists-db-error-list-deleted': errDefs['400'],
    'readinglists-db-error-list-entry-deleted': errDefs['400'],
    'readinglists-db-error-duplicate-page': errDefs['400'],
    'readinglists-db-error-empty-list-ids': errDefs['400'],
    'readinglists-db-error-empty-order': errDefs['400'],
    'readinglists-db-error-missing-list': errDefs['400'],
    'readinglists-db-error-missing-list-entry': errDefs['400'],
    'readinglists-db-error-entry-not-in-list': errDefs['400'],
    'readinglists-db-error-user-required': errDefs['400'],
    'readinglists-apierror-project-title-param': errDefs['400'],
    'readinglists-apierror-too-old': errDefs['400'],
    revwrongpage: errDefs['400'],

    /* 401 - unauthorised */
    'cantcreate-anon': errDefs['401'],
    confirmemail: errDefs['401'],
    'noedit-anon': errDefs['401'],
    'noimageredirect-anon': errDefs['401'],
    protectedpage: errDefs['401'],
    readapidenied: errDefs['401'],
    /* 403 - access denied */
    autoblocked: errDefs['403'],
    blocked: errDefs['403'],
    cantcreate: errDefs['403'],
    customcssjsprotected: errDefs['403'],
    customcssprotected: errDefs['403'],
    customjsprotected: errDefs['403'],
    emptynewsection: errDefs['403'],
    emptypage: errDefs['403'],
    filtered: errDefs['403'],
    hookaborted: errDefs['403'],
    noedit: errDefs['403'],
    noimageredirect: errDefs['403'],
    permissiondenied: errDefs['403'],
    protectednamespace: errDefs['403'],
    'protectednamespace-interface': errDefs['403'],
    protectedtitle: errDefs['403'],
    readonly: errDefs['403'],
    unsupportednamespace: errDefs['403'],<commit_msg>Reading lists: fix error definitions<commit_after>'use strict';

/*
 * Simple wrapper for the PHP action API
 */

const HyperSwitch = require('hyperswitch');
const HTTPError = HyperSwitch.HTTPError;
const Template = HyperSwitch.Template;

/**
 * Error translation
 */
const errDefs = {
    400: { status: 400, type: 'bad_request' },
    401: { status: 401, type: 'unauthorized' },
    403: { status: 403, type: 'forbidden#edit' },
    409: { status: 409, type: 'conflict' },
    413: { status: 413, type: 'too_large' },
    429: { status: 429, type: 'rate_exceeded' },
    500: { status: 500, type: 'server_error' },
    501: { status: 501, type: 'not_supported' }
};

const errCodes = {
    /* 400 - bad request */
    articleexists: errDefs['400'],
    badformat: errDefs['400'],
    badmd5: errDefs['400'],
    badtoken: errDefs['400'],
    invalidparammix: errDefs['400'],
    invalidsection: errDefs['400'],
    invalidtitle: errDefs['400'],
    invaliduser: errDefs['400'],
    missingparam: errDefs['400'],
    missingtitle: errDefs['400'],
    nosuchpageid: errDefs['400'],
    nosuchrcid: errDefs['400'],
    nosuchrevid: errDefs['400'],
    nosuchsection: errDefs['400'],
    nosuchuser: errDefs['400'],
    notext: errDefs['400'],
    notitle: errDefs['400'],
    pagecannotexist: errDefs['400'],
    'readinglists-db-error-not-set-up': errDefs['400'],
    'readinglists-db-error-already-set-up': errDefs['400'],
    'readinglists-db-error-cannot-delete-default-list': errDefs['400'],
    'readinglists-db-error-cannot-update-default-list': errDefs['400'],
    'readinglists-db-error-no-such-list': errDefs['400'],
    'readinglists-db-error-no-such-list-entry': errDefs['400'],
    'readinglists-db-error-not-own-list': errDefs['400'],
    'readinglists-db-error-not-own-list-entry': errDefs['400'],
    'readinglists-db-error-list-deleted': errDefs['400'],
    'readinglists-db-error-list-entry-deleted': errDefs['400'],
    'readinglists-db-error-duplicate-page': errDefs['400'],
    'readinglists-db-error-empty-list-ids': errDefs['400'],
    'readinglists-db-error-user-required': errDefs['400'],
    'readinglists-db-error-list-limit': errDefs['400'],
    'readinglists-db-error-entry-limit': errDefs['400'],
    'readinglists-db-error-too-long': errDefs['400'],
    'readinglists-db-error-no-such-project': errDefs['400'],
    'readinglists-apierror-project-title-param': errDefs['400'],
    'readinglists-apierror-too-old': errDefs['400'],
    'readinglists-apierror-invalidsort-notbyname': errDefs['400'],
    revwrongpage: errDefs['400'],

    /* 401 - unauthorised */
    'cantcreate-anon': errDefs['401'],
    confirmemail: errDefs['401'],
    'noedit-anon': errDefs['401'],
    'noimageredirect-anon': errDefs['401'],
    protectedpage: errDefs['401'],
    readapidenied: errDefs['401'],
    /* 403 - access denied */
    autoblocked: errDefs['403'],
    blocked: errDefs['403'],
    cantcreate: errDefs['403'],
    customcssjsprotected: errDefs['403'],
    customcssprotected: errDefs['403'],
    customjsprotected: errDefs['403'],
    emptynewsection: errDefs['403'],
    emptypage: errDefs['403'],
    filtered: errDefs['403'],
    hookaborted: errDefs['403'],
    noedit: errDefs['403'],
    noimageredirect: errDefs['403'],
    permissiondenied: errDefs['403'],
    protectednamespace: errDefs['403'],
    'protectednamespace-interface': errDefs['403'],
    protectedtitle: errDefs['403'],
    readonly: errDefs['403'],
    unsupportednamespace: errDefs['403'],
{'fraction_non_alphanumeric': 0.18559718969555036, 'fraction_numerical': 0.07142857142857142, 'mean_word_length': 4.288699690402477, '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': '4365388', 'n_tokens_mistral': 2752, 'n_tokens_neox': 2358, 'n_words': 395}