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"use strict";2var __defProp = Object.defineProperty;3var __getOwnPropDesc = Object.getOwnPropertyDescriptor;4var __getOwnPropNames = Object.getOwnPropertyNames;5var __hasOwnProp = Object.prototype.hasOwnProperty;6var __export = (target, all) => {7 for (var name in all)8 __defProp(target, name, { get: all[name], enumerable: true });9};10var __copyProps = (to, from, except, desc) => {11 if (from && typeof from === "object" || typeof from === "function") {12 for (let key of __getOwnPropNames(from))13 if (!__hasOwnProp.call(to, key) && key !== except)14 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });15 }16 return to;17};18var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);19var python_exports = {};20__export(python_exports, {21 PythonLanguageGenerator: () => PythonLanguageGenerator22});23module.exports = __toCommonJS(python_exports);24var import_language = require("./language");25var import_utils = require("../../utils");26var import_deviceDescriptors = require("../deviceDescriptors");27class PythonLanguageGenerator {28 constructor(isAsync, isPyTest) {29 this.groupName = "Python";30 this.highlighter = "python";31 this.id = isPyTest ? "python-pytest" : isAsync ? "python-async" : "python";32 this.name = isPyTest ? "Pytest" : isAsync ? "Library Async" : "Library";33 this._isAsync = isAsync;34 this._isPyTest = isPyTest;35 this._awaitPrefix = isAsync ? "await " : "";36 this._asyncPrefix = isAsync ? "async " : "";37 }38 generateAction(actionInContext) {39 const action = actionInContext.action;40 if (this._isPyTest && (action.name === "openPage" || action.name === "closePage"))41 return "";42 const pageAlias = actionInContext.frame.pageAlias;43 const formatter = new PythonFormatter(4);44 if (action.name === "openPage") {45 formatter.add(`${pageAlias} = ${this._awaitPrefix}context.new_page()`);46 if (action.url && action.url !== "about:blank" && action.url !== "chrome://newtab/")47 formatter.add(`${this._awaitPrefix}${pageAlias}.goto(${quote(action.url)})`);48 return formatter.format();49 }50 const locators = actionInContext.frame.framePath.map((selector) => `.${this._asLocator(selector)}.content_frame`);51 const subject = `${pageAlias}${locators.join("")}`;52 const signals = (0, import_language.toSignalMap)(action);53 if (signals.dialog)54 formatter.add(` ${pageAlias}.once("dialog", lambda dialog: dialog.dismiss())`);55 let code = `${this._awaitPrefix}${this._generateActionCall(subject, actionInContext)}`;56 if (signals.popup) {57 code = `${this._asyncPrefix}with ${pageAlias}.expect_popup() as ${signals.popup.popupAlias}_info {58 ${code}59 }60 ${signals.popup.popupAlias} = ${this._awaitPrefix}${signals.popup.popupAlias}_info.value`;61 }62 if (signals.download) {63 code = `${this._asyncPrefix}with ${pageAlias}.expect_download() as download${signals.download.downloadAlias}_info {64 ${code}65 }66 download${signals.download.downloadAlias} = ${this._awaitPrefix}download${signals.download.downloadAlias}_info.value`;67 }68 formatter.add(code);69 return formatter.format();70 }71 _generateActionCall(subject, actionInContext) {72 const action = actionInContext.action;73 switch (action.name) {74 case "openPage":75 throw Error("Not reached");76 case "closePage":77 return `${subject}.close()`;78 case "click": {79 let method = "click";80 if (action.clickCount === 2)81 method = "dblclick";82 const options = (0, import_language.toClickOptionsForSourceCode)(action);83 const optionsString = formatOptions(options, false);84 return `${subject}.${this._asLocator(action.selector)}.${method}(${optionsString})`;85 }86 case "hover":87 return `${subject}.${this._asLocator(action.selector)}.hover(${formatOptions({ position: action.position }, false)})`;88 case "check":89 return `${subject}.${this._asLocator(action.selector)}.check()`;90 case "uncheck":91 return `${subject}.${this._asLocator(action.selector)}.uncheck()`;92 case "fill":93 return `${subject}.${this._asLocator(action.selector)}.fill(${quote(action.text)})`;94 case "setInputFiles":95 return `${subject}.${this._asLocator(action.selector)}.set_input_files(${formatValue(action.files.length === 1 ? action.files[0] : action.files)})`;96 case "press": {97 const modifiers = (0, import_language.toKeyboardModifiers)(action.modifiers);98 const shortcut = [...modifiers, action.key].join("+");99 return `${subject}.${this._asLocator(action.selector)}.press(${quote(shortcut)})`;100 }101 case "navigate":102 return `${subject}.goto(${quote(action.url)})`;103 case "select":104 return `${subject}.${this._asLocator(action.selector)}.select_option(${formatValue(action.options.length === 1 ? action.options[0] : action.options)})`;105 case "assertText":106 return `expect(${subject}.${this._asLocator(action.selector)}).${action.substring ? "to_contain_text" : "to_have_text"}(${quote(action.text)})`;107 case "assertChecked":108 return `expect(${subject}.${this._asLocator(action.selector)}).${action.checked ? "to_be_checked()" : "not_to_be_checked()"}`;109 case "assertVisible":110 return `expect(${subject}.${this._asLocator(action.selector)}).to_be_visible()`;111 case "assertValue": {112 const assertion = action.value ? `to_have_value(${quote(action.value)})` : `to_be_empty()`;113 return `expect(${subject}.${this._asLocator(action.selector)}).${assertion};`;114 }115 case "assertSnapshot":116 return `expect(${subject}.${this._asLocator(action.selector)}).to_match_aria_snapshot(${quote(action.ariaSnapshot)})`;117 }118 }119 _asLocator(selector) {120 return (0, import_utils.asLocator)("python", selector);121 }122 generateHeader(options) {123 const formatter = new PythonFormatter();124 const recordHar = options.contextOptions.recordHar;125 if (this._isPyTest) {126 const contextOptions = formatContextOptions(127 options.contextOptions,128 options.deviceName,129 true130 /* asDict */131 );132 const fixture = contextOptions ? `133 134@pytest.fixture(scope="session")135def browser_context_args(browser_context_args, playwright) {136 return {${contextOptions}}137}138` : "";139 formatter.add(`${options.deviceName || contextOptions ? "import pytest\n" : ""}import re140from playwright.sync_api import Page, expect141${fixture}142 143def test_example(page: Page) -> None {`);144 if (recordHar)145 formatter.add(` page.route_from_har(${quote(recordHar.path)}${typeof recordHar.urlFilter === "string" ? `, url=${quote(recordHar.urlFilter)}` : ""})`);146 } else if (this._isAsync) {147 formatter.add(`148import asyncio149import re150from playwright.async_api import Playwright, async_playwright, expect151 152 153async def run(playwright: Playwright) -> None {154 browser = await playwright.${options.browserName}.launch(${formatOptions(options.launchOptions, false)})155 context = await browser.new_context(${formatContextOptions(options.contextOptions, options.deviceName)})`);156 if (recordHar)157 formatter.add(` await context.route_from_har(${quote(recordHar.path)}${typeof recordHar.urlFilter === "string" ? `, url=${quote(recordHar.urlFilter)}` : ""})`);158 } else {159 formatter.add(`160import re161from playwright.sync_api import Playwright, sync_playwright, expect162 163 164def run(playwright: Playwright) -> None {165 browser = playwright.${options.browserName}.launch(${formatOptions(options.launchOptions, false)})166 context = browser.new_context(${formatContextOptions(options.contextOptions, options.deviceName)})`);167 if (recordHar)168 formatter.add(` context.route_from_har(${quote(recordHar.path)}${typeof recordHar.urlFilter === "string" ? `, url=${quote(recordHar.urlFilter)}` : ""})`);169 }170 return formatter.format();171 }172 generateFooter(saveStorage) {173 if (this._isPyTest) {174 return "";175 } else if (this._isAsync) {176 const storageStateLine = saveStorage ? `177 await context.storage_state(path=${quote(saveStorage)})` : "";178 return `179 # ---------------------${storageStateLine}180 await context.close()181 await browser.close()182 183 184async def main() -> None:185 async with async_playwright() as playwright:186 await run(playwright)187 188 189asyncio.run(main())190`;191 } else {192 const storageStateLine = saveStorage ? `193 context.storage_state(path=${quote(saveStorage)})` : "";194 return `195 # ---------------------${storageStateLine}196 context.close()197 browser.close()198 199 200with sync_playwright() as playwright:201 run(playwright)202`;203 }204 }205}206function formatValue(value) {207 if (value === false)208 return "False";209 if (value === true)210 return "True";211 if (value === void 0)212 return "None";213 if (Array.isArray(value))214 return `[${value.map(formatValue).join(", ")}]`;215 if (typeof value === "string")216 return quote(value);217 if (typeof value === "object")218 return JSON.stringify(value);219 return String(value);220}221function formatOptions(value, hasArguments, asDict) {222 const keys = Object.keys(value).filter((key) => value[key] !== void 0).sort();223 if (!keys.length)224 return "";225 return (hasArguments ? ", " : "") + keys.map((key) => {226 if (asDict)227 return `"${(0, import_utils.toSnakeCase)(key)}": ${formatValue(value[key])}`;228 return `${(0, import_utils.toSnakeCase)(key)}=${formatValue(value[key])}`;229 }).join(", ");230}231function formatContextOptions(options, deviceName, asDict) {232 options = { ...options, recordHar: void 0 };233 const device = deviceName && import_deviceDescriptors.deviceDescriptors[deviceName];234 if (!device)235 return formatOptions(options, false, asDict);236 return `**playwright.devices[${quote(deviceName)}]` + formatOptions((0, import_language.sanitizeDeviceOptions)(device, options), true, asDict);237}238class PythonFormatter {239 constructor(offset = 0) {240 this._lines = [];241 this._baseIndent = " ".repeat(4);242 this._baseOffset = " ".repeat(offset);243 }244 prepend(text) {245 this._lines = text.trim().split("\n").map((line) => line.trim()).concat(this._lines);246 }247 add(text) {248 this._lines.push(...text.trim().split("\n").map((line) => line.trim()));249 }250 newLine() {251 this._lines.push("");252 }253 format() {254 let spaces = "";255 const lines = [];256 this._lines.forEach((line) => {257 if (line === "")258 return lines.push(line);259 if (line === "}") {260 spaces = spaces.substring(this._baseIndent.length);261 return;262 }263 line = spaces + line;264 if (line.endsWith("{")) {265 spaces += this._baseIndent;266 line = line.substring(0, line.length - 1).trimEnd() + ":";267 }268 return lines.push(this._baseOffset + line);269 });270 return lines.join("\n");271 }272}273function quote(text) {274 return (0, import_utils.escapeWithQuotes)(text, '"');275}276// Annotate the CommonJS export names for ESM import in node:2770 && (module.exports = {278 PythonLanguageGenerator279});280 