<commit_before>const formidable = require('formidable');
const fs = require('fs');
const path = require('path');
const promisify = require('es6-promisify');
const TypeCheck = require('js-typecheck');
const HandlerParser = require('../../HandlerParser');
const Util = require('../../Util');

// promisifying
const mkdtemp = promisify(fs.mkdtemp);
const rename = promisify(fs.rename);
const stat = promisify(fs.stat);

// symbols used for private instance variables to avoid any potential clashing
// caused by re-implementations
const _temporaryFolders = Symbol('temporaryFolders');
const _request = Symbol('request');

/**
 * Web request parser
 *
 * This parser is used by the {@link Web} handler to query values from a request.
 *
 * All serializable inputs are supported by this parser. Also, it deals with
 * file uploads automatically, therefore any {@link FilePath} input becomes a potential
 * upload field, when that is the case the input gets assigned with the file path
 * about where the file has been uploaded to. By default it tries to keep the original
 * uploaded file name by replacing any illegal character with underscore, however you can
 * control this behavior via `uploadPreserveFileName` (if disabled each uploaded file
 * gets named with an unique name).
 *
 * This parser works by looking for the input names in the request, for instance:
 *
 * `http://.../?myInput=10&myOtherInput=20`
 *
 * ```
 * class MyAction extends Oca.Action {
 *   constructor(){
 *     super();
 *     this.createInput('myInput: numeric');
 *     this.createInput('myOtherInput: numeric');
 *   }
 * }
 * ```
 *
 * When a value is found for the input, it gets loaded via {@link Input.parseValue}
 * where each input implementation has its own way of parsing the serialized data,
 * to find out about how a value is serialized for an specific input type you could simply
 * set an arbitrary value to the input you are interessed then query it back through
 * {@link Input.serializeValue}. Also, Oca provides a reference datasheet
 * about the serialization forms for the inputs bundled with it, found at {@link HandlerParser}.
 *
 * **Route parameters:**
 * If an webfied action contains route parameters defined (`/users/:userId/books/:bookId`)
 * then this parser tries to find them under the action input names.<commit_msg>improved route parameters documentation<commit_after>const formidable = require('formidable');
const fs = require('fs');
const path = require('path');
const promisify = require('es6-promisify');
const TypeCheck = require('js-typecheck');
const HandlerParser = require('../../HandlerParser');
const Util = require('../../Util');

// promisifying
const mkdtemp = promisify(fs.mkdtemp);
const rename = promisify(fs.rename);
const stat = promisify(fs.stat);

// symbols used for private instance variables to avoid any potential clashing
// caused by re-implementations
const _temporaryFolders = Symbol('temporaryFolders');
const _request = Symbol('request');

/**
 * Web request parser
 *
 * This parser is used by the {@link Web} handler to query values from a request.
 *
 * All serializable inputs are supported by this parser. Also, it deals with
 * file uploads automatically, therefore any {@link FilePath} input becomes a potential
 * upload field, when that is the case the input gets assigned with the file path
 * about where the file has been uploaded to. By default it tries to keep the original
 * uploaded file name by replacing any illegal character with underscore, however you can
 * control this behavior via `uploadPreserveFileName` (if disabled each uploaded file
 * gets named with an unique name).
 *
 * This parser works by looking for the input names in the request, for instance:
 *
 * `http://.../?myInput=10&myOtherInput=20`
 *
 * ```
 * class MyAction extends Oca.Action {
 *   constructor(){
 *     super();
 *     this.createInput('myInput: numeric');
 *     this.createInput('myOtherInput: numeric');
 *   }
 * }
 * ```
 *
 * When a value is found for the input, it gets loaded via {@link Input.parseValue}
 * where each input implementation has its own way of parsing the serialized data,
 * to find out about how a value is serialized for an specific input type you could simply
 * set an arbitrary value to the input you are interessed then query it back through
 * {@link Input.serializeValue}. Also, Oca provides a reference datasheet
 * about the serialization forms for the inputs bundled with it, found at {@link HandlerParser}.
 *
 * **Route parameters:**
 * If an webfied action contains route parameters defined (`/users/:userId/books/:bookId`)
 * this parser is going to try to find them under the action input names.
{'fraction_non_alphanumeric': 0.09737347853939782, 'fraction_numerical': 0.002135383301302584, 'mean_word_length': 4.298642533936651, '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': '5269495', 'n_tokens_mistral': 1217, 'n_tokens_neox': 1193, 'n_words': 566}