8 48.6-4.3 55.6-4.3s25.8.5 55.6 4.3c28.1 3.7 43.2 9.6 48.9 17.3 10.4 13.8-5.1 28.4-18.2 30.2zm111.7-85.2c-2.5 11.2-25.6 14.9-28 14.9s-6.5-3.9-11.2-3.8c-4.7.2-24.6 1.2-34.5 1.2-5.5 0-13.8-1.3-20-2.4-3.5-.6-4.5-5.1-1.7-7.2 7.1-5.2 19.6-12.9 36.9-17.8 26.1-7.4 40.8-8.4 55.3-7.9 2 .1 3.6 1.5 3.8 3.5.5 4.3 1.1 12-.6 19.5z"/></svg>';
  static const String logo_no_smoking =
      '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" preserveAspectRatio="xMidYMid meet" viewBox="0 0 512 512"><path fill="currentColor" d="M360 256h16v48h-16zm-248 48h129.6l-48-48H112v48z"/><path fill="currentColor" d="M364.5 60.1a8.79 8.79 0 01-1-.6 218.79 218.79 0 00-34.4-14.8l-5.4-1.8A223.2 223.2 0 00256 32C132.3 32 32 132.3 32 256a223.71 223.71 0 00115.4 195.8c.4.2.7.5 1.1.7a218.79 218.79 0 0034.4 14.8l5.4 1.8A222.7 222.7 0 00256 480c123.7 0 224-100.3 224-224A223.76 223.76 0 00364.5 60.1ZM256 426.4a161.85 161.85 0 01-27.2-2.4 170.14 170.14 0 01-28.5-7.3c-1.9-.6-3.8-1.2-5.6-1.9a162.39 162.39 0 01-19-8.6 170.33 170.33 0 01-90.1-150.3c0-37.2 12.4-71.4 32.7-99.4l237.2 237.2c-28.1 20.3-62.3 32.7-99.5 32.7Zm137.8-71L156.6 118.2c28-20.2 62.1-32.6 99.4-32.6a162.79 162.79 0 0127.2 2.4 170.14 170.14 0 0128.5 7.3c1.8.6 3.7 1.2 5.6 1.9a162 162 0 0118 8.1 170.25 170.25 0 0191.2 150.8c-.1 37.2-12.5 71.3-32.7 99.3Z"/><path fill="currentColor" d="M352 256h-34l34 34v-34zm32 0h16v48h-16zm-23.9-43.3c-8.8-4.1-22-5.7-45.6-5.7h-3.


wait Firestore.collection("ClassSummary")
      .doc(className)
      .collection("comment");
    for (let j = 0; j < commentNum; j++) {
      const uid = faker.internet.password();
      const commentData = {
        comment: sentenceArray[faker.random.number() % randomStateForComment],
        created_at: faker.date.past(),
        image: faker.image.animals(),
        is_recommend: Boolean(faker.random.number() % 2),
        made_by: uid,
        name: className,
        title: titleArray[faker.random.number() % randomStateForTitle],
        updated_at: faker.date.future()
      };
      batch.set(commentRef.doc(uid), commentData);
    }
    await batch.commit().catch((e: Error) => {
      console.log(JSON.stringify(e));
    });
  }
  resp.sendStatus(200);
  return;
};
'use strict';
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';
import { constants } from 'os';
interface ISurroundItem {
    label: string;
    description?: string;
    detail?: string;
    snippet: string;
    disabled?: boolean;
}
interface ISurroundConfig {
    [key: string]: ISurroundItem
}
function getSurroundConfig():ISurroundConfig { // 获取配置
    let config = vscode.workspace.getConfiguration("surround-python");
    const items = <ISurroundConfig>config.get("with", {});
    const custom = <ISurroundConfig>config.get("custom", {});
    return {...items, ...custom}

}

function getEnableSurroundItems() {
    const items: ISurroundItem[] = [];
    const surroundConfig = getSurroundConfig(); // 获取配置
    console.log("surround-python, config", surroundConfig);
    Object.keys(surroundConfig).forEach(surroundItemKey => {
        const surroundItem: ISurroundItem = surroundConfig[surroundItemKey];
        if(!surroundItem.disabled) {
            items.push(surroundItem);
        }
    })
    return items;
}
function getQuickPickItems(surroundItems: ISurroundItem[]) {
    const items: vscode.QuickPickItem[] = [];
    surroundItems.forEach(surroundItem => {
        if (!surroundItem.disabled) {
            const {label, description} = surroundItem;
            items.push({
                label,
                description
            });
        }
    })
    return items;
}
function applySurroundItem(key: string) { // 调用命令


nts.gstatic.com/s/montserrat/v29/JTUQjIg1_i6t8kCHKm459WxRxi7mw9c.woff2) format('woff2');unicode-range:U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;}@font-face{font-family:'Montserrat';font-style:italic;font-weight:300;font-display:swap;src:url(https://fonts.gstatic.com/s/montserrat/v29/JTUQjIg1_i6t8kCHKm459WxRxy7mw9c.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}@font-face{font-family:'Montserrat';font-style:italic;font-weight:300;font-display:swap;src:url(https://fonts.gstatic.com/s/montserrat/v29/JTUQjIg1_i6t8kCHKm459WxRyS7m.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}@font-face{font-family:'Montserrat';font-style:italic;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/montserrat/v29/JTUQjIg1_i6t8kCHKm459WxRxC7mw9c.woff2) format('woff2');unicode-range:U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;}@font-face{font-family:'Montserrat';font-style:italic;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/montserrat/v29/JTUQjIg1_i6t8kCHKm459WxRzS7mw9c.woff2) format('woff2');unicode-range:U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;}@font-face{font-family:'Montserrat';font-style:italic;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/montserrat/v29/JTUQjIg1_i6t8kCHKm459WxRxi7mw9c.woff2) format('woff2');unicode-range:U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0,


using Application.Common.Interfaces.Services.Mail;
using Contracts.Dtos.Requests;
using MailKit.Net.Smtp;
using MailKit.Security;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using MimeKit;

namespace Infrastructure.Services.Mail;

public class MailService(
    IOptions<EmailSettings> options,
    RazorViewToStringRenderer razorView,
    ILogger<MailService> logger
) : IMailService
{
    private readonly EmailSettings emailSettings = options.Value;

    public async Task<bool> SendAsync(MailMessageData metaData)
    {
        MimeMessage message = CreateEmailMessage(
            new MailData()
            {
                DisplayName = metaData.DisplayName,
                Subject = metaData.Subject,
                To = metaData.To,
            },
            metaData.Message!
        );
        return await DeliveryAsync(message);
    }

    public async Task<bool> SendWithTemplateAsync(MailTemplateData metaData)
    {
        string template = await razorView.RenderViewToStringAsync(metaData.Template!);
        MimeMessage message = CreateEmailMessage(
            new MailData()
            {
                DisplayName = metaData.DisplayName,
                Subject = metaData.Subject,
                To = metaData.To,
            },
            template
        );
        return await DeliveryAsync(message);
    }

    private async Task<bool> DeliveryAsync(M


 struct AssignExpr {
    pub span: Span,
    pub allow_assign_const: bool,
    pub lhs: P<Expr>,
    pub rhs: P<Expr>,
}

#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde_impl", derive(Serialize, Deserialize))]
pub struct AsExpr {
    pub span: Span,
    pub val: P<Expr>,
    pub ty: TyDef,
}

#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde_impl", derive(Serialize, Deserialize))]
pub struct BinaryExpr {
    pub span: Span,
    pub op: BinaryOp,
    pub lhs: P<Expr>,
    pub rhs: P<Expr>,
}

#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde_impl", derive(Serialize, Deserialize))]
pub struct CallExpr {
    pub span: Span,
    pub func: Ident,
    pub params: Vec<Expr>,
}

#[derive(Debug, Copy, Clone)]
#[cfg_attr(feature = "serde_impl", derive(Serialize, Deserialize))]
pub enum UnaryOp {
    Neg,
    Pos,
}

#[derive(Debug, Copy, Clone)]
#[cfg_attr(feature = "serde_impl", derive(Serialize, Deserialize))]
pub enum BinaryOp {
    Add,
    Sub,
    Mul,
    Div,
    Gt,
    Lt,
    Ge,
    Le,
    Eq,
    Neq,
}

#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde_impl", derive(Serialize, Deserialize))]
pub struct Ident {
    pub span: Span,
    pub name: SmolStr,
}
<reponame>jarvis-externals/snips-nlu-rebirth<gh_stars>1-10
extern crate serde_json;

use rumqtt::{MqttClient, MqttOptions, QoS, SecurityOptions, ReconnectOptions};
use snips_nlu_lib::SnipsNluEngine;
use snips_nlu_ontology::{IntentParserResult};
use std::str;
use std::process;
use crate::schema::config;
use crate::schema::hermes;

pub struct EngineContext {
    pub engine: SnipsNluEngine,
    pub engine_dir: String
}

impl EngineContext {

    pub fn set_engine(&mut self, new_engine: SnipsNluEngine) {
        self.engine = new_engine;
    }

    pub fn start(&mut self, config: &config::Config) {

        let mqtt_options = MqttOptions::new("snips-nlu-rebirth", config.mqtt.host.clone(), config.mqtt.port.clone())
            .set_keep_alive(30)
            .set_clean_session(false)
            .set_reconnect_opts(ReconnectOptions::Always(5))
            .set_security_opts(SecurityOptions::UsernamePassword(config.mqtt.username.clone(), config.mqtt.password.clone()));

        let _conn = match MqttClient::start(mqtt_options) {
            Ok(c) => {
                let (mut mqtt_client, notifications) = c;
                println!("Connect");

                mqtt_client.subscribe("hermes/nlu/#", QoS::AtLeastOnce).unwrap();
                mqtt_client.publish("hermes/nlu/ready", QoS::AtLeastOnce, false, env!("CARGO_PKG_VERSION")).unwrap();

                for notification in notifications {
                    match notification {
                        rumqtt::client::Notification::Publish(packet) => {
                            let query = str::from_utf8(&packet.payload).unwrap();

                            println!("Message on topic {:?}", packet.topic_name);

                            if &packet.topic_name == "hermes/nlu/query" {
                                self.hermes_nlu_query(&mut mqtt_client, &query);
                            } else if &packet.topic_name == "hermes/nlu/exit" {
                                let ret_code: i32 = match str::FromStr::from_str(query) {
                                    Ok(rc) => { rc },


ppedTypeDef sipTypeDef_QtNetwork_QList_0100QHostAddress = {
    {
        -1,
        0,
        0,
        SIP_TYPE_MAPPED,
        sipNameNr_4206,
        {0}
    },
    {
        -1,
        {0, 0, 1},
        0, 0,
        0, 0,
        0, 0,
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
    },
    assign_QList_0100QHostAddress,
    array_QList_0100QHostAddress,
    copy_QList_0100QHostAddress,
    release_QList_0100QHostAddress,
    convertTo_QList_0100QHostAddress,
    convertFrom_QList_0100QHostAddress
};
/*
 * Interface wrapper code.
 *
 * Generated by SIP 4.11.2 on Thu Jul 12 20:03:29 2012
 *
 * Copyright (c) 2010 Riverbank Computing Limited <info@riverbankcomputing.com>
 *
 * This file is part of PyQt.
 *
 * This file may be used under the terms of the GNU General Public
 * License versions 2.0 or 3.0 as published by the Free Software
 * Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
 * included in the packaging of this file.  Alternatively you may (at
 * your option) use any later version of the GNU General Public
 * License if such license has been publicly approved by Riverbank
 * Computing Limited (or its successors, if any) and the KDE Free Qt
 * Foundation. In addition, as a special exception, Riverbank gives you
 * certain additional rights. These rights are described in the Riverbank
 * GPL Exception version 1.1, which can be found in the file
 * GPL_EXCEPTION.txt in this package.
 *
 * Please review the following information to ensure GNU General
 * Public Licensing requirements will be met:
 * http://trolltech.com/products/qt/licenses/licensing/opensource/. If
 * you are unsure which license is appropriate for your use, please
 * review the following information:
 * http://trolltech.com/products/qt/licenses/licensing/licensingoverview
 * or contact the sales department at sales@riverbankcomputing.com.
 *
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

#include "sipAPIQtNetwork.h"

#line 36 "/home/tsheasha/GUC/Bachelors/android-python27/python-build/PyQt-x11-gpl-4.8/sip/QtNetwork/qnetworkproxy.sip"
#include <qnetworkproxy.h>
#line 39 "sipQtNetworkQNetworkProxyCapabilities.cpp"

#line 36 "/home/tsheasha/GUC/Bachelors/android-python27/python-build/PyQt-x11-gpl-4.8/sip/QtNetwork/qnetworkproxy.sip"
#include <qnetworkproxy.h>
#line 43 "sipQtNetworkQNetworkProxyCapabilities.cpp"

extern "C" {static int slot_QNetworkProxy_Capabilities___bool__(PyObject *);}
static int slot_QNetworkProxy_Capabilities___bool__(PyObject *sipSelf)
{
    QNetworkProxy::Capabilities *sipCpp = reinterpret_cast<QNetworkProxy::Capabilities *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_QNetworkProxy_Capabilities));

    if (!sipCpp)
        return -1;

    {
        {
            int sipRes = 0;

#line 336 "/home/tsheasha/GUC/Bachelors/android-python27/python-build/PyQt-x11-gpl-4.8/s


ind = ProtoField.new("Quote Event Liquidity Ind", "eurex.cash.eti.t7.v11.0.quoteeventliquidityind", ftypes.UINT8)
omi_eurex_cash_eti_t7_v11_0.fields.quote_event_match_id = ProtoField.new("Quote Event Match Id", "eurex.cash.eti.t7.v11.0.quoteeventmatchid", ftypes.UINT32)
omi_eurex_cash_eti_t7_v11_0.fields.quote_event_px = ProtoField.new("Quote Event Px", "eurex.cash.eti.t7.v11.0.quoteeventpx", ftypes.DOUBLE)
omi_eurex_cash_eti_t7_v11_0.fields.quote_event_qty = ProtoField.new("Quote Event Qty", "eurex.cash.eti.t7.v11.0.quoteeventqty", ftypes.DOUBLE)
omi_eurex_cash_eti_t7_v11_0.fields.quote_event_reason = ProtoField.new("Quote Event Reason", "eurex.cash.eti.t7.v11.0.quoteeventreason", ftypes.UINT8)
omi_eurex_cash_eti_t7_v11_0.fields.quote_event_side = ProtoField.new("Quote Event Side", "eurex.cash.eti.t7.v11.0.quoteeventside", ftypes.UINT8)
omi_eurex_cash_eti_t7_v11_0.fields.quote_event_type = ProtoField.new("Quote Event Type", "eurex.cash.eti.t7.v11.0.quoteeventtype", ftypes.UINT8)
omi_eurex_cash_eti_t7_v11_0.fields.quote_id = ProtoField.new("Quote Id", "eurex.cash.eti.t7.v11.0.quoteid", ftypes.UINT64)
omi_eurex_cash_eti_t7_v11_0.fields.quote_msg_id = ProtoField.new("Quote Msg Id", "eurex.cash.eti.t7.v11.0.quotemsgid", ftypes.UINT64)
omi_eurex_cash_eti_t7_v11_0.fields.quote_req_id = ProtoField.new("Quote Req Id", "eurex.cash.eti.t7.v11.0.quotereqid", ftypes.STRING)
omi_eurex_cash_eti_t7_v11_0.fields.quote_request_reject_reason = ProtoField.new("Quote Request Reject Reason", "eurex.cash.eti.t7.v11.0.quoterequestrejectreason", ftypes.UINT8)
omi_eurex_cash_eti_t7_v11_0.fields.quote_response_id = ProtoField.new("Quote Response Id", "eurex.cash.eti.t7.v11.0.quoteresponseid", ftypes.UINT64)
omi_eurex_cash_eti_t7_v11_0.fields.quote_size_type = ProtoField.new("Quote Size Type", "eurex.cash.eti.t7.v11.0.quotesizetype", ftypes.UINT8)
omi_eurex_cash_eti_t7_v11_0.fields.quote_type = ProtoField.new("Quote Type", "eurex.cash.eti.t7.v11.0.quotetype", ftypes.UINT8)
omi_eurex_cash_eti_t7_v11_0.fields.quoting_frequency = ProtoField.new("Quoting Frequency", "eurex.cash.eti.t7.v11.0.quotingfrequency", ftypes.UINT8)
omi_eurex_cash_eti_t7_v11_0.fields.quoting_status = ProtoField.new("Quoting Status", "eurex.cash.eti.t7.v11.0.quotingstatus", ftypes.UINT8)
omi_eurex_cash_


Codes.Ldloca_S, (byte)index);
				}
				else
				{
					throw new ArgumentException("For index greater than 256 Local variable name is required", nameof(index));
				}
			}
			else
			{
				if (index < 256)
				{
					il.Emit(OpCodes.Ldloc_S, (byte)index);
				}
				else
				{
					throw new ArgumentException("For index greater than 256 Local variable name is required", nameof(index));
				}
			}
		}

		internal static void StoreLocal(this ILGenerator il,


in-out;
}

/*
 *  Core Owl Carousel CSS File
 */

.owl-carousel {
    display: none;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
    /* position relative and z-index fix webkit rendering fonts issue */
    position: relative;
    z-index: 1;
}

.owl-carousel .owl-stage {
    position: relative;
    -ms-touch-action: pan-Y;
}

.owl-carousel .owl-stage:after {
    content: ".";
    display: block;
    clear: both;
    visibility: hidden;
    line-height: 0;
    height: 0;
}

.owl-carousel .owl-stage-outer {
    position: relative;
    overflow: hidden;
    /* fix for flashing background */
    -webkit-transform: translate3d(0px, 0px, 0px);
}

.owl-carousel .owl-controls .owl-nav .owl-prev,
.owl-carousel .owl-controls .owl-nav .owl-next,
.owl-carousel .owl-controls .owl-dot {
    cursor: pointer;
    cursor: hand;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.owl-carousel.owl-loaded {
    display: block;
}

.owl-carousel.owl-loading {
    opacity: 0;
    display: block;
}

.owl-carousel.owl-hidden {
    opacity: 0;
}

.owl-carousel .owl-refresh .owl-item {
    display: none;
}

.owl-carousel .owl-item {
    position: relative;
    min-height: 1px;
    float: left;
    -webkit-backface-visibility: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.owl-carousel .owl-item img {
    display: block;
    width: 100%;
    -webkit-transform-style: preserve-3d;
}

.owl-carousel.owl-text-select-on .owl-item {
    -webkit-user-select: auto;
    -moz-user-select: auto;
    -ms-user-select: auto;
    user-select: auto;
}

.owl-carousel .owl-grab {
    cursor: move;
    cursor: -webkit-grab;
    cursor: -o-grab;
    cursor: -ms-grab;
    cursor: grab;
}

.owl-carousel.owl-rtl {
    direction: rtl;
}

.owl-carousel.owl-rtl .owl-item {
    float: right;
}

/* No Js */

.no-js .owl-carousel {
    display: block;
}

/*
 * 	Owl Carousel - Lazy Load Plugin
 */

.owl-carousel .owl-item .owl-lazy {
    opacity: 0;
    -webkit-transition: opacity 400ms ease;
    transition: opacity 400ms ease;
}

.owl-carousel .owl-item img {
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
}

/*
 * 	Owl Carousel - Video Plugin
 */

.owl-carousel .owl-video-wrapper {
    position: relative;
    height: 100%;
    background: #000;
}

.owl-carousel .owl-video-play-icon {
    position: absolute;
    height: 80px;
    width:


NG_COMPRESSION: i32 = 16;
/// One of cv::ImwritePNGFlags, default is IMWRITE_PNG_STRATEGY_DEFAULT.
pub const IMWRITE_PNG_STRATEGY: i32 = 17;
/// Use this value for normal data.
pub const IMWRITE_PNG_STRATEGY_DEFAULT: i32 = 0;
/// Use this value for data produced by a filter (or predictor).Filtered data consists mostly of small values with a somewhat random distribution. In this case, the compression algorithm is tuned to compress them better.
pub const IMWRITE_PNG_STRATEGY_FILTERED: i32 = 1;
/// Using this value prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications.
pub const IMWRITE_PNG_STRATEGY_FIXED: i32 = 4;
/// Use this value to force Huffman encoding only (no string match).
pub const IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY: i32 = 2;
/// Use this value to limit match distances to one (run-length encoding).
pub const IMWRITE_PNG_STRATEGY_RLE: i32 = 3;
/// For PPM, PGM, or PBM, it can be a binary format flag, 0 or 1. Default value is 1.
pub const IMWRITE_PXM_BINARY: i32 = 32;
/// For WEBP, it can be a quality from 1 to 100 (the higher is the better). By default (without any parameter) and for quality above 100 the lossless compression is used.
pub const IMWRITE_WEBP_QUALITY: i32 = 64;
/// Imread flags
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum ImreadModes {
	/// If set, return the loaded image as is (with alpha channel, otherwise it gets cropped).
	IMREAD_UNCHANGED = -1,
	/// If set, always convert image to the single channel grayscale image.
	IMREAD_GRAYSCALE = 0,
	/// If set, always convert image to the 3 channel BGR color image.
	IMREAD_COLOR = 1,
	/// If set, return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it to 8-bit.
	IMREAD_ANYDEPTH = 2,
	/// If set, the image is read in any possible color format.
	IMREAD_ANYCOLOR = 4,
	/// If set, use the gdal driver for loading the image.
	IMREAD_LOAD_GDAL = 8,
	/// If set, always convert image to the single channel grayscale image and the image size reduced 1/2.
	IMREAD_REDUCED_GRAYSCALE_2 = 16,
	/// If set, always convert image to the 3 channel BGR color image and the image size reduced 1/2.
	IMREAD_REDUCED_COLOR_2 = 17,
	/// If set, always convert image to the single channel grayscale image and the image size reduced 1/4.
	IMREAD_REDUCED_GRAYSCALE_4 = 32,
	/// If set, always convert image to the 3 channel BGR color image and the image size reduced 1/4.
	IMREAD_REDUCED_COLOR_4 = 33,
	/// If set, always convert image to the single channel grayscale image and the image size reduced 1/8.
	IMREAD_REDUCED_GRAYSCALE_8 = 64,
	/// If set, always convert image to the 3 channel BGR color image and the image size reduced 1/8.
	IMREAD_REDUCED_COLOR_8 = 65,
	/// If set, do not rotate the image according to EXIF's orientation flag.
	IMREAD_IGNORE_ORIENTATION = 128,
}

opencv_type_enum! { crate::imgcodecs::ImreadModes }

/// Imwrite flags
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum ImwriteFlags {
	/// For JPEG, it can be a quality from 0 to 100 (the higher is the better). Default value is 95.
	IMWRITE_JPEG_QUALITY


ء، والملخص.",
    "Start date" : "تاريخ البدء",
    "Sort by start date, priority and summary." : "الترتيب بحسب تاريخ البدء، و الأولوية، والملخص.",
    "Due date" : "تاريخ الاكتمال",
    "Sort by due date, priority and summary." : "الترتيب بحسب تاريخ الاكتمال، و الأولوية، والملخص.",
    "Created date" : "تاريخ الإنشاء",
    "Sort by created date, priority and summary." : "الترتيب بحسب تاريخ الإنشاء، و الأولوية، والملخص.",
    "Last modified" : "آخر تعديل",
    "Sort by last-modified date, priority and summary." : "الترتيب بحسب آخر تعديل، و الأولوية، والملخص.",
    "Completed date" : "تاريخ الإكتمال",
    "Sort by completed date, priority and summary." : "الترتيب بحسب تاريخ الاكتمال، و الأولوية، و الملخص.",
    "Priority" : "الأولوية",
    "Sort by priority and summary." : "الترتيب بحسب الأولوية و الملخص.",
    "Alphabetically" : "أبجديا",
    "Sort by summary and priority." : "الترتيب بحسب الملخص و الأولوية.",
    "Tags" : "وُسُوم",
    "Sort by tags." : "الترتيب بحسب الوسوم.",
    "Manually" : "يدويّاً",
    "Sort by manual order." : "الترتيب بحسب الفرز اليدوي.",
    "Change sort order" : "غيّر ترتيب الفرز",
    "[Yesterday]" : "[امس]",
    "[Today]" : "[اليوم]",
    "[Tomorrow]" : "[الغد]",
    "[Completed yesterday]" : "[إكتملت بالأمس]",
    "[Completed today]" : "[إكتملت اليوم]",
    "[Completed tomorrow]" : "[تكتمل غداً]",
    "[Yesterday at] LT" : "[أمس عند] LT",
    "[Today at] LT" : "[اليوم عند]  LT",
    "[Tomorrow at] LT" : "[غداً عند]  LT",
    "L [at] LT" : "L [عند] LT",
    "[Completed yesterday at] LT" : "[إكتملت أمس عند] LT",
    "[Completed today at] LT" : "[إكتملت اليوم عند] LT",
    "[Completed tomorrow at] LT" : "[تكتمل غداً عند] LT",
    "[Completed] L [at] LT" : "[مُكتملة] L [عند] LT",
    "Add a subtask to \"{task}\"…" : "أضف مهمة فرعية إلى \"{task}\"…",
    "Task has hidden subtasks" : "مهمة بها مهام فرعية مخفية",
    "Task is pinned" : "المهمة مُثبّتة pinned",
    "Task has a note" : "المهمة بها ملاحظة",
    "{complete} % completed" : "{complete} % مكتمل",


" fill="var(--color-text)"></path></g><g id="icon-262144"><rect fill="var(--color-icon-background)" stroke="#FF4D4D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M8.85 16L11.13 7.24H12.582L14.85 16H13.758L13.182 13.672H10.53L9.954 16H8.85ZM10.746 12.76H12.954L12.282 10.06C12.154 9.548 12.054 9.12 11.982 8.776C11.91 8.432 11.866 8.208 11.85 8.104C11.834 8.208 11.79 8.432 11.718 8.776C11.646 9.12 11.546 9.544 11.418 10.048L10.746 12.76Z" fill="var(--color-text)"></path></g><g id="icon-524288"><rect fill="var(--color-icon-background)" stroke="#FF4D4D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M8.85 16L11.13 7.24H12.582L14.85 16H13.758L13.182 13.672H10.53L9.954 16H8.85ZM10.746 12.76H12.954L12.282 10.06C12.154 9.548 12.054 9.12 11.982 8.776C11.91 8.432 11.866 8.208 11.85 8.104C11.834 8.208 11.79 8.432 11.718 8.776C11.646 9.12 11.546 9.544 11.418 10.048L10.746 12.76Z" fill="var(--color-text)"></path></g><g id="icon-1048576"><rect fill="var(--color-icon-background)" stroke="#FF4D4D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M8.85 16L11.13 7.24H12.582L14.85 16H13.758L13.182 13.672H10.53L9.954 16H8.85ZM10.746 12.76H12.954L12.282 10.06C12.154 9.548 12.054 9.12 11.982 8.776C11.91 8.432 11.866 8.208 11.85 8.104C11.834 8.208 11.79 8.432 11.718 8.776C11.646 9.12 11.546 9.544 11.418 10.048L10.746 12.76Z" fill="var(--color-text)"></path></g><g id="icon-2097152"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)"></path></g><g id="icon-4194304"><rect fill="var(--color-icon-background)" stroke="#FF4D82" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M10.354 17V8.24H13.066C13.586 8.24 14.042 8.348 14.434 8.564C14.826 8.772 15.13 9.064 15.346 9.44C15.562 9.816 15.67 10.256 15.67 10.76C15.67 11.352 15.514 11.86 15.202 12.284C14.898 12.708 14.482 13 13.954 13.16L15.79 17H14.518L12.838 13


: ImmutableStandardDelta): SerializedDelta {
    return JSON.stringify(
      delta.ops.map((op) => {
        const keys = Object.keys(op);
        return keys.length === 1 && keys[0] === 'insert' ? op['insert'] : op;
      }),
    ) as SerializedDelta;
  }

  static deserializeDelta(
    serialized: SerializedDelta,
    ignoreNotDefined = false,
  ): StandardDelta {
    let ops;
    try {
      ops = JSON.parse(serialized || null);
      if (ops === null || ops === undefined) {
        if (!ignoreNotDefined) {
          console.error('Ops is not defined.');
        }
        return { ops: [] };
      }
    } catch (e) {
      console.error(e);
      return { ops: [] };
    }
    return {
      ops: ops.map((elem) => {
        if (elem.insert === undefined) {
          return { insert: elem };
        } else {
          return elem;
        }
      }),
    };
  }

  static getTextFromDelta(delta: ImmutableStandardDelta): string {
    return delta.ops.reduce((acc, e) => {
      return acc + (typeof e.insert === 'string' ? e.insert : '');
    }, '');
  }

  static getMarkdownFromDelta(delta: ImmutableStandardDelta): MarkdownDelta {
    const t = new QuillMarkdownCreator();
    let counter = 0;
    for (let i = 0; i < delta.ops.length - 1; i++, counter++) {
      counter += t.insertNextElement(delta.ops[i], counter, false);
    }
    const i = delta.ops.length - 1;
    t.insertNextElement(delta.ops[i], counter, true);
    return t.getMarkdown() as MarkdownDelta;
  }

  static getDeltaFromMarkdown(markdown: MarkdownDelta): StandardDelta {
    const parser = new QuillMarkdownParser();
    markdown.split('\n').forEach((line) => parser.insertLine(line));
    return parser.getQuillDelta();
  }

  static getContentCount(delta: ImmutableStandardDelta): number {
    return delta.ops.reduce((acc, op) => {
      return (
        acc +
        (typeof op.insert === 'string' && op.insert.trim().length < 1 ? 0 : 1)
      );
    }, 0);
  }

  static getVideoUrl(url): [string, URLType] {
    let match =
      url.match(
        /^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/,
      ) ||
      url.match(
        /^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/,
      ) ||
      url.match(/^.*(youtu.be\/|v\/|e\/|u\/\w+\/|embed\/|v=)([^#&?]*).*/) ||
      url.match(
        /^(?:(https?):\/\/)?www\.youtube-nocookie\.com\/embed\/([a-zA-Z0-9_-]+)/,
      );
    if (match && match[2].length === 11) {
      return [
        'https://www.youtube-nocookie.com/embed/' + match[2],
        URLType.YOUTUBE,
      ];
    }
    match = url.match(
      /^(?:(https?):\/\/)?(?:(?:www|player)\.)?vimeo\.com\/(\d+)/,
    );
    if (match) {
      return [
        (match[1] || 'https') + '://player.vimeo.com/video/' + match[2] + '/',
        URLType.VIMEO,
      ];
    }
    return [url, URLType.NORMAL];
  }

  static transformURLtoQuillLink(
    data: StandardDelta,
    transformToVideo: b


, format.myRegexLogParser?.uuid)
  }

  fun testShouldDetectLogcatFormat() {
    val document = configureLogFileDocument(
      "01-01 10:00:01.123  1234  5678 D MyAppTag: Starting app\n" +
        "01-01 10:00:02.456  1234  5678 I MyAppTag: Initializing user interface\n" +
        "01-01 10:00:03.789  1234  5678 W MyAppTag: Network connection is slow\n" +
        "01-01 10:00:04.012  1234  5678 E MyAppTag: Failed to load user data\n" +
        "01-01 10:00:05.345  1234  5678 I MyAppTag: App ready"
    )
    val format = document.ideologContext.detectLogFileFormat()
    assertEquals(DefaultSettingsStoreItems.Logcat.uuid, format.myRegexLogParser?.uuid)
  }

  fun testShouldDetectLoguruFormat() {
    val document = configureLogFileDocument(
      "2023-07-08 16:30:13.780 | SUCCESS | __main__:login:64 - \n" +
        "    User authentication successful\n" +
        "    Session token generated\n" +
        "2023-07-08 16:30:14.137 | INFO    | __main__:change_steps:103 - \n" +
        "    Steps updated to new value\n" +
        "    Previous: 1000, New: 1200\n" +
        "2023-07-08 16:30:15.488 | INFO    | __main__:update_user_data:80 - \n" +
        "    User data synchronization started\n" +
        "    Fetching data from remote server\n" +
        "2023-07-08 16:52:43.963 | INFO    | __main__:login:62 - \n" +
        "    Login process initiated by user\n" +
        "2023-07-08 16:52:43.964 | ERROR   | __main__:login:63 - \n" +
        "    Error encountered during login:\n" +
        "    List index out of range - index 5 of a 4-item list\n" +
        "2023-07-08 16:52:43.967 | WARNING | __main__:module:142 - \n" +
        "    Unexpected data format received\n" +
        "    Expected JSON, received XML\n" +
        "2023-07-08 16:52:44.439 | INFO    | __main__:sbs_api_info:121 - \n" +
        "    API information retrieved successfully\n" +
        "    Endpoint: /api/v1/info\n"
    )
    val format = document.ideologContext.detectLogFileFormat()
    assertEquals(DefaultSettingsStoreItems.Loguru.uuid, format.myRegexLogParser?.uuid)
  }

  fun testRemoveFormatWithoutRestarting() {
    val document = configureLogFileDocument(
      "[03:48:03] :    [VCS Root details] \"IntelliJ (241.12345)\" {instance id=12345, parent internal id=123456, parent id=parentid, description: \"ssh://git@address/git#refs/heads/241.12345\"}"
    )
    val format = document.ideologContext.detectLogFileFormat()
    assertEquals(DefaultSettingsStoreItems.TeamCityBuildLog.uuid, format.myRegexLogParser?.uuid)
    LogHighlightingSettingsStore.getInstance().myState.parsingPatterns.clear()
    val unknownFormat = document.ideologContext.detectLogFileFormat()
    assertNull(unknownFormat.myRegexLogParser)
  }

  fun testDisableFormatWithoutRestarting() {
    val document = configureLogFileDocument(
      "[03:48:03] :    [VCS Root details] \"IntelliJ (241.12345)\" {instance id=12345, parent internal id=123456, parent id=parentid, description: \"ssh://git@address/git#refs/heads/241.12345\"}"
    )
    val format = document.ideologContext.detectLogFileFormat()
    assertEquals(DefaultSettingsStoreItems.TeamCityBuildLog.


2h_won, h2h_draw, h2h_lost FROM player_h2h\n" +
		"WHERE player_id = :playerId";

	private static final String PLAYER_RIVALRIES_QUERY = //language=SQL
		"WITH rivalries AS (\n" +
		"  SELECT winner_id player_id, loser_id opponent_id, count(match_id) matches, 0 won, 0 lost\n" +
		"  FROM match_for_rivalry_v m INNER JOIN player_v p ON p.player_id = m.loser_id%1$s\n" +
		"  WHERE winner_id = :playerId%2$s\n" +
		"  GROUP BY winner_id, loser_id\n" +
		"  UNION ALL\n" +
		"  SELECT loser_id, winner_id, count(match_id), 0, 0\n" +
		"  FROM match_for_rivalry_v m INNER JOIN player_v p ON p.player_id = m.winner_id%1$s\n" +
		"  WHERE loser_id = :playerId%2$s\n" +
		"  GROUP BY loser_id, winner_id\n" +
		"  UNION ALL\n" +
		"  SELECT winner_id, loser_id, 0, count(match_id), 0\n" +
		"  FROM match_for_stats_v m INNER JOIN player_v p ON p.player_id = m.loser_id%1$s\n" +
		"  WHERE winner_id = :playerId%2$s\n" +
		"  GROUP BY winner_id, loser_id\n" +
		"  UNION ALL\n" +
		"  SELECT loser_id, winner_id, 0, 0, count(match_id)\n" +
		"  FROM match_for_stats_v m INNER JOIN player_v p ON p.player_id = m.winner_id%1$s\n" +
		"  WHERE loser_id = :playerId%2$s\n" +
		"  GROUP BY loser_id, winner_id\n" +
		"), rivalries_2 AS (\n" +
		"  SELECT player_id, opponent_id, sum(matches) matches, sum(won) won, sum(lost) lost\n" +
		"  FROM rivalries\n" +
		"  GROUP BY player_id, opponent_id\n" +
		"  ORDER BY matches DESC, won DESC\n" +
		")\n" +
		"SELECT r.player_id, r.opponent_id, o.name, o.country_id, o.active, o.best_rank, r.matches, r.won, r.lost,\n" +
		"%3$s\n" +
		"FROM rivalries_2 r\n" +
		"INNER JOIN player_v o ON o.player_id = r.opponent_id%4$s%5$s\n" +
		"ORDER BY %6$s OFFSET :offset";

	private static final String HEADS_TO_HEADS_QUERY = //language=SQL
		"WITH rivalries AS (\n" +
		"  SELECT winner_id, loser_id, count(match_id) matches, 0 won\n" +
		"  FROM match_for_rivalry_v m%1$s\n" +
		"  WHERE winner_id IN (:playerIds) AND loser_id IN (:playerIds)%2$s\n" +
		"  GROUP BY winner_id, loser_id\n" +
		"  UNION ALL\n" +
		"  SELECT winner_id, loser_id, 0, count(match_id)\n" +
		"  FROM match_for_stats_v m%1$s\n" +
		"  WHERE winner_id IN (:playerIds) AND loser_id IN (:playerIds)%2$s\n" +
		"  GROUP BY winner_id, loser_id\n" +
		"), rivalries_2 AS (\n" +
		"  SELECT winner_


envelope);
            }

            _endpointFactory = () => new KafkaProducerEndpoint(
                topicNameFormatString,
                envelope => topicNameArgumentsFunction.Invoke((IOutboundEnvelope<TMessage>)envelope),
                wrappedPartitionFunction,
                _clientConfig);

            return this;
        }

        /// <inheritdoc cref="IKafkaProducerEndpointBuilder.UseEndpointNameResolver{TResolver}" />
        public IKafkaProducerEndpointBuilder UseEndpointNameResolver<TResolver>()
            where TResolver : IKafkaProducerEndpointNameResolver
        {
            _endpointFactory = () => new KafkaProducerEndpoint(typeof(TResolver), _clientConfig);

            return this;
        }

        /// <inheritdoc cref="IKafkaProducerEndpointBuilder.WithKafkaKey{TMessage}" />
        public IKafkaProducerEndpointBuilder WithKafkaKey<TMessage>(
            Func<IOutboundEnvelope<TMessage>, object?> valueProvider)
            where TMessage : class
        {
            _kafkaKeyEnricher = new OutboundMessageKafkaKeyEnricher<T


 secret: BN256Scalar): BdnSignature {
    return BLS.sign(msg, secret);
}

/**
 * Verify the given signature against the message using the mask
 * to aggregate the public keys
 *
 * @param msg   The message
 * @param mask  The mask with the public keys
 * @param sig   The signature as bytes
 * @return true if the signature matches, false otherwise
 */
export function verify(msg: Buffer, mask: Mask, sig: Buffer): boolean {
    const pub = aggregatePublicKeys(mask) as BN256G2Point;

    return BLS.verify(msg, pub, sig);
}
import { IsArray, IsBoolean, IsEnum, IsPositive, Length } from 'class-validator'

export class ProductFilter {
    @Length(1, 100)
    public query?: string
    @IsArray()
    @IsPositive({ each: true })
    public categories?: number[]
    @IsArray()
    @IsPositive({ each: true })
    public shares?: number[]
    @IsPositive()
    public labelCategoryId?: number
    @IsPositive()
    public priceMin?: number
    @IsPositive()
    public priceMax?: number
    @IsEnum({ asc: 'asc', desc: 'desc' })
    public order?: string
    @IsEnum({ top: 'top', price: 'price', name: 'name' })
    public sort?: string
    /**
     * Show only products that are in stock
     */
    @IsBoolean()
    public inStock: boolean
    @IsArray()
    public storeIds?: number[]
    @Length(3, 50)
    public tradeMark?: string
    @Length(3, 50)
    public tradeName?: string
    @Length(3, 50)
    public manufacturer?: string
    @Length(3, 50)
    public activeSubstance?: string

    constructor(query: any) {
        if (query.query) {
            this.query = query.query
        }
        this.order = query.order
        this.sort = query.sort
        if (query.categories) {
            this.categories = query.categories.split(',').map(Number)
        }
        if (query.shares) {
            this.shares = query.shares.split(',').map(Number)
        }
        if (query.labelCategoryId) {
            this.labelCategoryId = parseInt(query.labelCategoryId, 10)
        }
        if (query.priceMin) {
            this.priceMin = parseInt(query.priceMin, 10)
            if (this.priceMin <= 0) {
                this.priceMin = 1
            }
        }
        if (query.priceMax) {
            this.priceMax = parseInt(query.priceMax, 10)
            if (this.priceMax <= 0) {
                this.priceMax = 1
            }
        }
        if (query.labelCategoryId) {
            this.labelCategoryId = parseInt(query.labelCategoryId, 10)
        }
        if (query.storeId) {
            this.storeIds = (Array.isArray(query.storeId) ? query.storeId : [query.storeId]).map(Number)
        }
        this.tradeMark = query.tradeMark
        this.tradeName = query.tradeName
        this.manufacturer = query.manufacturer
        this.inStock = query.inStock === 'true'
        this.activeSubstance = query.activeSubstance
    }
}
/* eslint-disable @typescript-eslint/no-explicit-any */

interface QueryParamsRetrieve {
	include?: string[]
	fields?: { [key: string]: string[] }
	// fields?: string[] | { [key: string]: string[] }
}

interface QueryParamsList extends QueryParamsRetrieve {
	sort?: string[] | { [key: string]: 'asc' | 'desc' }
	filters?: { [key: string]: string | number | boolean }
	pageNumber?: number
	pageSize?: number
}

type QueryParams = QueryParamsRetrieve | QueryParamsList

export { QueryParamsRetrieve, Query


end

function Waypoint:setRowEnd(rowEnd)
	self.attributes:setRowEnd(rowEnd)
end

function Waypoint:setRowStart(rowStart)
	self.attributes:setRowStart(rowStart)
end

function Waypoint:resetRowStartEnd()
	self.attributes:setRowStart(false)
	self.attributes:setRowEnd(false)
end

function Waypoint:setHeadlandNumber(n)
	self.attributes:setHeadlandPassNumber(n)
end

function Waypoint:setOnConnectingPath(onConnectingPath)
	self.attributes:setOnConnectingPath(onConnectingPath)
end

function Waypoint:copyRowData(other)
	self.attributes.rowNumber = other.attributes.rowNumber
	self.attributes.leftSideWorked = other.attributes.leftSideWorked
	self.attributes.rightSideWorked = other.attributes.rightSideWorked
end

-- a node related to a waypoint
---@class WaypointNode
WaypointNode = CpObject()
WaypointNode.MODE_NORMAL = 1
WaypointNode.MODE_LAST_WP = 2
WaypointNode.MODE_SWITCH_DIRECTION = 3
WaypointNode.MODE_SWITCH_TO_FORWARD = 4

function WaypointNode:init(name, logChanges)
	self.logChanges = logChanges
	self.node = CpUtil.createNode(name, 0, 0, 0)
end

function WaypointNode:destroy()
	CpUtil.destroyNode(self.node)
end

---@param course Course
function WaypointNode:setToWaypoint(course, ix, suppressLog)
	local newIx = math.min(ix, course:getNumberOfWaypoints())
	if newIx ~= self.ix and self.logChanges and not suppressLog then
		CpUtil.debugVehicle(CpDebug.DBG_PPC, course.vehicle, 'PPC: %s waypoint index %d', getName(self.node), ix)
	end
	self.ix = newIx
	local x, y, z = course:getWaypointPosition(self.ix)
	setTranslation(self.node, x, y, z)
	setRotation(self.node, 0, course:getWaypointYRotation(self.ix), 0)
end

-- Allow ix > #Waypoints, in that case move the node lookAheadDistance beyond the last WP
function WaypointNode:setToWaypointOrBeyond(course, ix, distance)
	--if self.ix and self.ix > ix then return end
	if ix > course:getNumberOfWaypoints() then
		-- beyond the last, so put it on the last for now
		-- but use the direction of the one before the last as the last one's is bogus
		self:setToWaypoint(course, course:getNumberOfWaypoints())
		setRotation(self.node, 0, course:getWaypointYRotation(course:getNumberOfWaypoints() - 1), 0)
		-- And now, move ahead a bit.
		local nx, ny, nz = localToWorld(self.node, 0, 0, distance)
		setTranslation(self.node, nx, ny, nz)
		if self.logChanges and self.mode and self.mode ~= WaypointNode.MODE_LAST_WP then
			CpUtil.debugVehicle(CpDebug.DBG_PPC, course.vehicle, 'PPC: last waypoint reached, moving node beyond last: %s', getName(self.node))
		end

		self.mode = WaypointNode.MODE_LAST_WP
	elseif course:switchingToReverseAt(ix) or course:switchingToForwardAt(ix) then
		-- just like at the last waypoint, if there's a direction switch, we want to drive up
		-- to the waypoint so we move the goal point beyond it
		-- the angle of ix is already pointing to reverse here
		self:setToWaypoint(course, ix)
		-- turn node back as this is the one before the first reverse, already pointing to the reverse direction.
		local _, yRot, _ = getRotation(self.node)
		setRotation(self.node, 0, y


"""
使用 dashscope SDK 测试所有服务
"""

import sys
import os
import asyncio
from pathlib import Path

# 添加项目根目录到Python路径
project_root = Path(__file__).parent
sys.path.insert(0, str(project_root))

from src.config.manager import config_manager
from src.config.logging import setup_logging
from src.services.dashscope_llm import DashScopeLLMService
from src.services.dashscope_image_gen import DashScopeImageGenService
from src.services.dashscope_tts import DashScopeTTSService
from src.services.dashscope_vlm import DashScopeVLMService
from src.services.base_llm import LLMMessage
from src.services.base_image_gen import ImageGenerationRequest
from src.services.base_tts import TTSRequest

async def test_llm_service():
    """测试LLM服务（兼容模式）"""
    print("🔍 测试LLM服务（兼容模式）...")

    try:
        config = config_manager.get_config()

        llm_service = DashScopeLLMService(
            api_key=config.dashscope.api_key,
            model="qwen-plus",
            use_compatibility_mode=True
        )

        messages = [LLMMessage(role="user", content="你好，请简单问候一下")]

        response = await llm_service.generate(
            messages=messages,
            temperature=0.7,
            max_tokens=50
        )

        print("✅ LLM服务正常")
        print(f"响应: {response.content[:100]}...")
        return True

    except Exception as e:
        print(f"❌ LLM服务失败: {e}")
        return False

async def test_image_generation():
    """测试图像生成服务（SDK方式）"""
    print("\n🔍 测试图像生成服务（dashscope SDK）...")

    try:
        config = config_manager.get_config()

        image_service = DashScopeImageGenService(
            api_key=config.dashscope.api_key
        )

        request = ImageGenerationRequest(
            prompt="一只可爱的小猫",
            width=512,
            height=512
        )

        response = await image_service.generate_image(request)
        print("✅ 图像生成服务正常")
        print(f"图像尺寸: {response.image.size}")
        return True

    except Exception as e:
        error_msg = str(e)
        print(f"❌ 图像生成服务失败: {e}")
        return False

async def test_tts_service():
    """测试TTS服务（SDK方式）"""
    print("\n🔍 测试TTS服务（dashscope SDK）...")

    try:
        config = config_manager.get_config()

        tts_service = DashScopeTTSService(
            api_key=config.dashscope.api_key
        )

        request = TTSRequest(
            text="你好，小朋友",
            speed=1.0,
            pitch=1.0,
            volume=0.8
        )

        response = await tts_service.synthesize(request)
        print("✅ TTS服务正常")
        print(f"音频格式: {response.format}, 大小: {len(response.audio_data)} bytes")
        return True

    except Exception as e:
        print(f"❌ TTS服务失败: {e}")
        return False

async def test_vlm_service():
    """测试VLM服务（SDK方式）"""
    print("\n🔍 测试VLM服务（dashscope SDK）...")

    try:
        config = config_manager.get_config()

        vlm_service = DashScopeVLMService(
            api_key=config.dashscope.api_key
        )

        # 创建一个简单的测试图像
        from PIL import Image
        import io

        # 创建一个简单的红色方块图像
        img = Image.new('RGB', (100, 100), color='red')
        img_bytes = io.BytesIO()
        img.save(img_bytes, format='PNG')
        img_bytes.seek(0)

        emotion = await vlm_service.analyze_emotion(img)
        print("✅ VLM服务正常")
        print(f"情绪分析结果: {emotion[:100]}...")
        return True

    except Exception as e:
        print(f"❌ VLM服务失败: {e}")
        return False

async def main():
    """主函数"""
    # 初始化日志
    setup_logging(log_level="INFO", debug=True)

    print("=" * 60)
    print("百炼平台 dashscope SDK 服务测试")
    print("=" * 60)

    # 验证配置
    if not config_manager.validate_config():
        print("❌ 配置验证失败")
        return

    config = config_manager.get_config()
    print(f"API密钥: {config.dashscope.api_key[:8]}...")

    results = []

    # 测试各个服务
    results.append(("LLM服务", await test_llm_service()))
    results.append(("图像生成", await test_image_generation()))
    results.append(("TTS合成", await test_tts_service()))
    results.append(("VLM分析", await test_vlm_service()))

    # 总结结果
    print("\n" + "=" * 60)
    print("dashscope SDK 服务测试结果")
    print("=" * 60)

    for service_name, success in results:
        status = "✅ 正常" if success else "❌ 异常"
        print(f"{service_name}: {status}")

    w


               rawBitmap.Pixels[o] = Color32.FromArgb(pixelRow[x].PackedValue);
                                o++;
                            }
                        }
                    });

                return rawBitmap;
            }
            finally {
                if (!ReferenceEquals(source32bpp, source))
                    source32bpp.Dispose();
            }
        }

        public static Image Convert(RawBitmap rawBitmap) {
            if (rawBitmap is RawBitmap32 rawBitmap32)
                return Convert(rawBitmap32);
            if (rawBitmap is RawBitmap8 rawBitmap8)
                return Convert(rawBitmap8);

            throw new ArgumentException();
        }

        public static Image Convert(RawBitmap32 rawBitmap) {
            var bitmap = new Image<Rgba32>(rawBitmap.Width, rawBitmap.Height);

            bitmap.ProcessPixelRows(
                accessor => {
                    int o = 0;

                    for (int y = 0; y < accessor.Height; y++) {
                        var pixelRow = accessor.GetRowSpan(y);

                        for (int x = 0; x < accessor.Width; x++) {
                            pixelRow[x].PackedValue = unchecked((uint)rawBitmap.Pixels[o].ARGB);
                            o++;
                        }
                    }
                });

            return bitmap;
        }
    }
}


/foo.bar".toUri().sameSchemeAndHostAs("https://foo.baz".toUri()))
        // Scheme mismatch.
        assertFalse("http://127.0.0.1".toUri().sameSchemeAndHostAs("https://127.0.0.1".toUri()))
        // Port mismatch.
        assertTrue("https://foo.bar:444".toUri().sameSchemeAndHostAs("https://foo.bar:555".toUri()))
        // Port OK but scheme different.
        assertFalse("https://foo.bar:443".toUri().sameSchemeAndHostAs("ftp://foo.bar:443".toUri()))

        assertTrue("https://foo.bar/bobo".toUri().sameSchemeAndHostAs("https://foo.bar:443/obob".toUri()))
        assertTrue("https://foo.bar:333".toUri().sameSchemeAndHostAs("https://foo.bar:443:333".toUri()))
    }

    @Test
    fun testSameOriginAs() {
        // Host mismatch.
        assertFalse("https://foo.bar".toUri().sameOriginAs("https://foo.baz".toUri()))
        // Scheme mismatch.
        assertFalse("http://127.0.0.1".toUri().sameOriginAs("https://127.0.0.1".toUri()))
        // Port mismatch.
        assertFalse("https://foo.bar:444".toUri().sameOriginAs("https://foo.bar:555".toUri()))
        // Port OK but scheme different.
        assertFalse("https://foo.bar:443".toUri().sameOriginAs("ftp://foo.bar:443".toUri()))

        assertTrue("https://foo.bar:443/bobo".toUri().sameOriginAs("https://foo.bar:443/obob".toUri()))
        assertTrue("https://foo.bar:333".toUri().sameOriginAs("https://foo.bar:333".toUri()))
    }

    @Test
    fun testGenerateFileName() {
        val fileExtension = "txt"
        var fileName = generateFileName(fileExtension)

        assertTrue(fileName.contains(fileExtension))

        fileName = generateFileName()

        assertFalse(fileName.contains("."))
    }

    @Test
    fun testGetFileExtension() {
        val resolver = mock<ContentResolver>()
        val uri = "content://media/external/file/37162".toUri()

        Shadows.shadowOf(MimeTypeMap.getSingleton()).addExtensionMimeTypeMapping("txt", "text/plain")

        doReturn("text/plain").`when`(resolver).getType(any())

        assertEquals("txt", uri.getFileExtension(resolver))
    }

    @Test
    fun `getFileNameForContentUris for urls with DISPLAY_NAME`() {
        val resolver = mock<ContentResolver>()
        val uri = "content://media/external/file/37162".toUri()
        val cursor = mock<Cursor>()

        Shadows.shadowOf(MimeTypeMap.getSingleton()).addExtensionMimeTypeMapping("txt", "text/plain")
        doReturn("text/plain").`when`(resolver).getType(any())

        doReturn(cursor).`when`(resolver).query(any(), any(), any(), any(), any())
        doReturn(1).`when`(cursor).getColumnIndex(any())
        doReturn("myFile.txt").`when`(cursor).getString(anyInt())

        assertEquals("myFile.txt", uri.getFileNameForContentUris(resolver))
    }

    @Test
    fun `getFileNameForContentUris for urls without DISPLAY_NAME`() {
        val resolver = mock<ContentResolver>()
        val uri = "content://media/external/file/37162".toUri()
        val cursor = mock<Cursor>()

        Shadows.shadowOf(MimeTypeMap.getSingleton()).addExtensionMimeTypeMapping("txt", "text/plain")
        doReturn("text/plain").`when`(resolver).getType(any())

        doReturn(cursor).`when`(resolver).query(any(), any(), any(), any(), any())
        doReturn(-1


p0.h, p0/z, z0.h, z0.d
cmplt	p0.s, p0/z, z0.s, #-16
cmplt	p0.s, p0/z, z0.s, #15
cmplt	p0.s, p0/z, z0.s, z0.d
cmpne	p0.b, p0/z, z0.b, #-16
cmpne	p0.b, p0/z, z0.b, #15
cmpne	p0.b, p0/z, z0.b, z0.b
cmpne	p0.b, p0/z, z0.b, z0.d
cmpne	p0.d, p0/z, z0.d, #-16
cmpne	p0.d, p0/z, z0.d, #15
cmpne	p0.d, p0/z, z0.d, z0.d
cmpne	p0.h, p0/z, z0.h, #-16
cmpne	p0.h, p0/z, z0.h, #15
cmpne	p0.h, p0/z, z0.h, z0.d
cmpne	p0.h, p0/z, z0.h, z0.h
cmpne	p0.s, p0/z, z0.s, #-16
cmpne	p0.s, p0/z, z0.s, #15
cmpne	p0.s, p0/z, z0.s, z0.d
cmpne	p0.s, p0/z, z0.s, z0.s
cnot	z31.b, p7/m, z31.b
cnot	z31.d, p7/m, z31.d
cnot	z31.h, p7/m, z31.h
cnot	z31.s, p7/m, z31.s
cnt	z31.b, p7/m, z31.b
cnt	z31.d, p7/m, z31.d
cnt	z31.h, p7/m, z31.h
cnt	z31.s, p7/m, z31.s
cntb	x0
cntb	x0, #28
cntb	x0, all, mul #16
cntb	x0, pow2
cntd	x0
cntd	x0, #28
cntd	x0, all, mul #16
cntd	x0, pow2
cnth	x0
cnth	x0, #28
cnth	x0, all, mul #16
cnth	x0, pow2
cntp	x0, p15, p0.b
cntp	x0, p15, p0.d
cntp	x0, p15, p0.h
cntp	x0, p15, p0.s
cntw	x0
cntw	x0, #28
cntw	x0, all, mul #16
cntw	x0, pow2
compact	z31.d, p7, z31.d
compact	z31.s, p7, z31.s
ctermeq	w30, wzr
ctermeq	wzr, w30
ctermeq	x30, xzr
ctermeq	xzr, x30
ctermne	w30, wzr
ctermne	wzr, w30
ctermne	x30, xzr
ctermne	xzr, x30
decb	x0
decb	x0, #14
decb	x0, all, mul #16
decb	x0, pow2
decb	x0, vl1
decd	x0
decd	x0, #14
decd	x0, all, mul #16
decd	x0,


compute.v1.Compute
        .internal_static_google_cloud_compute_v1_SetNamedPortsInstanceGroupRequest_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.compute.v1.SetNamedPortsInstanceGroupRequest.class,
            com.google.cloud.compute.v1.SetNamedPortsInstanceGroupRequest.Builder.class);
  }

  private int bitField0_;
  public static final int INSTANCE_GROUP_FIELD_NUMBER = 81095253;

  @SuppressWarnings("serial")
  private volatile java.lang.Object instanceGroup_ = "";

  /**
   *
   *
   *

   * The name of the instance group where the named ports are updated.
   *

   *
   * string instance_group = 81095253 [(.google.api.field_behavior) = REQUIRED];
   *
   * @return The instanceGroup.
   */
  @java.lang.Override
  public java.lang.String getInstanceGroup() {
    java.lang.Object ref = instanceGroup_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      instanceGroup_ = s;
      return s;
    }
  }

  /**
   *
   *
   *

   * The name of the instance group where the named ports are updated.
   *

   *
   * string instance_group = 81095253 [(.google.api.field_behavior) = REQUIRED];
   *
   * @return The bytes for instanceGroup.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getInstanceGroupBytes() {
    java.lang.Object ref = instanceGroup_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      instanceGroup_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int INSTANCE_GROUPS_SET_NAMED_PORTS_REQUEST_RESOURCE_FIELD_NUMBER = 385151535;
  private com.google.cloud.compute.v1.InstanceGroupsSetNamedPortsRequest
      instanceGroupsSetNamedPortsRequestResource_;

  /**
   *
   *
   *

   * The body resource for this request
   *

   *
   *
   * .google.cloud.compute.v1.InstanceGroupsSetNamedPortsRequest instance_groups_set_named_ports_request_resource = 385151535 [(.google.api.field_behavior) = REQUIRED];
   *
   *
   * @return Whether the instanceGroupsSetNamedPortsRequestResource field is set.
   */
  @java.lang.Override
  public boolean hasInstanceGroupsSetNamedPortsRequestResource() {
    return ((bitField0_ & 0x00000001) != 0);
  }

  /**
   *
   *
   *

   * The body resource for this request
   *

   *
   *
   * .google.cloud.compute.v1.InstanceGroupsSetNamedPortsRequest instance_groups_set_named_ports_request_resource = 385151535 [(.google.api.field_behavior) = REQUIRED];
   *
   *
   * @return The instanceGroupsSetNamedPortsRequestResource.
   */
  @java.lang.Override
  public com.google.cloud.compute.v1.InstanceGroupsSetNamedPortsRequest
      getInstanceGroupsSetNamedPortsRequestResource() {
    return instanceGroupsSetNamedPortsRequestResource_ == null
        ? com.google.cloud.compute.v1.InstanceGroupsSetNamedPortsRequest.getDefaultInstance()
        : instanceGroupsSetNamedP


0 [d-float]
   65103:	00          	halt
   65104:	00          	halt
   65105:	00          	halt
   65106:	00          	halt
   65107:	00          	halt
   65108:	fc          	xfc
   65109:	ff ff       	.word 0xffff
   6510b:	ff 72       	.word 0xff72
   6510d:	00          	halt
   6510e:	00          	halt
   6510f:	00          	halt
   65110:	71 00 00    	cmpd $0x0 [d-float],$0x0 [d-float]
   65113:	00          	halt
   65114:	00          	halt
   65115:	00          	halt
   65116:	00          	halt
   65117:	00          	halt
   65118:	f8 ff ff ff 	ashp *78511d <_end+0x7156f5>,$0x0,$0x0,-(r1),$0x0,$0x0
   6511c:	71 00 00 00
   65120:	71 00 00
   65123:	00          	halt
   65124:	71 00 00    	cmpd $0x0 [d-float],$0x0 [d-float]
   65127:	00          	halt
   65128:	08 00 00 00 	cvtps $0x0,$0x0,$0x0,-(r2)
   6512c:	72
   6512d:	00          	halt
   6512e:	00          	halt
   6512f:	00          	halt
   65130:	6e 00 00    	cvtld $0x0,$0x0 [d-float]
	...
   6513b:	00          	halt
   6513c:	71 00 00    	cmpd $0x0 [d-float],$0x0 [d-float]
   6513f:	00          	halt
   65140:	71 00 00    	cmpd $0x0 [d-float],$0x0 [d-float]
   65143:	00          	halt
   65144:	71 00 00    	cmpd $0x0 [d-float],$0x0 [d-float]
   65147:	00          	halt
   65148:	04          	ret
   65149:	00          	halt
   6514a:	00          	halt
   6514b:	00          	halt
   6514c:	72 00 00    	mnegd $0x0 [d-float],$0x0 [d-float]
   6514f:	00          	halt
   65150:	71 00 00    	cmpd $0x0 [d-float],$0x0 [d-float]
   65153:	00          	halt
   65154:	2c 00 00 00 	movc5 $0x0,$0x0,$0x0,$0x10,$0x0
   65158:	10 00
   6515a:	00          	halt
   6515b:	00          	halt
   6515c:	6e 00 00    	cvtld $0x0,$0x0 [d-float]
   6515f:	00          	halt
   65160:	72 00 00    	mnegd $0x0 [d-float],$0x0 [d-float]
   65163:	00          	halt
   65164:	2c 00 00 00 	movc5 $0x0,$0x0,$0x0,*0x72ffffff(ap),$0x0
   65168:	fc ff ff ff
   6516c:	72 00
   6516e:	00          	halt
   6516f:	00          	halt
   65170:	71 00 00    	cmpd $0x0 [d-float],$0x0 [d-float]
   65173:	00          	halt
   65174:	2c 00 00 00 	movc5 $0x0,$0x0,$0x0,*0x71ffffff(r8),$0x0
   65178:	f8 ff ff ff


}:${c.lineI + 1}`));
        toAssign.push(c);
      } else {
        ids.add(c.id);
      }
    } else {
      toAssign.push(c);
    }
  }

  let changedCount = 0;
  let nextID = 1;

  for (const c of toAssign) {
    while (ids.has(nextID)) {
      nextID++;
    }
    const id = nextID++;
    c.id = id;
  }

  // If we have hit count information, then we calculate all lines based on hit information
  if (fs.existsSync(hitInfoFilename)) {
    const coverageHits: CoverageHitInfos = JSON.parse(fs.readFileSync(hitInfoFilename, 'utf8'));
    for (const c of coveragePoints) {
      const hitInfo = coverageHits[c.id];
      if (hitInfo) {
        if (removeUntestedFlags && c.type === 'untested') c.type = 'normal';
        if (hitInfo.tableSize !== undefined && hitInfo.hitCountByTableEntry !== undefined) {
          c.comment = `// Hit ${Object.keys(hitInfo.hitCountByTableEntry).length}/${hitInfo.tableSize}`;
        } else {
          c.comment = '// Hit';
        }
      } else {
        c.comment = '// Not hit';
      }
      const s = reconstructCoverageLine(c, false);
      const lineContent = `${c.indent}${s}`;
      if (lines[c.lineI] !== lineContent) {
        lines[c.lineI] = lineContent;
        log(`  ${microviumCFilename}:${c.lineI + 1} ${s}`);
        changedCount++;
      }
    }
  } else {
    for (const c of toAssign) {
      const s = reconstructCoverageLine(c, false);
      lines[c.lineI] = `${c.indent}${s}`;
      log(`✓ ` + colors.green(`${microviumCFilename}:${c.lineI + 1} `) + s);
      changedCount++;
    }
  }

  if (!changedCount) {
    log(colors.cyan(`✓ All ${coveragePoints.length} coverage markers are up to date`));
  } else {
    writeTextFile(microviumCFilename, lines.join(os.EOL));
  }
}import axios from 'axios';
import {todoUrl} from '../urls';

const userId:string = '1';
const boardId:string = '1';

export const fetchTodos = () =>{
    const getTodoUrl:string = todoUrl(userId, boardId);

    return axios.get(getTodoUrl)
    .then((res)=>{
        return res.data
    })
    .catch((e) => console.error)
};

export const postTodo = (boardId:string, todoTitle:string, todoMemo:string, todoActive:boolean, todoPos:number) =>{
    const postTodoUrl = todoUrl(userId, boardId);

    return axios.post(postTodoUrl,{
        user_id: userId,
        board_id: boardId,
        title: todoTitle,
        memo: todoMemo,
        active: todoActive,
        position: todoPos,
    })
    .then(res =>{
        console.log('success');
        return res.data
    })
    .catch((e)=> console.error(e))
}import { User } from '../src/types/types'
import performPurchase from '../src/ex1'

// a. Faça um teste com um usuário com o saldo maior do que o valor de compra

describe('Testing if balance is greater than purchase',()=>{
    test('should return user if the balance is greater than the purchase amount',()=>{
        const user: User = {
            name: "Fayra",
            balance: 1000
        }

        const output = performPurchase(user ,200)

        expect(output).toEqual({
            name: "Fayra",
            balance: 800
        })
    })
})

// b. Faça um teste com


 static SSHContentType parse(String value) {
    return _ContentType.parse(value);
  }

  /// Gets the MIME type and subtype, without any parameters.
  ///
  /// For the full content type `text/html;charset=utf-8`,
  /// the [mimeType] value is the string `text/html`.
  String get mimeType;

  /// Gets the primary type.
  ///
  /// For the full content type `text/html;charset=utf-8`,
  /// the [primaryType] value is the string `text`.
  String get primaryType;

  /// Gets the subtype.
  ///
  /// For the full content type `text/html;charset=utf-8`,
  /// the [subType] value is the string `html`.
  /// May be the empty string.
  String get subType;

  /// Gets the character set, if any.
  ///
  /// For the full content type `text/html;charset=utf-8`,
  /// the [charset] value is the string `utf-8`.
  String? get charset;
}

class _ContentType extends _HeaderValue implements SSHContentType {
  String _primaryType = "";
  String _subType = "";

  _ContentType(
    String primaryType,
    String subType,
    String? charset,
    Map<String, String?> parameters,
  )   : _primaryType = primaryType,
        _subType = subType,
        super("") {
    _value = "$_primaryType/$_subType";
    var parameterMap = _ensureParameters();
    parameters.forEach((String key, String? value) {
      String lowerCaseKey = key.toLowerCase();
      if (lowerCaseKey == "charset") {
        value = value?.toLowerCase();
      }
      parameterMap[lowerCaseKey] = value;
    });
    if (charset != null) {
      _ensureParameters()["charset"] = charset.toLowerCase();
    }
  }

  _ContentType._();

  static _ContentType parse(String value) {
    var result = _ContentType._();
    result._parse(value, ";", null, false);
    int index = result._value.indexOf("/");
    if (index == -1 || index == (result._value.length - 1)) {
      result._primaryType = result._value.trim().toLowerCase();
    } else {
      result._primaryType =
          result._value.substring(0, index).trim().toLowerCase();
      result._subType = result._value.substring(index + 1).trim().toLowerCase();
    }
    return result;
  }

  @override
  String get mimeType => '$primaryType/$subType';

  @override
  String get primaryType => _primaryType;

  @override
  String get subType => _subType;

  @override
  String? get charset => parameters["charset"];
}

class _HeaderValue {
  String _value;
  Map<String, String?>? _parameters;
  Map<String, String?>? _unmodifiableParameters;

  // ignore: unused_element
  _HeaderValue([this._value = "", Map<String, String?> parameters = const {}]) {
    if (parameters.isNotEmpty) {
      _parameters = HashMap<String, String?>.from(parameters);
    }
  }

  // ignore: unused_element
  static _HeaderValue parse(
    String value, {
    String parameterSeparator = ";",
    String? valueSeparator,
    bool preserveBackslash = false,
  }) {
    // Parse the string.
    var result = _HeaderValue();
    result._parse(value, parameterSeparator, valueSeparator, preserveBackslash);
    return result;
  }

  String get value => _value;

  Map<String, String?> _ensureParameters() =>
      _parameters ??= <String, String?>{};

  Map<String, String?> get parameters =>
      _unmodifiableParameters ??= UnmodifiableMapView(_ensureParameters());

  static bool _isToken(String token) {
    if (token.isEmpty) {
      return false;
    }
    final delimiters = "\"(),/:;<=>?@[]{}


5 27s32.4-12.1 32.4-27-14.6-27-32.5-27zM224 136V0h-63.6v32h-32V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zM95.9 32h32v32h-32zm32.3 384c-33.2 0-58-30.4-51.4-62.9L96.4 256v-32h32v-32h-32v-32h32v-32h-32V96h32V64h32v32h-32v32h32v32h-32v32h32v32h-32v32h22.1c5.7 0 10.7 4.1 11.8 9.7l17.3 87.7c6.4 32.4-18.4 62.6-51.4 62.6z"],"file-audio":[384,512,[],"f1c7","M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm-64 268c0 10.7-12.9 16-20.5 8.5L104 376H76c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h28l35.5-36.5c7.6-7.6 20.5-2.2 20.5 8.5v136zm33.2-47.6c9.1-9.3 9.1-24.1 0-33.4-22.1-22.8 12.2-56.2 34.4-33.5 27.2 27.9 27.2 72.4 0 100.4-21.8 22.3-56.9-10.4-34.4-33.5zm86-117.1c54.4 55.9 54.4 144.8 0 200.8-21.8 22.4-57-10.3-34.4-33.5 36.2-37.2 36.3-96.5 0-133.8-22.1-22.8 12.3-56.3 34.4-33.5zM384 121.9v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z"],"file-code":[384,512,[],"f1c9","M384 121.941V128H256V0h6.059c6.365 0 12.47 2.529 16.971 7.029l97.941 97.941A24.005 24.005 0 0 1 384 121.941zM248 160c-13.2 0-24-10.8-24-24V0H24C10.745 0 0 10.745 0 24v464c0 13.255 10.745 24 24 24h336c13.255 0 24-10.745 24-24V160H248zM123.206 400.505a5.4 5.4 0 0 1-7.633.246l-64.866-60.812a5.4 5.4 0 0 1 0-7.879l64.866-60.812a5.4 5.4 0 0 1 7.633.246l19.579 20.885a5.4 5.4 0 0 1-.372 7.747L101.65 336l40.763 35.874a5.4 5.4 0 0 1 .372 7.747l-19.579 20.884zm51.295 50.479l-27.453-7.97a5.402 5.402 0 0 1-3.681-6.692l61.44-211.626a5.402 5.402 0 0 1 6.692-3.681l27.452 7.97a5.4


detected)
            put(distance, u, n);
          else
            put(distance, u, 1);

          if (get(excess_flow, u) > 0)
            add_to_active_list(u, layers[1]);
          else if (get(distance, u) < n)
            add_to_inactive_list(u, layers[1]);
        }

      } // push_relabel constructor

      //=======================================================================
      // This is a breadth-first search over the residual graph
      // (well, actually the reverse of the residual graph).
      // Would be cool to have a graph view adaptor for hiding certain
      // edges, like the saturated (non-residual) edges in this case.
      // Goldberg's implementation abused "distance" for the coloring.
      void global_distance_update()
      {
        BOOST_USING_STD_MAX();
        ++update_count;
        vertex_iterator u_iter, u_end;
        for (boost::tie(u_iter,u_end) = vertices(g); u_iter != u_end; ++u_iter) {
          put(color, *u_iter, ColorTraits::white());
          put(distance, *u_iter, n);
        }
        put(color, sink, ColorTraits::gray());
        put(distance, sink, 0);

        for (distance_size_type l = 0; l <= max_distance; ++l) {
          layers[l].active_vertices.clear();
          layers[l].inactive_vertices.clear();
        }

        max_distance = max_active = 0;
        min_active = n;

        Q.push(sink);
        while (! Q.empty()) {
          vertex_descriptor u = Q.top();
          Q.pop();
          distance_size_type d_v = get(distance, u) + 1;

          out_edge_iterator ai, a_end;
          for (boost::tie(ai, a_end) = out_edges(u, g); ai != a_end; ++ai) {
            edge_descriptor a = *ai;
            vertex_descriptor v = target(a, g);
            if (get(color, v) == ColorTraits::white()
                && is_residual_edge(get(reverse_edge, a))) {
              put(distance, v, d_v);
              put(color, v, ColorTraits::gray());
              current[v] = out_edges(v, g);
              max_distance = max BOOST_PREVENT_MACRO_SUBSTITUTION(d_v, max_distance);

              if (get(excess_flow, v) > 0)
                add_to_active_list(v, layers[d_v]);
              else
                add_to_inactive_list(v, layers[d_v]);

              Q.push(v);
            }
          }
        }
      } // global_distance_update()

      //=======================================================================
      // This function is called "push" in Goldberg's h_prf implementation,
      // but it is called "discharge" in the paper and in hi_pr.c.
      void discharge(vertex_descriptor u)
      {
        BOOST_ASSERT(get(excess_flow, u) > 0);
        while (1) {
          out_edge_iterator ai, ai_end;
          for (boost::tie(ai, ai_end) = current[u]; ai != ai_end; ++ai) {
            edge_descriptor a = *ai;
            if (is_residual_edge(a)) {
              vertex_descriptor v = target(a, g);
              if (is_admissible(u, v)) {
                ++push_count;
                if (v != sink && get(excess_flow, v) == 0) {
                  remove_from_inactive_list(v);
                  add_to_active_list(v, layers[get(distance, v)]);
                }
                push_flow(a);
                if (get(excess_flow, u) == 0)
                  break;
              }
            }
          } // for out_edges of i starting from current

          Layer& layer = layers[get(distance, u)];
          distance_size_type du = get(distan


ATIONS.paging_sequence
    WHERE operations.id = op.id`,
	QueryForAllNotLastOperationsPerResource: `
	SELECT op.id
	FROM OPERATIONS op
	LEFT JOIN (
		SELECT MAX(OPERATIONS.PAGING_SEQUENCE) PAGING_SEQUENCE
		FROM OPERATIONS
		GROUP BY RESOURCE_ID, RESOURCE_TYPE
	) max_op ON op.PAGING_SEQUENCE = max_op.PAGING_SEQUENCE
	WHERE max_op.PAGING_SEQUENCE IS NULL`,
	QueryForOperationsWithResource: `
    SELECT id
    FROM {{.RESOURCE_TABLE}}
    WHERE operations.resource_id = {{.RESOURCE_TABLE}}.id`,
	QueryForTenantScopedServiceOfferings: `
	SELECT id FROM broker_labels l
	WHERE l.broker_id = service_offerings.broker_id AND l.key = '{{.TENANT_KEY}}'`,
	QueryForInstanceChildrenByLabel: `
		SELECT 1 FROM service_instances i
        INNER JOIN service_instance_labels l ON i.id = l.service_instance_id
		WHERE  l.key IN ({{.PARENT_KEYS}}) AND l.val = '{{.PARENT_ID}}' AND i.id = service_instances.id`,
}

func GetSubQuery(query SubQuery) string {
	return subQueries[query]
}

func GetSubQueryWithParams(query SubQuery, params SubQueryParams) (string, error) {
	return util.Tsprintf(subQueries[query], params)
}
/*
 * Copyright 2018 The Service Manager Authors
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package storage_test

import (
	"context"
	"errors"
	"sync"
	"time"

	"github.com/Peripli/service-manager/pkg/util"

	"github.com/Peripli/service-manager/pkg/query"
	"github.com/Peripli/service-manager/pkg/types"

	"github.com/Peripli/service-manager/storage"

	"github.com/Peripli/service-manager/storage/storagefakes"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Notification cleaner", func() {
	var (
		ctx         context.Context
		cancel      context.CancelFunc
		wg          *sync.WaitGroup
		fakeStorage *storagefakes.FakeStorage
		nc          *storage.NotificationCleaner
	)

	BeforeEach(func() {
		fakeStorage = &storagefakes.FakeStorage{}
		ctx, cancel = context.WithCancel(context.Background())
		wg = &sync.WaitGroup{}
		nc = &storage.NotificationCleaner{
			Storage:  fakeStorage,
			Settings: *storage.DefaultSettings(),
		}
	})

	AfterEach(func() {
		if ctx.Err() == nil {
			cancel()
		}
		wg.Wait()
	})

	Describe("Start", func() {

		Context("When already started", func() {
			It("Should return error", func() {
				err := nc.Start(ctx, wg)
				Expect(err).ToNot(HaveOccurred())
				err = nc.Start(ctx, wg)
				Expect(err).To(HaveOccurred())
				Expect(err.Error()).To(Equal("notification cleaner already started"))
			})
		})

	})

	Describe("clean", func() {
		Context("When scheduled", func() {
			It("Should call storage.DeleteReturning", func() {
				nc.Settings.Notification.CleanInterval = 0
				var objType types.ObjectType
				var criteria []query.Criterion
				fakeStorage.Delete


from the data
          if not header then
            -- if nph is requested, then close the connection when done
            if nph then SetHeader("Connection", "close") end
            if pos > 1 then data = data:sub(pos) end
          end
        end
        -- if the headers are set, write the response
        if not header then
          Write(data)
          if nph then coroutine.yield() end
        end
      -- check if reading was interrupted or wasn't done
      elseif not data and (not errno or errno:errno() == unix.EINTR) then
        -- closing connection will fail on send
        -- if it doesn't fail, then redo the interrupted read
      else  -- report an error and stop
        -- TODO: log error
        break
      end
      -- stop reading if the process is already done
      done = not unix.wait(pid, unix.WNOHANG)
      if done then break end
    end
    unix.close(rfd1)
    unix.close(wfd1)
    unix.close(rfd2)
    unix.close(wfd2)
    -- kill launched process if it's still running, as it's been running for too long
    if not done then assert(unix.kill(pid, unix.SIGTERM)) end
  end
end)

return fm


:16px;height:16px;background-image: url('images/eraser.png')}

/*!
 * UEditor
 * version: ueditor
 * build: Wed Aug 10 2016 11:06:16 GMT+0800 (CST)
 */

.edui-default .edui-box{border:0;padding:0;margin:0;overflow:hidden}.edui-default a.edui-box{display:block;text-decoration:none;color:#000}.edui-default a.edui-box:hover{text-decoration:none}.edui-default a.edui-box:active{text-decoration:none}.edui-default table.edui-box{border-collapse:collapse}.edui-default ul.edui-box{list-style-type:none}div.edui-box{position:relative;display:-moz-inline-box!important;display:inline-block!important;vertical-align:top}.edui-default .edui-clearfix{zoom:1}.edui-default .edui-clearfix:after{content:'\20';display:block;clear:both}* html div.edui-box{display:inline!important}:first-child+html div.edui-box{display:inline!important}.edui-default .edui-button-body,.edui-splitbutton-body,.edui-menubutton-body,.edui-combox-body{position:relative}.edui-default .edui-popup{position:absolute;-webkit-user-select:none;-moz-user-select:none}.edui-default .edui-popup .edui-shadow{position:absolute;z-index:-1}.edui-default .edui-popup .edui-bordereraser{position:absolute;overflow:hidden}.edui-default .edui-tablepicker .edui-canvas{position:relative}.edui-default .edui-tablepicker .edui-canvas .edui-overlay{position:absolute}.edui-default .edui-dialog-modalmask,.edui-dialog-dragmask{position:absolute;left:0;top:0;width:100%;height:100%}.edui-default .edui-toolbar{position:relative}.edui-default .edui-label{cursor:default}.edui-default span.edui-clickable{color:#00f;cursor:pointer;text-decoration:underline}.edui-default span.edui-unclickable{color:gray;cursor:default}.edui-default .edui-toolbar{cursor:default;-webkit-user-select:none;-moz-user-select:none;padding:1px;overflow:hidden;zoom:1;width:auto;height:auto}.edui-default .edui-toolbar .edui-button,.edui-default .edui-toolbar .edui-splitbutton,.edui-default .edui-toolbar .edui-menubutton,.edui-default .edui-toolbar .edui-combox{margin:1px}.edui-default .edui-editor{border:1px solid #d4d4d4;background-color:#fff;position:relative;overflow:visible;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.edui-editor div{width:auto;height:auto}.edui-default .edui-editor-toolbarbox{position:relative;zoom:1;-webkit-box-shadow:0 1px 4px rgba(204,204,204,.6);-moz-box-shadow:0 1px 4px rgba(204,204,204,.6);box-shadow:0 1px 4px rgba(204,204,204,.6);border-top-left-radius:2px;border-top-right-radius:2px}.edui-default .edui-editor-toolbarboxouter{border-bottom:1px solid #d4d4d4;background-color:#fafafa;background-image:-moz-linear-gradient(top,#fff,#f2f2f2);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#f2f2f2));backgro


third_comma_mean_tone_desc
//    TemperamentType.FifthCommaMeanTone -> R.string.fifth_comma_mean_tone_desc
//    TemperamentType.WerckmeisterIII -> R.string.werckmeister_iii_desc
//    TemperamentType.WerckmeisterIV -> R.string.werckmeister_iv_desc
//    TemperamentType.WerckmeisterV -> R.string.werckmeister_v_desc
//    TemperamentType.WerckmeisterVI -> R.string.werckmeister_vi_desc
//    TemperamentType.Kirnberger1 -> R.string.kirnberger1_desc
//    TemperamentType.Kirnberger2 -> R.string.kirnberger2_desc
//    TemperamentType.Kirnberger3 -> R.string.kirnberger3_desc
//    TemperamentType.Neidhardt1 -> R.string.neidhardt1_desc
//    TemperamentType.Neidhardt2 -> R.string.neidhardt2_desc
//    TemperamentType.Neidhardt3 -> R.string.neidhardt3_desc
//    TemperamentType.Valotti -> null
//    TemperamentType.Young2 -> null
//    TemperamentType.EDO17 -> R.string.equal_temperament_17_desc
//    TemperamentType.EDO19 -> R.string.equal_temperament_19_desc
//    TemperamentType.EDO22 -> R.string.equal_temperament_22_desc
//    TemperamentType.EDO24 -> R.string.equal_temperament_24_desc
//    TemperamentType.EDO27 -> R.string.equal_temperament_27_desc
//    TemperamentType.EDO29 -> R.string.equal_temperament_29_desc
//    TemperamentType.EDO31 -> R.string.equal_temperament_31_desc
//    TemperamentType.EDO41 -> R.string.equal_temperament_41_desc
//    TemperamentType.EDO53 -> R.string.equal_temperament_53_desc
//    TemperamentType.Test -> null
//}
//
//fun getTuningNameAbbrResourceId(temperamentType: TemperamentType) = when(temperamentType) {
//    TemperamentType.EDO12 -> R.string.equal_temperament_12_abbr
//    TemperamentType.Pythagorean -> R.string.pythagorean_tuning_abbr
//    TemperamentType.Pure -> R.string.pure_tuning_abbr
//    TemperamentType.QuarterCommaMeanTone -> R.string.quarter_comma_mean_tone_abbr
//    TemperamentType.ExtendedQuarterCommaMeanTone -> R.string.extended_quarter_comma_mean_tone_abbr
//    TemperamentType.ThirdCommaMeanTone -> R.string.third_comma_mean_tone_abbr
//    TemperamentType.FifthCommaMeanTone -> R.string.fifth_comma_mean_tone_abbr
//    TemperamentType.WerckmeisterIII -> R.string.werckmeister_iii_abbr
//    TemperamentType.WerckmeisterIV -> R.string.werckmeister_iv_abbr
//    TemperamentType.WerckmeisterV -> R.string.werckmeister_v_abbr
//    TemperamentType.WerckmeisterVI -> R.string.werckmeister_vi_abbr
//    TemperamentType.Kirnberger1 -> R.string.kirnberger1_abbr
//    TemperamentType.Kirnberger2 -> R.string.kirnberger2_abbr
//    TemperamentType.Kirnberger3 -> R.string.kirnberger3_abbr
//    TemperamentType.Neidhardt1 -> R.string.neidhardt1_abbr
//    TemperamentType.Neidhardt2 -> R.string.neidhardt2_abbr
//    TemperamentType.Neidhardt3 -> R.string.neidhardt3_abbr
//    TemperamentType.Valotti -> R.string.valotti_abbr
//    TemperamentType.Young2 -> R.string.young2_abbr
//    TemperamentType.EDO17 -> R.string.equal_temperament_17_ab


(self.cmp(other))
    }
}

impl Hash for MultisetU4x8 {
    #[inline]
    fn hash<H: Hasher>(&self, state: &mut H) {
        state.write_u32(self.as_u32())
    }
}

#[cfg(test)]
impl Arbitrary for MultisetU4x8 {
    type Parameters = ();
    type Strategy = BoxedStrategy<Self>;

    fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
        any::<u32>().prop_map(Self).boxed()
    }
}

// #[cfg(test)]
// mod test {
//     use super::*;
//     use proptest::prelude::*;
//
//     #[test]
//     fn test_mset_u4x8_ord() {
//         proptest!(|(mset1 in any::<MultisetU4x8>(), mset2 in any::<MultisetU4x8>())| {
//             prop_assert_eq!(mset1.cmp(&mset2), mset1.fast_cmp(&mset2));
//         });
//     }
// }
<gh_stars>1-10
extern crate pkg_config;
extern crate gcc;

use std::path::Path;

fn main() {
    let root = std::env::var("CARGO_MANIFEST_DIR").unwrap();
    let root = Path::new(&root).join("libharu");

    println!("cargo:include={}", root.join("include").into_os_string().into_string().unwrap());
    println!("cargo:src={}", root.join("lib").into_os_string().into_string().unwrap());

    match pkg_config::find_library("haru") {
        Ok(_) => return,
        Err(..) => {}
    };

    gcc::Build::new()
                .file("libharu/src/hpdf_3dmeasure.c")
                .file("libharu/src/hpdf_annotation.c")
                .file("libharu/src/hpdf_array.c")
                .file("libharu/src/hpdf_binary.c")
                .file("libharu/src/hpdf_boolean.c")
                .file("libharu/src/hpdf_catalog.c")
                .file("libharu/src/hpdf_destination.c")
                .file("libharu/src/hpdf_dict.c")
                .file("libharu/src/hpdf_doc.c")
                .file("libharu/src/hpdf_doc_png.c")
                .file("libharu/src/hpdf_encoder.c")
                .file("libharu/src/hpdf_encoder_cns.c")
                .file("libharu/src/hpdf_encoder_cnt.c")
                .file("libharu/src/hpdf_encoder_jp.c")
                .file("libharu/src/hpdf_encoder_kr.c")
                .file("libharu/src/hpdf_encoder_utf.c")
                .file("libharu/src/hpdf_encrypt.c")
                .file("libharu/src/hpdf_encryptdict.c")
                .file("libharu/src/hpdf_error.c")
                .file("libharu/src/hpdf_exdata.c")
                .file("libharu/src/hpdf_ext_gstate.c")
                .file("libharu/src/hpdf_font.c")
                .file("libharu/src/hpdf_font_cid.c")
                .file("libharu/src/hpdf_fontdef_base14.c")
                .file("libharu/src/hpdf_fontdef.c")
                .file("libharu/src/hpdf_fontdef_cid.c")
                .file("libharu/src/hpdf_fontdef_cns.c")
                .file("libharu/src/hpdf_fontdef_cnt.c")
                .file("libharu/src/hpdf_fontdef_jp.c")
                .file("libharu/src/hpdf_fontdef_kr.c")
                .fil


    val version: String,
    val publicationName: String,
    val pomDescription: String,
    val pomUrl: String,
    val scmConnection: String,
    val scmDeveloperConnection: String,
    val scmUrl: String,
) {
    companion object {
        fun load(target: Project): PublishingProperties {
            val secretPropsFile = target.file("artifact.properties")
            val properties = mutableMapOf<String, Any>()
            if (secretPropsFile.exists()) {
                val fileProperties = Properties()
                FileInputStream(secretPropsFile).use { stream -> fileProperties.load(stream) }
                fileProperties.forEach { key, value ->
                    if (key is String) {
                        properties[key] = value
                    }
                }
            }
            return PublishingProperties(
                groupId = properties.stringOrEmpty("groupId"),
                artifactId = properties.stringOrEmpty("artifactId"),
                version = properties.stringOrEmpty("version"),
                publicationName = properties.stringOrEmpty("publicationName"),
                pomDescription = properties.stringOrEmpty("pomDescription"),
                pomUrl = properties.stringOrEmpty("pomUrl"),
                scmConnection = properties.stringOrEmpty("scmConnection"),
                scmDeveloperConnection = properties.stringOrEmpty("scmDeveloperConnection"),
                scmUrl = properties.stringOrEmpty("scmUrl")
            )
        }
    }
}

private fun Map<String, Any>.stringOrEmpty(key: String): String {
    val value = this[key]
    return if (value is String) {
        return value
    } else {
        ""
    }
}/*
 * Copyright 2015 the original author or authors.
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 *
 */

package pl.touk.android.bubble.orientation

import pl.touk.android.bubble.Degree
import pl.touk.android.bubble.coordinates.Coordinates
import pl.touk.android.bubble.utils.inRange

open class OrientationCalculator {

    open fun calculate(coordinates: Coordinates): Orientation {
        return when {
            coordinates.pitch <= Degree.MINUS_45 -> Orientation.PORTRAIT
            coordinates.pitch >= Degree.PLUS_45 -> Orientation.REVERSE_PORTRAIT
            coordinates.roll <= Degree.MINUS_45 -> Orientation.LANDSCAPE
            coordinates.roll >= Degree.PLUS_45 -> Orientation.REVERSE_LANDSCAPE
            else -> Orientation.PORTRAIT
        }
    }
}package pl.touk.android.bubble.state

import org.junit.Test
import pl.touk.android.bubble.orientation.Orientation
import pl.touk.android.bubble.coordinates.Coordinates
import org.mockito.Mockito.`when` as whenInvoke
import pl.touk.android.bubble.testvalue.Degree

class OrientationStateMachineLandscapeTest: OrientationStateTestBase() {

    @Test
    public fun `'45 ge P ge -45' and '45 ge R ge -45' gives Landscape`() {
        val moreThanMinus45 = Degree.MINUS_45 + Degree.ONE

        verifyStateChange(initState = Orientation.LANDSCAPE,
                newCoordinates = Coordinates(Degree.ZERO, Degree.ZERO),
                expectedState  = Orientation.LANDSCAPE)

        verifyStateChange(initSt


	font: normal 20px/29px 'dashicons';
	speak: none;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.tb-close-icon:hover {
	color: #2ea2cc;
}
.imgCrop_wrap {
	/* width: 500px;   @done_in_js */
	/* height: 375px;  @done_in_js */
	position: relative;
	cursor: crosshair;
}

/* an extra classname is applied for Opera < 9.0 to fix its lack of opacity support */
.imgCrop_wrap.opera8 .imgCrop_overlay,
.imgCrop_wrap.opera8 .imgCrop_clickArea {
	background-color: transparent;
}

/* fix for IE displaying all boxes at line-height by default, although they are still 1 pixel high until we combine them with the pointless span */
.imgCrop_wrap,
.imgCrop_wrap * {
	font-size: 0;
}

.imgCrop_overlay {
	background-color: #000;
	opacity: 0.5;
	filter:alpha(opacity=50);
	position: absolute;
	width: 100%;
	height: 100%;
}

.imgCrop_selArea {
	position: absolute;
	/* @done_in_js
	top: 20px;
	left: 20px;
	width: 200px;
	height: 200px;
	background: transparent url(castle.jpg) no-repeat  -210px -110px;
	*/
	cursor: move;
	z-index: 2;
}

/* clickArea is all a fix for IE 5.5 & 6 to allow the user to click on the given area */
.imgCrop_clickArea {
	width: 100%;
	height: 100%;
	background-color: #FFF;
	opacity: 0.01;
	filter:alpha(opacity=01);
}

.imgCrop_marqueeHoriz {
	position: absolute;
	width: 100%;
	height: 1px;
	background: transparent url(marqueeHoriz.gif) repeat-x 0 0;
	z-index: 3;
}

.imgCrop_marqueeVert {
	position: absolute;
	height: 100%;
	width: 1px;
	background: transparent url(marqueeVert.gif) repeat-y 0 0;
	z-index: 3;
}

.imgCrop_marqueeNorth { top: 0; left: 0; }
.imgCrop_marqueeEast  { top: 0; right: 0; }
.imgCrop_marqueeSouth { bottom: 0px; left: 0; }
.imgCrop_marqueeWest  { top: 0; left: 0; }

.imgCrop_handle {
	position: absolute;
	border: 1px solid #333;
	width: 6px;
	height: 6px;
	background: #FFF;
	opacity: 0.5;
	filter:alpha(opacity=50);
	z-index: 4;
}

/* fix IE 5 box model */
* html .imgCrop_handle {
	width: 8px;
	height: 8px;
	wid\th: 6px;
	hei\ght: 6px;
}

.imgCrop_handleN {
	top: -3px;
	left: 0;
	/* margin-left: 49%;    @done_in_js */
	cursor: n-resize;
}

.imgCrop_handleNE {
	top: -3px;
	right: -3px;
	cursor: ne-resize;
}

.imgCrop_handleE {
	top: 0;
	right: -3px;
	/* margin-top: 49%;    @done_in_js */
	cursor: e-resize;
}

.imgCrop_handleSE {
	right: -3px;
	bottom: -3px;
	cursor: se-resize;
}

.imgCrop_handleS {
	right: 0;
	bottom: -3px;
	/* margin-ri


/gemm-hierarchy-with-epilogue-no-labels.png "CUTLASS GEMM API")

[README](../../README.md#documentation) > **CUTLASS 3.0 GEMM API**

# CUTLASS 3.0 GEMM API

CUTLASS presents a uniform programming model
for matrix multiply-accumulate (MMA) operations
at different levels of the GPU system hierarchy.
CUTLASS 3.0 has GEMM APIs corresponding to the following levels
in order of highest to the lowest level.

1. Device
2. Kernel
3. Collective
4. Tiled MMA and Copy
5. Atom

This document will cover the first three levels in detail:
Device, Kernel, and Collective.
It also briefly discusses the Tiled MMA/Copy and Atom level,
and then refers readers to CuTe's tutorial for more information.

# CUTLASS GEMM Model

CUTLASS implements algorithms that express
the classical "triply nested loop" GEMM algorithm
with a tiled structure mirroring the above hierarchy.

The following pseudocode describes the model for a GEMM kernel
targeting a warp-synchronous matrix multiply instruction like `mma.sync.`
The entire operation is referred to as "Gemm,"
as it is assumed that an epilogue operation
performs the general matrix update similar to BLAS.
This is pseudocode and is only meant to illustrate which parts of the layers
correspond to the inner or outer loops of the GEMM.

```c++
// cutlass::gemm::kernel::GemmUniversal: ClusterTileM and ClusterTileN loops
//   are either rasterized by the hardware or scheduled by the kernel in persistent kernels.
// Parallelism over thread block clusters
for (int cluster_m = 0; cluster_m < GemmM; cluster_m += ClusterTileM) {
  for (int cluster_n = 0; cluster_n < GemmN; cluster_n += ClusterTileN) {

    // cutlass::gemm::collective::CollectiveMma: mainloop that iterates over all k-tiles
    // No loop unrolling is performed at this stage
    for (int k_tile = 0; k_tile < size<2>(gmem_tensor_A); k_tile++) {

      // loops inside cute::gemm(tiled_mma, a, b, c); Dispatch 5: (V,M,K) x (V,N,K) => (V,M,N)
      // TiledMma uses the hardware instruction provided through its Mma_Atom
      // TiledMma's atom layout, value layout, and permutations define the iteration order
      for (int tiled_mma_k = 0; tiled_mma_k < size<2>(A); tiled_mma_k++) {
        for (int tiled_mma_m = 0; tiled_mma_m < size<1>(A); tiled_mma_m++) {
          for (int tiled_mma_n = 0; tiled_mma_n < size<1>(B); tiled_mma_n++) {

            // TiledMma's vector mode dispatches to the underlying instruction.
            mma.call(d, a, b, c);
          } // tiled_mma_n
        } // tiled_mma_m
      } // tiled_mma_k
    } // k_tile mainloop
  } // cluster_m
} // cluster_n
```

The first three nested `for` loops
correspond to parallelism over thread block clusters.
The code does not actually express them as explicit `for` loops.
Instead, the parallelization scheme over tiles
is implied by CUDA grid launch semantics.
However, for persistent kernels,
these three loops are expressed in the source code
as a single `while` loop that queries the
[work tile scheduler](/include/cutlass/gemm/kernel/sm90_tile_scheduler.hpp)
for problem tiles on which to compute.

Inside the three nested `for` loops,
one finds code that pulls matrix tiles
from global memory into more "local" memory
(like shared memory or registers)
and computes MMAs.
These tiled copy and tiled mma iterations are generally
fully static and get fully unrolled.

# CUTLASS GEMM Components

CUTLASS expresses the above loop nest
with the following component


 redirectUrl)
      .put("client_secret", clientSecret)
      .put("code", authCode)
      .put("grant_type", "authorization_code")
      .build()

  /**
   * Returns the URL where to retrieve the access token from.
   *
   */
  override fun getAccessTokenUrl(inputOAuthConfiguration: JsonNode): String = ACCESS_TOKEN_URL

  override fun getDefaultOAuthOutputPath(): List<String> = listOf()

    /*
     * Should be overriden to satisfy the BaseOAuth2Flow abstraction requirements
     */
  @Throws(IOException::class)
  override fun formatConsentUrl(
    definitionId: UUID?,
    clientId: String,
    redirectUrl: String,
    inputOAuthConfiguration: JsonNode,
  ): String = ""

  companion object {
    private const val ACCESS_TOKEN_URL = "https://api.amazon.com/auth/o2/token"
    private const val SELLER_EUROPE_URL = "https://sellercentral-europe.amazon.com"
    private val VENDOR_CENTRAL_URLS: Map<String, String> =
      ImmutableMap
        .builder<String, String>()
        .put("CA", "https://vendorcentral.amazon.ca")
        .put("US", "https://vendorcentral.amazon.com")
        .put("DE", "https://vendorcentral.amazon.de")
        .put("MX", "https://vendorcentral.amazon.com.mx")
        .put("JP", "https://vendorcentral.amazon.co.jp")
        .put("IT", "https://vendorcentral.amazon.it")
        .put("AU", "https://vendorcentral.amazon.com.au")
        .put("BR", "https://vendorcentral.amazon.com.br")
        .put("BE", "https://vendorcentral.amazon.com.be")
        .put("ES", "https://vendorcentral.amazon.es")
        .put("UK", "https://vendorcentral.amazon.co.uk")
        .put("GB", "https://vendorcentral.amazon.co.uk")
        .put("NL", "https://vendorcentral.amazon.nl")
        .put("PL", "https://vendorcentral.amazon.pl")
        .put("FR", "https://vendorcentral.amazon.fr")
        .put("IN", "https://www.vendorcentral.in")
        .put("SE", "https://vendorcentral.amazon.se")
        .put("SG", "https://vendorcentral.amazon.com.sg")
        .put("AE", "https://vendorcentral.amazon.me")
        .put("TR", "https://vendorcentral.amazon.com.tr")
        .put("SA", "https://vendorcentral.amazon.me")
        .put("EG", "https://vendorcentral.amazon.me")
        .put("ZA", "https://vendorcentral.amazon.co.za")
        .build()

    private val SELLER_CENTRAL_URLS: Map<String, String> =
      ImmutableMap
        .builder<String, String>()
        .put("CA", "https://sellercentral.amazon.ca")
        .put("US", "https://sellercentral.amazon.com")
        .put("MX", "https://sellercentral.amazon.com.mx")
        .put("BR", "https://sellercentral.amazon.com.br")
        .put("ES", SELLER_EUROPE_URL)
        .put("UK", SELLER_EUROPE_URL)
        .put("GB", SELLER_EUROPE_URL)
        .put("FR", SELLER_EUROPE_URL)
        .put("NL", "https://sellercentral.amazon.nl")
        .put("DE", SELLER_EUROPE_URL)
        .put("IT", SELLER_EUROPE_URL)
        .put("SE", "https://sellercentral.amazon.se")
        .put("ZA", "https://sellercentral.amazon.co.za")
        .put("PL", "https://sellercentral.amazon.pl")
        .put("EG", "https://sellercentral.amazon.eg")
        .put("TR", "https://sellercentral.amazon.com.tr")
        .put("S


�)",
"area agreement":"[经] 地区协议",
"area allowance":"[经] 地区津贴",
"area argument":"[计] 区域变元",
"area assessment":"[法] 分区鉴定, 地区课税",
"area assignment":"[计] 区域赋值",
"area attribute":"[计] 区域属性",
"area available for":"[化] 有效加强面积",
"area bombing":"n. 区域轰炸",
"area celsi":"[医] 斑秃, 斑形脱发",
"area centralis":"[医] 中央区(视网膜)",
"area character coding":"[计] 区域字符编码",
"area chart autoformat":"[计] 自动套用面积图",
"Area Cheat AutoFormat":"自动套用面积图",
"area cheiro-kinesthetic":"[医] 手动感觉区",
"area chorioidea":"[医] 脉络区",
"area cochleae":"[医] [耳]蜗区",
"area code":"分区电话号码",
"area coefficient":"[机] 面积系数",
"area committee":"[法] 地区委员会",
"area communication":"[计] 区域通信",
"area composition machine":"[计] 区域作图机",
"area coordinate":"[计] 面积坐标",
"area cribrifopmis sclerae":"[医] 巩膜筛区",
"area cribriformis ampullaris":"[医] 壶腹筛区",
"area cribriformis saccularis":"[医] 球囊筛区",
"area cribriformis utriculoampullaris":"[医] 椭圆囊壶腹筛区",
"area cribrosa":"[医] 筛区, 筛斑",
"area cribrosa papillae renallis":"[医] 肾乳头筛区",
"area data":"[计] 区域数据",
"area definition":"[计] 区限定",
"area density":"[电] 面密度",
"area description":"[计] 区域描述",
"area detector":"[化] 平面检测器",
"area drainage":"[机] 干壕排水",
"area effect":"[电] 区域效应",
"area entry":"[计] 区域入口",
"area exchange":"[计] 区域电话局",
"area facialis":"[医] 面神经区(面神经管入口处)",
"area factor":"[计] 区域因数",
"area free from defect":"[化] 无缺陷区域",
"area gastrica":"[医] 胃区",
"area germinativa":"[医] 胚区",
"area heating installation":"[化] 局部加热装置",
"area hypoglossi":"[医] 舌下区(口腔)",
"area intercondylaris anterior":"[医] 髁间前窝",
"area intercondylaris posterior":"[医] 髁间后窝",
"area jonstoni":"[医] 斑秃, 斑形脱发",
"area lunata":"[医] 月状区(小脑)",
"area maintenance":


     return false;
                }
            };
            unsafe {
                cpu::wrmsr(Self::MSR_INDEX, local_apic_msr | Self::XAPIC_ENABLED_MASK);
            }
        }
        self.store_apic_id();
        self.write_apic_register(
            LocalApicRegisters::SIR,
            self.read_apic_register(LocalApicRegisters::SIR) | 0x100,
        );
        pr_info!(
            "APIC ID:{}(x2APIC:{})",
            self.apic_id,
            self.is_x2apic_enabled
        );
        return true;
    }

    /// Init LocalApicManager by other LocalApicManager
    ///
    /// This function will be used when the application processor sets up with this manager of BSP.
    pub fn init_from_other_manager(&mut self, manager: &Self) -> bool {
        let local_apic_msr = unsafe { cpu::rdmsr(Self::MSR_INDEX) };
        if manager.is_x2apic_enabled {
            unsafe {
                cpu::wrmsr(
                    Self::MSR_INDEX,
                    local_apic_msr | Self::X2APIC_ENABLED_MASK | Self::XAPIC_ENABLED_MASK,
                );
            }
            self.is_x2apic_enabled = true;
        } else {
            unsafe {
                cpu::wrmsr(Self::MSR_INDEX, local_apic_msr | Self::XAPIC_ENABLED_MASK);
            }
            self.base_address = manager.base_address;
        }
        self.store_apic_id();
        self.write_apic_register(
            LocalApicRegisters::SIR,
            self.read_apic_register(LocalApicRegisters::SIR) | 0x100,
        );
        pr_info!(
            "APIC ID:{}(x2APIC:{})",
            self.apic_id,
            self.is_x2apic_enabled
        );
        return true;
    }

    /// Get current CPU's APIC ID
    pub fn get_apic_id(&self) -> u32 {
        self.apic_id
    }

    /// Get current CPU's APIC ID from register and store it.
    fn store_apic_id(&mut self) {
        self.apic_id = if self.is_x2apic_enabled {
            self.read_apic_register(LocalApicRegisters::ApicId)
        } else {
            (self.read_apic_register(LocalApicRegisters::ApicId) >> 24) & 0xff
        };
    }

    /// Send end of interruption to Local APIC.
    pub fn send_eoi(&self) {
        self.write_apic_register(LocalApicRegisters::EOI, 0);
    }

    /// Send the interrupt command (ICR)
    ///
    /// See Intel 64 and IA-32 Architectures Software Developer’s Manual Volume 3
    /// 10.6.1 Interrupt Command Register (ICR) The interrupt command register (ICR)
    /// 10.12.9 ICR Operation in x2APIC Mode
    pub fn send_interrupt_command(
        &self,
        destination: u32,
        delivery_mode: u8,
        trigger_mode: u8,
        is_init_ipi_de_assert: bool,
        vector: u8,
    ) {
        assert!(delivery_mode < 8);
        let mut data: u64 = if is_init_ipi_de_assert {
            assert_eq!(delivery_mode, 0b101);
            assert!(trigger_mode < 2);
            ((trigger_mode as u64) << 15) | ((delivery_mode as u64) << 8) | (vector as u64)
        } else {
            ((trigger_mode as u64) << 15)
                | (1 << 14)
                | ((delivery_mode as u64) << 8)
                | (