Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1/**2 * @fileoverview Flat Config Array3 * @author Nicholas C. Zakas4 */5 6"use strict";7 8//-----------------------------------------------------------------------------9// Requirements10//-----------------------------------------------------------------------------11 12const { ConfigArray, ConfigArraySymbol } = require("@eslint/config-array");13const { flatConfigSchema } = require("./flat-config-schema");14const { defaultConfig } = require("./default-config");15const { Config } = require("./config");16 17//-----------------------------------------------------------------------------18// Helpers19//-----------------------------------------------------------------------------20 21/**22 * Fields that are considered metadata and not part of the config object.23 */24const META_FIELDS = new Set(["name", "basePath"]);25 26/**27 * Wraps a config error with details about where the error occurred.28 * @param {Error} error The original error.29 * @param {number} originalLength The original length of the config array.30 * @param {number} baseLength The length of the base config.31 * @returns {TypeError} The new error with details.32 */33function wrapConfigErrorWithDetails(error, originalLength, baseLength) {34 let location = "user-defined";35 let configIndex = error.index;36 37 /*38 * A config array is set up in this order:39 * 1. Base config40 * 2. Original configs41 * 3. User-defined configs42 * 4. CLI-defined configs43 *44 * So we need to adjust the index to account for the base config.45 *46 * - If the index is less than the base length, it's in the base config47 * (as specified by `baseConfig` argument to `FlatConfigArray` constructor).48 * - If the index is greater than the base length but less than the original49 * length + base length, it's in the original config. The original config50 * is passed to the `FlatConfigArray` constructor as the first argument.51 * - Otherwise, it's in the user-defined config, which is loaded from the52 * config file and merged with any command-line options.53 */54 if (error.index < baseLength) {55 location = "base";56 } else if (error.index < originalLength + baseLength) {57 location = "original";58 configIndex = error.index - baseLength;59 } else {60 configIndex = error.index - originalLength - baseLength;61 }62 63 return new TypeError(64 `${error.message.slice(0, -1)} at ${location} index ${configIndex}.`,65 { cause: error },66 );67}68 69const originalBaseConfig = Symbol("originalBaseConfig");70const originalLength = Symbol("originalLength");71const baseLength = Symbol("baseLength");72 73//-----------------------------------------------------------------------------74// Exports75//-----------------------------------------------------------------------------76 77/**78 * Represents an array containing configuration information for ESLint.79 */80class FlatConfigArray extends ConfigArray {81 /**82 * Creates a new instance.83 * @param {*[]} configs An array of configuration information.84 * @param {{basePath: string, shouldIgnore: boolean, baseConfig: FlatConfig}} options The options85 * to use for the config array instance.86 */87 constructor(88 configs,89 { basePath, shouldIgnore = true, baseConfig = defaultConfig } = {},90 ) {91 super(configs, {92 basePath,93 schema: flatConfigSchema,94 });95 96 /**97 * The original length of the array before any modifications.98 * @type {number}99 */100 this[originalLength] = this.length;101 102 if (baseConfig[Symbol.iterator]) {103 this.unshift(...baseConfig);104 } else {105 this.unshift(baseConfig);106 }107 108 /**109 * The length of the array after applying the base config.110 * @type {number}111 */112 this[baseLength] = this.length - this[originalLength];113 114 /**115 * The base config used to build the config array.116 * @type {Array<FlatConfig>}117 */118 this[originalBaseConfig] = baseConfig;119 Object.defineProperty(this, originalBaseConfig, { writable: false });120 121 /**122 * Determines if `ignores` fields should be honored.123 * If true, then all `ignores` fields are honored.124 * if false, then only `ignores` fields in the baseConfig are honored.125 * @type {boolean}126 */127 this.shouldIgnore = shouldIgnore;128 Object.defineProperty(this, "shouldIgnore", { writable: false });129 }130 131 /**132 * Normalizes the array by calling the superclass method and catching/rethrowing133 * any ConfigError exceptions with additional details.134 * @param {any} [context] The context to use to normalize the array.135 * @returns {Promise<FlatConfigArray>} A promise that resolves when the array is normalized.136 */137 normalize(context) {138 return super.normalize(context).catch(error => {139 if (error.name === "ConfigError") {140 throw wrapConfigErrorWithDetails(141 error,142 this[originalLength],143 this[baseLength],144 );145 }146 147 throw error;148 });149 }150 151 /**152 * Normalizes the array by calling the superclass method and catching/rethrowing153 * any ConfigError exceptions with additional details.154 * @param {any} [context] The context to use to normalize the array.155 * @returns {FlatConfigArray} The current instance.156 * @throws {TypeError} If the config is invalid.157 */158 normalizeSync(context) {159 try {160 return super.normalizeSync(context);161 } catch (error) {162 if (error.name === "ConfigError") {163 throw wrapConfigErrorWithDetails(164 error,165 this[originalLength],166 this[baseLength],167 );168 }169 170 throw error;171 }172 }173 174 /* eslint-disable class-methods-use-this -- Desired as instance method */175 /**176 * Replaces a config with another config to allow us to put strings177 * in the config array that will be replaced by objects before178 * normalization.179 * @param {Object} config The config to preprocess.180 * @returns {Object} The preprocessed config.181 */182 [ConfigArraySymbol.preprocessConfig](config) {183 /*184 * If a config object has `ignores` and no other non-meta fields, then it's an object185 * for global ignores. If `shouldIgnore` is false, that object shouldn't apply,186 * so we'll remove its `ignores`.187 */188 if (189 !this.shouldIgnore &&190 !this[originalBaseConfig].includes(config) &&191 config.ignores &&192 Object.keys(config).filter(key => !META_FIELDS.has(key)).length ===193 1194 ) {195 /* eslint-disable-next-line no-unused-vars -- need to strip off other keys */196 const { ignores, ...otherKeys } = config;197 198 return otherKeys;199 }200 201 return config;202 }203 204 /**205 * Finalizes the config by replacing plugin references with their objects206 * and validating rule option schemas.207 * @param {Object} config The config to finalize.208 * @returns {Object} The finalized config.209 * @throws {TypeError} If the config is invalid.210 */211 [ConfigArraySymbol.finalizeConfig](config) {212 return new Config(config);213 }214 /* eslint-enable class-methods-use-this -- Desired as instance method */215}216 217exports.FlatConfigArray = FlatConfigArray;218 