<commit_before>import { description } from '../decorator/Description';
import { PipelineSchemaAbstract } from "./Abstract"
import { JSONSchema4 } from "json-schema"

/**
 * Defines schemas related to the model that are used by the pipeline for validation.
 */
export class PipelineSchemaMethodOptions extends PipelineSchemaAbstract {

    /**
     * An array of all the registered options separetly
     */
    public options: {
        [name: string]: {
            schema: JSONSchema4,
            description: string,
            required: boolean
        }
    }

    constructor() {
        let schema = {
            type: 'object',
            properties: {}
        } as JSONSchema4;
        super(schema)
        this.options = {}
    }

    /**
     * Add the following option to the schema
     * 
     * @param name 
     * @param option 
     * @param description 
     * @param required 
     */
    addOption(name: string, schema: JSONSchema4, description: string, required: boolean): this {
        this.options[name] = {
            schema: schema,
            description: description,
            required: required
        }

        // add the option to the main schema
        this.schemaObject.properties[name] = schema;
        this.schemaObject.properties[name].description = description;

        // set the option as required if necessary
        if (required) {
            this.schemaObject.required = this.schemaObject.required || []
            (this.schemaObject.required as string[]).push(name)
        }
        return this
    }

    hasOption(name): boolean {
        return !!this.options[name];
    }

    /**
     * Set the following description on this set of options
     * 
     * @param description 
     */
    setDescription(description: string): this {
        this.schemaObject.description = description;
        return this;
    }

    /**
     * Merge the current options schema with another one. This operation modifies the schema.
     */
    merge(otherOptions: PipelineSchemaMethodOptions): this {<commit_msg>Fix missing semicolon to calm down vscode<commit_after>import { description } from '../decorator/Description';
import { PipelineSchemaAbstract } from "./Abstract"
import { JSONSchema4 } from "json-schema"

/**
 * Defines schemas related to the model that are used by the pipeline for validation.
 */
export class PipelineSchemaMethodOptions extends PipelineSchemaAbstract {

    /**
     * An array of all the registered options separetly
     */
    public options: {
        [name: string]: {
            schema: JSONSchema4,
            description: string,
            required: boolean
        }
    }

    constructor() {
        let schema = {
            type: 'object',
            properties: {}
        } as JSONSchema4;
        super(schema)
        this.options = {}
    }

    /**
     * Add the following option to the schema
     * 
     * @param name 
     * @param option 
     * @param description 
     * @param required 
     */
    addOption(name: string, schema: JSONSchema4, description: string, required: boolean): this {
        this.options[name] = {
            schema: schema,
            description: description,
            required: required
        }

        // add the option to the main schema
        this.schemaObject.properties[name] = schema;
        this.schemaObject.properties[name].description = description;

        // set the option as required if necessary
        if (required) {
            this.schemaObject.required = this.schemaObject.required || [];
            (this.schemaObject.required as string[]).push(name);
        }
        return this
    }

    hasOption(name): boolean {
        return !!this.options[name];
    }

    /**
     * Set the following description on this set of options
     * 
     * @param description 
     */
    setDescription(description: string): this {
        this.schemaObject.description = description;
        return this;
    }

    /**
     * Merge the current options schema with another one. This operation modifies the schema.
     */
    merge(otherOptions: PipelineSchemaMethodOptions): this {
{'fraction_non_alphanumeric': 0.09340394800192585, 'fraction_numerical': 0.0019258545979778526, 'mean_word_length': 2.070953436807095, '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': '2641146', 'n_tokens_mistral': 1051, 'n_tokens_neox': 1020, 'n_words': 316}