from prowler.lib.logger import logger
from prowler.providers.aws.services.cloudtrail.cloudtrail_client import (
    cloudtrail_client,
)

def fixer(region):
    """
    NOTE: Define the S3 bucket name in the fixer_config.yaml file.
    Enable CloudTrail in a region. Requires the cloudtrail:CreateTrail permission:
    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": "cloudtrail:CreateTrail",
                "Resource": "*"
            }
        ]
    }
    Args:
        region (str): AWS region
    Returns:
        bool: True if CloudTrail is enabled, False otherwise
    """
    try:
        cloudtrail_fixer_config = cloudtrail_client.fixer_config.get(
            "cloudtrail_multi_region_enabled", {}
        )
        regional_client = cloudtrail_client.regional_clients[region]
        args = {
            "Name": cloudtrail_fixer_config.get("TrailName", "DefaultTrail"),
            "S3BucketName": cloudtrail_fixer_config.get("S3BucketName"),
            "IsMultiRegionTrail": cloudtrail_fixer_config.get(
                "IsMultiRegionTrail", True
            ),
            "EnableLogFileValidation": cloudtrail_fixer_config.get(
                "EnableLogFileValidation", True
            ),
        }
        if cloudtrail_fixer_config.get("CloudWatchLogsLogGroupArn"):
            args["CloudWatchLogsLogGroupArn"] = cloudtrail_fixer_config.get(
                "CloudWatchLogsLogGroupArn"
            )
        if cloudtrail_fixer_config.get("CloudWatchLogsRoleArn"):
            args["CloudWatchLogsRoleArn"] = cloudtrail_fixer_config.get(
                "CloudWatchLogsRoleArn"
            )
        if cloudtrail_fixer_config.get("KmsKeyId"):
            args["KmsKeyId"] = cloudtrail_fixer_config.get("KmsKeyId")
        regional_client.create_trail(**args)
    except Exception as error:
        logger.error(
            f"{region} -- {error.__class__.__name__}[{error.__traceback__.tb_lineno}]: {error}"
        )
        return False
    else:
        return True


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.ClientModel;
using System.ClientModel.Primitives;
using System.Collections.Generic;
using AutoRest.CSharp.Common.Input;
using AutoRest.CSharp.Common.Output.Expressions.Statements;
using AutoRest.CSharp.Common.Output.Expressions.ValueExpressions;
using AutoRest.CSharp.Common.Output.Models;
using AutoRest.CSharp.Generation.Types;
using AutoRest.CSharp.Output.Models.Shared;
using static AutoRest.CSharp.Common.Output.Models.Snippets;

namespace AutoRest.CSharp.Output.Models.Types.System
{
    internal class ErrorResultProvider : ExpressionTypeProvider
    {
        private static readonly Lazy<ErrorResultProvider> _instance = new(() => new ErrorResultProvider());

        public static ErrorResultProvider Instance => _instance.Value;

        private class ErrorResultTemplate<T> { }

        private CSharpType _t = typeof(ErrorResultTemplate<>).GetGenericArguments()[0];
        private FieldDeclaration _responseField;
        private FieldDeclaration _exceptionField;
        private VariableReference _response;
        private VariableReference _exception;

        private ErrorResultProvider()
            : base(Configuration.HelperNamespace, null)
        {
            DeclarationModifiers = TypeSignatureModifiers.Internal;
            _responseField = new FieldDeclaration(FieldModifiers.Private | FieldModifiers.ReadOnly, typeof(PipelineResponse), "_response");
            _exceptionField = new FieldDeclaration(FieldModifiers.Private | FieldModifiers.ReadOnly, typeof(ClientResultException), "_exception");
            _response = new VariableReference(_responseField.Type, _responseField.Declaration);
            _exception = new VariableReference(_exceptionField.Type, _exceptionField.Declaration);
        }

        protected override string DefaultName => "ErrorResult";


addiu	$sp $sp -4
	move	$a0 $s0
	bne	$a0 $zero label13
	la	$a0 str_const0
	li	$t1 31
	jal	_dispatch_abort
label13:
	lw	$t1 8($a0)
	lw	$t1 16($t1)
	jalr		$t1
	lw	$a0 24($s0)
	bne	$a0 $zero label14
	la	$a0 str_const0
	li	$t1 32
	jal	_dispatch_abort
label14:
	lw	$t1 8($a0)
	lw	$t1 16($t1)
	jalr		$t1
	sw	$a0 0($sp)
	addiu	$sp $sp -4
	move	$a0 $s0
	bne	$a0 $zero label15
	la	$a0 str_const0
	li	$t1 32
	jal	_dispatch_abort
label15:
	lw	$t1 8($a0)
	lw	$t1 16($t1)
	jalr		$t1
	lw	$a0 12($s0)
	bne	$a0 $zero label16
	la	$a0 str_const0
	li	$t1 33
	jal	_dispatch_abort
label16:
	la	$t1 A_dispTab
	lw	$t1 12($t1)
	jalr		$t1
	sw	$a0 0($sp)
	addiu	$sp $sp -4
	move	$a0 $s0
	bne	$a0 $zero label17
	la	$a0 str_const0
	li	$t1 33
	jal	_dispatch_abort
label17:
	lw	$t1 8($a0)
	lw	$t1 16($t1)
	jalr		$t1
	lw	$a0 12($s0)
	bne	$a0 $zero label18
	la	$a0 str_const0
	li	$t1 34
	jal	_dispatch_abort
label18:
	la	$t1 A_dispTab
	lw	$t1 16($t1)
	jalr		$t1
	sw	$a0 0($sp)
	addiu	$sp $sp -4
	move	$a0 $s0
	bne	$a0 $zero label19
	la	$a0 str_const0
	li	$t1 34
	jal	_dispatch_abort
label19:
	lw	$t1 8($a0)
	lw	$t1 16($t1)
	jalr		$t1
	lw	$a0 16($s0)
	bne	$a0 $zero label20
	la	$a0 str_const0
	li	$t1 35
	jal	_dispatch_abort
label20:
	la	$t1 A_dispTab
	lw	$t1 12($t1)
	jalr		$t1
	sw	$a0 0($sp)
	addiu	$sp $sp -4
	move	$a0 $s0
	bne	$a0 $zero label21
	la	$a0 str_const0
	li	$t1 35
	jal	_dispatch_abort
label21:
	lw	$t1 8($a0)
	lw	$t1 16($t1)
	jalr		$t1
	lw	$a0 16($s0)
	bne	$a0 $zero label22
	la	$a0 str_const0
	li	$t1 36
	jal	_dispatch_abort
label22:
	la	$t1 A_dispTab
	lw


method");
    }
  }

  @override
  Future<void> dismiss({bool animated = true}) async {
    Map<String, dynamic> args = <String, dynamic>{};
    args.putIfAbsent("animated", () => animated);
    await channel?.invokeMethod('dismiss', args);
  }

  @override
  Future<PrintJobInfo?> getInfo() async {
    Map<String, dynamic> args = <String, dynamic>{};
    Map<String, dynamic>? infoMap =
        (await channel?.invokeMethod('getInfo', args))?.cast<String, dynamic>();
    return PrintJobInfo.fromMap(infoMap);
  }

  @override
  Future<void> dispose() async {
    Map<String, dynamic> args = <String, dynamic>{};
    await channel?.invokeMethod('dispose', args);
    disposeChannel();
  }
}
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark

part of 'asset_list.dart';

// **************************************************************************
// FreezedGenerator
// **************************************************************************

T _$identity<T>(T value) => value;

final _privateConstructorUsedError = UnsupportedError(
    'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');

AssetList _$AssetListFromJson(Map<String, dynamic> json) {
  return _AssetList.fromJson(json);
}

/// @nodoc
mixin _$AssetList {
  List<Asset> get items => throw _privateConstructorUsedError;
  int get totalItems => throw _privateConstructorUsedError;

  /// Serializes this AssetList to a JSON map.
  Map<String, dynamic> toJson() => throw _privateConstructorUsedError;

  /// Create a copy of AssetList
  /// with the given fields replaced by the non-null parameter values.
  @JsonKey(includeFromJson: false, includeToJson: false)
  $AssetListCopyWith<AssetList> get copyWith =>
      throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $AssetListCopyWith<$Res> {
  factory $AssetListCopyWith(AssetList value, $Res Function(AssetList) then) =
      _$AssetListCopyWithImpl<$Res, AssetList>;
  @useResult
  $Res call({List<Asset> items, int totalItems});
}

/// @nodoc
class _$AssetListCopyWithImpl<$Res, $Val extends AssetList>
    implements $AssetListCopyWith<$Res> {
  _$AssetListCopyWithImpl(this._value, this._then);

  // ignore: unused_field
  final $Val _value;
  // ignore: unused_field
  final $Res Function($Val) _then;

  /// Create a copy of AssetList
  /// with the given fields replaced by the non-null parameter values.
  @pragma('vm:prefer-inline')
  @override
  $Res call({
    Object? items = null,
    Object? totalItems = null,
  }) {
    return _then(_value.copyWith(
      items: null == items
          ? _value.items
          : items // ignore: cast_nullable_to_non_nullable
              as List<Asset>,
      totalItems: null == totalItems
          ? _value.totalItems
          : totalItems // ignore: cast_nullable_to_non_nullable
              as int,
    ) as $Val);
  }
}

/// @nodoc
abstract class _$$AssetListImplCopyWith<$Res>
    implements $AssetListCopyWith<$Res> {
  factory _$$AssetListImplCopyWith(


1].x - points[i].x;
      dy = points[i + 1].y - points[i].y;
      totalLength += Math.sqrt(dx * dx + dy * dy);
    }
    const distanceBetweenPoints = this.brushSettings.size / this.brushSettings.smoothingPrecision * 6;
    const stepNr = Math.ceil(totalLength / distanceBetweenPoints);
    let interpolatedPoints = points;
    if (stepNr > 0) {
      interpolatedPoints = this.generateEquidistantPoints(
        this.smoothingCordsArray,
        distanceBetweenPoints
        // Distance between interpolated points
      );
    }
    if (!this.initialDraw) {
      const spliceIndex = interpolatedPoints.findIndex(
        (point2) => point2.x === this.smoothingCordsArray[2].x && point2.y === this.smoothingCordsArray[2].y
      );
      if (spliceIndex !== -1) {
        interpolatedPoints = interpolatedPoints.slice(spliceIndex + 1);
      }
    }
    for (const point2 of interpolatedPoints) {
      this.draw_shape(point2, interpolatedOpacity);
    }
    if (!this.initialDraw) {
      this.smoothingCordsArray = this.smoothingCordsArray.slice(2);
    } else {
      this.initialDraw = false;
    }
  }
  async drawLine(p1, p2, compositionOp) {
    const brush_size = await this.messageBroker.pull("brushSize");
    const distance = Math.sqrt((p2.x - p1.x) ** 2 + (p2.y - p1.y) ** 2);
    const steps = Math.ceil(
      distance / (brush_size / this.brushSettings.smoothingPrecision * 4)
    );
    const interpolatedOpacity = 1 / (1 + Math.exp(-6 * (this.brushSettings.opacity - 0.5))) - 1 / (1 + Math.exp(3));
    this.init_shape(compositionOp);
    for (let i = 0; i <= steps; i++) {
      const t2 = i / steps;
      const x = p1.x + (p2.x - p1.x) * t2;
      const y = p1.y + (p2.y - p1.y) * t2;
      const point = { x, y };
      this.draw_shape(point, interpolatedOpacity);
    }
  }
  //brush adjustment
  async startBrushAdjustment(event) {
    event.preventDefault();
    const coords = { x: event.offsetX, y: event.offsetY };
    let coords_canvas = await this.messageBroker.pull("screenToCanvas", coords);
    this.messageBroker.publish("setBrushPreviewGradientVisibility", true);
    this.initialPoint = coords_canvas;
    this.isBrushAdjusting = true;
    return;
  }
  async handleBrushAdjustment(event) {
    const coords = { x: event.offsetX, y: event.offsetY };
    const brushDeadZone = 5;
    let coords_canvas = await this.messageBroker.pull("screenToCanvas", coords);
    const delta_x = coords_canvas.x - this.initialPoint.x;
    const delta_y = coords_canvas.y - this.initialPoint.y;
    const effectiveDeltaX = Math.abs(delta_x) < brushDeadZone ? 0 : delta_x;
    const effectiveDeltaY = Math.abs(delta_y) < brushDeadZone ? 0 : delta_y;
    let finalDeltaX = effectiveDeltaX;
    let finalDeltaY = effectiveDeltaY;
    console.log(this.useDominantAxis);
    if (this.useDominantAxis) {
      const ratio = Math.abs(effectiveDeltaX) / Math.abs(effectiveDeltaY);
      const threshold = 2;
      if (ratio > threshold) {
        finalDeltaY = 0;
      } else if (ratio < 1 / threshold) {
        finalDeltaX = 0;
      }
    }
    const cappedDeltaX = Math.max(-100, Math.min(100, final


-- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation

---@type LazySpec
return {
  "mfussenegger/nvim-dap",
  enabled = true,
  keys = {
    {
      "<leader>dc",
      function()
        require("dap").continue()
      end,
      desc = "Debug | Continue",
      silent = true,
    },
    {
      "<leader>dC",
      function()
        require("dap").clear_breakpoints()
      end,
      desc = "Debug | Clear Breakpoints",
      silent = true,
    },
    {
      "<leader>do",
      function()
        require("dap").step_over()
      end,
      desc = "Debug | Step Over",
      silent = true,
    },
    {
      "<leader>di",
      function()
        require("dap").step_into()
      end,
      desc = "Debug | Step Into",
      silent = true,
    },
    {
      "<leader>du",
      function()
        require("dap").step_out()
      end,
      desc = "Debug | Step Out",
      silent = true,
    },
    {
      "<leader>db",
      function()
        require("dap").toggle_breakpoint()
      end,
      desc = "Debug | Breakpoint",
      silent = true,
    },
    {
      "<leader>dD",
      function()
        require("dap").disconnect()
      end,
      desc = "Debug | Disconnect",
      silent = true,
    },
    {
      "<leader>dB",
      function()
        require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: "))
      end,
      desc = "Debug | Breakpoint Condition",
      silent = true,
    },
    {
      "<leader>dl",
      function()


ANALYSIS, Reference.MNEMONIC);
			refManager.setPrimary(ref1, true);
		}
		finally {
			program.endTransaction(transactionID, true);
		}

		assertTrue(cb.goToField(addr("1003000"), PostCommentFieldFactory.FIELD_NAME, 0, 1));
		ListingTextField tf = (ListingTextField) cb.getCurrentField();
		assertEquals("-- Jump Destination Override: LAB_01003006 (01003006)", tf.getText());

		//test that making the reference non-primary removes the post comment
		ref1 = refManager.getPrimaryReferenceFrom(addr("1003000"), Reference.MNEMONIC);
		assertTrue(ref1.isPrimary());
		transactionID = program.startTransaction("set_ref_non_primary");
		try {
			refManager.setPrimary(ref1, false);
		}
		finally {
			program.endTransaction(transactionID, true);
		}
		assertFalse(cb.goToField(addr("1003000"), PostCommentFieldFactory.FIELD_NAME, 0, 1));

		//test that adding a second ref of the same type and setting it to primary
		//yields a new post comment
		transactionID = program.startTransaction("add_second_jump_ref");
		Reference ref2 = null;
		try {
			ref2 = refManager.addMemoryReference(addr("1003000"), addr("1003008"),
				RefType.JUMP_OVERRIDE_UNCONDITIONAL, SourceType.ANALYSIS, Reference.MNEMONIC);
			refManager.setPrimary(ref2, true);
		}
		finally {
			program.endTransaction(transactionID, true);
		}
		assertTrue(cb.goToField(addr("1003000"), PostCommentFieldFactory.FIELD_NAME, 0, 1));
		tf = (ListingTextField) cb.getCurrentField();
		assertEquals("-- Jump Destination Override: LAB_01003008 (01003008)", tf.getText());

		//test the swapping which reference is primary changes the post comment
		transactionID = program.startTransaction("swap_primary");
		try {
			refManager.setPrimary(ref2, false);
			refManager.setPrimary(ref1, true);
		}
		finally {
			program.endTransaction(transactionID, true);
		}
		assertTrue(cb.goToField(addr("1003000"), PostCommentFieldFactory.FIELD_NAME, 0, 1));
		tf = (ListingTextField) cb.getCurrentField();
		assertEquals("-- Jump Destination Override: LAB_01003006 (01003006)", tf.getText());

		//test that making all references non-primary removes the post comment
		transactionID = program.startTransaction("no_primary_refs");
		try {
			refManager.setPrimary(ref2, false);
			refManager.setPrimary(ref1, false);
		}
		finally {
			program.endTransaction(transactionID, true);
		}
		assertFalse(cb.goToField(addr("1003000"), PostCommentFieldFactory.FIELD_NAME, 0, 1));

		//test that the other overriding reference types don't add any post comments
		transactionID = program.startTransaction("add_overriding_call_ref");
		try {
			ref2 = refManager.addMemoryReference(addr("1003000"), addr("1004000"),
				RefType.CALL_OVERRIDE_UNCONDITIONAL, SourceType.ANALYSIS, Reference.MNEMONIC);
			refManager.setPrimary(ref2, true);
		}
		finally {
			program.endTransaction(transactionID, true);
		}
		assertFalse(cb.goToField(addr("1003000"), PostCommentFieldFactory.FIELD_NAME, 0, 1));

		transactionID = program.startTransaction("add_overriding_callother_call_ref");
		try {
			ref2 = refManager.addMemoryReference(addr("1003000"), addr("1004000"),
				RefType.CALLOTHER_OVERRIDE_CALL, SourceType.ANALYSIS, Reference.MNEMONIC);
			refManager.setPrimary(ref2, true);
		}
		finally {
			program.endTransaction


 = new IBond.Order[2];
				orders[1] = bond.getOrder();
				changedBonds.put(bond, orders);
			}
			satChecker.saturate(ac);
			for (IBond bond : ac.bonds()) {
				IBond.Order[] orders = changedBonds.get(bond);
				orders[0] = bond.getOrder();
				changedBonds.put(bond, orders);
			}
		}
		if (this.getController2DModel().getAutoUpdateImplicitHydrogens())
			updateImplicitHydrogenCounts();
		if (undoredofactory != null && undoredohandler != null) {
			IUndoRedoable undoredo = undoredofactory.getAdjustBondOrdersEdit(
					changedBonds, Collections.emptyMap(),
					"Adjust Bond Order of Molecules", this);
			undoredohandler.postEdit(undoredo);
		}
	}

	// OK
	public void resetBondOrders() {
		List<IAtomContainer> containersList = ChemModelManipulator
				.getAllAtomContainers(chemModel);
		Iterator<IAtomContainer> iterator = containersList.iterator();
		Map<IBond, IBond.Order[]> changedBonds = new HashMap<IBond, IBond.Order[]>();
		while (iterator.hasNext()) {
			IAtomContainer ac = iterator.next();
			for (IBond bond : ac.bonds()) {
				IBond.Order[] orders = new IBond.Order[2];
				orders[1] = bond.getOrder();
				orders[0] = Order.SINGLE;
				changedBonds.put(bond, orders);
				bond.setOrder(Order.SINGLE);
			}
		}
		if (this.getController2DModel().getAutoUpdateImplicitHydrogens())
			updateImplicitHydrogenCounts();
		if (undoredofactory != null && undoredohandler != null) {
			IUndoRedoable undoredo = undoredofactory.getAdjustBondOrdersEdit(
					changedBonds, Collections.emptyMap(),
					"Reset Bond Order of Molecules", this);
			undoredohandler.postEdit(undoredo);
		}
	}

	// OK
	public void replaceAtom(IAtom atomnew, IAtom atomold) {
		IAtomContainer relevantContainer = ChemModelManipulator
				.getRelevantAtomContainer(chemModel, atomold);
		AtomContainerManipulator.replaceAtomByAtom(relevantContainer, atomold,
				atomnew);
		updateAtom(atomnew);
		structureChanged();
		if (undoredofactory != null && undoredohandler != null) {
			IUndoRedoable undoredo = undoredofactory.getReplaceAtomEdit(
					chemModel, atomold, atomnew, "Replace Atom");
			undoredohandler.postEdit(undoredo);
		}
	}

	/*
	 * (non-Javadoc)
	 *
	 * @seeorg.openscience.cdk.controller.IAtomBondEdits#addSingleElectron(org.
	 * openscience.cdk.interfaces.IAtom)
	 */
	public void addSingleElectron(IAtom atom) {
		IAtomContainer relevantContainer = ChemModelManipulator
				.getRelevantAtomContainer(chemModel, atom);
		ISingleElectron singleElectron = atom.getBuilder().newInstance(ISingleElectron.class,atom);
		relevantContainer.addSingleElectron(singleElectron);
		updateAtom(atom);
		if (undoredofactory != null && undoredohandler != null) {
			IUndoRedoable undoredo = undoredofactory.getSingleElectronEdit(
					relevantContainer, singleElectron, true, this, atom,
					"Add Single Electron");
			undoredohandler.postEdit(undoredo);
		}
	}

	// OK
	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * org.openscience.cdk.controller.IAtomBondEdits#removeSingleElectron(org
	 * .openscience.cdk.


 EmptyCoroutineContext,
        concurrency: ConcurrencyKind = CONCURRENT,
        priority: EventPriority = EventPriority.NORMAL,
        handler: Consumer<E>,
    ): Listener<E> = subscribeInternal(
        eventClass.kotlin,
        createListener0(coroutineContext, concurrency, priority) { event ->
            runInterruptible(Dispatchers.IO) { handler.accept(event) }
            ListeningStatus.LISTENING
        }
    )

    /**
     * Java API. 查看 [subscribe] 获取更多信息.
     *
     * ```java
     * eventChannel.subscribe(GroupMessageEvent.class, (event) -> {
     *     return ListeningStatus.LISTENING;
     * });
     * ```
     *
     * @see subscribe
     */
    @JvmOverloads
    @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
    @kotlin.internal.LowPriorityInOverloadResolution
    public fun <E : Event> subscribe(
        eventClass: Class<out E>,
        coroutineContext: CoroutineContext = EmptyCoroutineContext,
        concurrency: ConcurrencyKind = CONCURRENT,
        priority: EventPriority = EventPriority.NORMAL,
        handler: java.util.function.Function<E, ListeningStatus>,
    ): Listener<E> = subscribeInternal(
        eventClass.kotlin,
        createListener0(coroutineContext, concurrency, priority) { event ->
            runInterruptible(Dispatchers.IO) { handler.apply(event) }
        }
    )

    /**
     * Java API. 查看 [subscribeOnce] 获取更多信息.
     *
     * ```java
     * eventChannel.subscribeOnce(GroupMessageEvent.class, (event) -> { });
     * ```
     *
     * @see subscribe
     * @see subscribeOnce
     */
    @JvmOverloads
    @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
    @kotlin.internal.LowPriorityInOverloadResolution
    public fun <E : Event> subscribeOnce(
        eventClass: Class<out E>,
        coroutineContext: CoroutineContext = EmptyCoroutineContext,
        concurrency: ConcurrencyKind = CONCURRENT,
        priority: EventPriority = EventPriority.NORMAL,
        handler: Consumer<E>,
    ): Listener<E> = subscribeInternal(
        eventClass.kotlin,
        createListener0(coroutineContext, concurrency, priority) { event ->
            runInterruptible(Dispatchers.IO) { handler.accept(event) }
            ListeningStatus.STOPPED
        }
    )

    // endregion

    // region deprecated

    /**
     * 创建事件监听并将监听结果发送在 [Channel]. 将返回值 [Channel] [关闭][Channel.close] 时将会同时关闭事件监听.
     *
     * ## 已弃用
     *
     * 请使用 [forwardToChannel] 替代.
     *
     * @param capacity Channel 容量. 详见 [Channel] 构造.
     *
     * @see subscribeAlways
     * @see Channel
     */
    @Deprecated(
        "Please use forwardToChannel instead.",
        replaceWith = ReplaceWith(
            "Channel<BaseEvent>(capacity).apply { forwardToChannel(this, coroutineContext, priority) }",
            "kotlinx.coroutines.channels.Channel"
        ),
        level = DeprecationLevel.ERROR,
    )
    @DeprecatedSinceMirai(warningSince = "2.10", errorSince = "2.14")
    @MiraiExperimentalApi
    public fun asChannel(
        capacity: Int = Channel.RENDEZVOUS,
        coroutineContext: CoroutineContext = EmptyCoroutineContext,
        @Suppress("UNUSED_PARAMETER") concurrency: ConcurrencyKind = CONCURRENT,
        priority: EventPriority = EventPriority.NORMAL,
    ): Channel<out BaseEvent> =
        Channel<BaseEvent>(capacity).apply { forwardToChannel(this, coroutineContext, priority) }

    // endregion

    // region impl

    // protected, to hide from users
    @MiraiInternalApi
    protected


// Once this is done we should move any dotnet-svcutil tool specific logic into this project. For example, command line processesing and help display.
    class GlobalTool
    {
        static int Main(string[] args)
        {
            var arguments = new List<string>(args);

            if (!arguments.Contains("--toolContext", StringComparer.InvariantCultureIgnoreCase) && !arguments.Contains("-tc", StringComparer.InvariantCultureIgnoreCase))
            {
                arguments.Add("--toolContext");
                arguments.Add("Global");
            }

            return Tool.Main(arguments.ToArray());
        }
    }
}


m.unwrap_or(verify::Algorithm::LessTime),
                    thread_limit,
                    mode: match (decode, re_encode) {
                        (true, false) => verify::Mode::Sha1CRC32Decode,
                        (true, true) | (false, true) => verify::Mode::Sha1CRC32DecodeEncode,
                        (false, false) => verify::Mode::Sha1CRC32,
                    },
                    out: stdout(),
                    err: stderr(),
                },
            )
            .map(|_| ())
        }
        SubCommands::CommitGraphVerify(options::CommitGraphVerify { path, statistics }) => {
            use self::core::commitgraph::verify;

            verify::graph_or_file(
                path,
                verify::Context {
                    err: stderr(),
                    out: stdout(),
                    output_statistics: if statistics {
                        Some(core::OutputFormat::Human)
                    } else {
                        None
                    },
                },
            )
            .map(|_| ())
        }
    }
}
mod common;

use common::{test_bind, test_connect, ECHO_SERVER_ADDR, PROXY_ADDR};
use tokio_socks::{
    tcp::{Socks5Listener, Socks5Stream},
    Error,
};

type Result<T> = std::result::Result<T, Error>;

#[test]
fn connect() -> Result<()> {
    let conn = Socks5Stream::connect(PROXY_ADDR, ECHO_SERVER_ADDR)?;
    test_connect(conn)
}

#[test]
fn bind() -> Result<()> {
    let bind = Socks5Listener::bind(PROXY_ADDR, ECHO_SERVER_ADDR)?;
    test_bind(bind)
}
// Copyright 2016 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

//! Type-safe bindings for Zircon sockets.

use {AsHandleRef, HandleBased, Handle, HandleRef, Peered};
use {sys, Status, into_result};

use std::ptr;

/// An object representing a Zircon
/// [socket](https://fuchsia.googlesource.com/zircon/+/master/docs/concepts.md#Message-Passing_Sockets-and-Channels).
///
/// As essentially a subtype of `Handle`, it can be freely interconverted.
#[derive(Debug, Eq, PartialEq)]
pub struct Socket(Handle);
impl_handle_based!(Socket);
impl Peered for Socket {}

/// Options for creating a socket pair.
#[repr(u32)]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum SocketOpts {
    /// Default options.
    Default = 0,
}

impl Default for SocketOpts {
    fn default() -> Self {
        SocketOpts::Default
    }
}

/// Options for writing into a socket.
#[repr(u32)]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum SocketWriteOpts {
    /// Default options.
    Default = 0,
}

impl Default for SocketWriteOpts {
    fn default() -> Self {
        SocketWriteOpts::Default
    }
}

/// Options for reading from a socket.
#[repr(u32)]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum SocketReadOpts {
    /// Default options.
    Default = 0,
}

impl Default for SocketReadOpts {
    fn default() -> Self {
        SocketReadOpts::Default
    }
}

impl Socket {
    /// Create a socket, accessed through a pair of endpoints. Data written
    /// into one may be read from the other.
    ///
    /// Wraps
    /// [zx_socket_create](https://fuchsia.googlesource.com/zircon/+/master/docs/syscalls/socket_create.md).
    pub fn create(opts: SocketOpts) -> Result<(Socket, Socket), Status> {
        unsafe {
            let mut out0 = 0;
            let mut out1 = 0;
            let status = sys::zx_socket_create(opts as u32, &mut out0, &mut out1);
            into_result(status, ||
                (Self::from(Handle(out0)),
                    Self::from(Handle(out1))))
        }
    }


()));
    ($fmt:expr, $($arg:tt)*) => (println!(concat!("bwapi-sys/build.rs:{}: ", $fmt),
    line!(), $($arg)*));
}
macro_rules! log_var (($var:ident) => (log!(concat!(stringify!($var), " = {:?}"), $var)));

fn main() {
    let output_dir = PathBuf::from(&get!("OUT_DIR"));
    let target = &get!("TARGET");
    let build_mode = &get!("PROFILE");
    let cur_dir = PathBuf::from(&get!("CARGO_MANIFEST_DIR"));
    let third_party_dir = cur_dir.join("3rdparty");

    log_var!(output_dir);
    log_var!(target);
    log_var!(build_mode);
    log_var!(cur_dir);
    log_var!(third_party_dir);

    // OpenBW/bwapi is being built by cmake
    let bwapi_build_dir = Config::new(&third_party_dir).build();
    let bwapi_include_dir = cur_dir.join("3rdparty").join("bwapi").join("bwapi").join("include");
    let bwapi_lib_dir = bwapi_build_dir.join("lib");

    log_var!(bwapi_build_dir);
    log_var!(bwapi_include_dir);
    log_var!(bwapi_lib_dir);

    let source_files = vec!["src/lib.rs"];
    cxx_build::bridges(source_files)
        .flag_if_supported("-std=c++17")
        .flag_if_supported("-Wno-unused-parameter")
        .include(bwapi_include_dir.clone())
        .include("src")
        .file("src/lib.cc")
        .compile("bwapi_xi");

    println!("cargo:rerun-if-changed=src/lib.rs");
    println!("cargo:rerun-if-changed=src/lib.cc");
    println!("cargo:rerun-if-changed=src/lib.h");

    println!("cargo:rustc-link-search=native={}", bwapi_lib_dir.display());
    // Phase `BWAPILIB` here stands for the library name (without lib prefix and without .dylib suffix)
    println!("cargo:rustc-link-lib=dylib=BWAPILIB");
}
use std;
use super::super::{ Error, CpError };
use super::super::io;

/// A StdIO-replacement that works with memory-buffers instead of the StdIO-streams
pub struct MemoryIo {
	stdin: (Vec<u8>, usize),
	stdout: (Vec<u8>, usize)
}
impl MemoryIo {
	pub fn new(stdin: Vec<u8>, expected_output_size: usize) -> Self {
		MemoryIo{ stdin: (stdin, 0), stdout: (vec![0u8; expected_output_size], 0) }
	}

	pub fn stdout(&self) -> Vec<u8> {
		// Copy the data in StdOut
		self.stdout.0[.. self.stdout.1].to_vec()
	}
}
impl io::Io for MemoryIo {
	fn read_chunk(&mut self, chunk_buffer: &mut[u8]) -> Result<(usize, bool), Error<CpError>> {
		// Copy the data into `chunk_buffer`
		let to_copy = std::cmp::min(chunk_buffer.len(), self.stdin.0[self.stdin.1 ..].len());
		chunk_buffer[.. to_copy].copy_from_slice(&self.stdin.0[self.stdin.1 .. self.stdin.1 + to_copy]);

		// Update StdIn-buffer and return `(chunk_length, is_last)`
		self.stdin.1 += to_copy;
		Ok((


[0],r.style.position="absolute",r.style.left=r.style.top="0px",r.style.width=r.style.height="100%",r.style["background-color"]=n.lightLine,r.style["z-index"]=30;var i=document.createElement("p");return i.textContent="WebGL is not supported by your browser - visit https://get.webgl.org for more info",i.style.position="relative",i.style.top="50%",i.style.left="50%",i.style.height="30%",i.style.width="50%",i.style.margin="-15% 0 0 -25%",r.appendChild(i),t.container.appendChild(r),t.container.style.background="#FFFFFF",t.container.onclick=function(){window.open("https://get.webgl.org")},!1}},{"../components/color":602}],757:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("./array").isArrayOrTypedArray;r.aggNums=function(t,e,i,o){var s,l;if((!o||o>i.length)&&(o=i.length),n(e)||(e=!1),a(i[0])){for(l=new Array(o),s=0;s<o;s++)l[s]=r.aggNums(t,e,i[s]);i=l}for(s=0;s<o;s++)n(e)?n(i[s])&&(e=t(+e,+i[s])):e=i[s];return e},r.len=function(t){return r.aggNums((function(t){return t+1}),0,t)},r.mean=function(t,e){return e||(e=r.len(t)),r.aggNums((function(t,e){return t+e}),0,t)/e},r.midRange=function(t){if(void 0!==t&&0!==t.length)return(r.aggNums(Math.max,null,t)+r.aggNums(Math.min,null,t))/2},r.variance=function(t,e,a){return e||(e=r.len(t)),n(a)||(a=r.mean(t,e)),r.aggNums((function(t,e){return t+Math.pow(e-a,2)}),0,t)/e},r.stdev=function(t,e,n){return Math.sqrt(r.variance(t,e,n))},r.median=function(t){var e=t.slice().sort();return r.interp(e,.5)},r.interp=function(t,e){if(!n(e))throw"n should be a finite number";if((e=e*t.length-.5)<0)return t[0];if(e>t.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"./array":718,"fast-isnumeric":237}],758:[function(t,e,r){"use strict";var n=t("color-normalize");e.exports=function(t){return t?n(t):[0,0,0,1]}},{"color-normalize":122}],759:[function(t,e,r){"use strict";var n=t("d3"),a=t("../lib"),i=t("../constants/xmlns_namespaces"),o=t("../constants/alignment").LINE_SPACING;function s(t,e){return t.node().getBoundingClientRect()[e]}var l=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,M){var A=t.text(),E=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&A.match(l),C=n.select(t.node().parentNode);if(!C.empty()){var L=t.attr("class")?t.attr("class").split(" ")[0]:"text";return L+="-math",C.selectAll("svg."+L).remove(


DCavecompLoopFv"

.fn "@24@__dt__Q28Morimura16TChallengeResultFv", weak
/* 80399824 00396764  38 63 FF E8 */	addi r3, r3, -24


     if ((((h[(D + 36) >> 0] << 8) | h[(D + 37) >> 0]) & 65535) > 257) {
              j = (a + 52) | 0;
              k = (a + 56) | 0;
              e = (a + 48) | 0;
              g = 0;
              i = 0;
              while (1) {
                f[A >> 2] = 0;
                _k(y, c) | 0;
                i = ((f[y >> 2] | 0) + i) | 0;
                f[A >> 2] = i;
                d = f[j >> 2] | 0;
                if ((d | 0) == (f[k >> 2] | 0)) hk(e, A);
                else {
                  f[d >> 2] = i;
                  f[j >> 2] = d + 4;
                }
                g = (g + 1) | 0;
                if (g >>> 0 >= (f[B >> 2] | 0) >>> 0) {
                  z = 54;
                  break b;
                }
              }
            }
            n = (c + 8) | 0;
            o = (c + 16) | 0;
            l = (a + 52) | 0;
            m = (a + 56) | 0;
            j = (a + 48) | 0;
            k = 0;
            while (1) {
              f[A >> 2] = 0;
              a = n;
              D = f[a >> 2] | 0;
              a = f[(a + 4) >> 2] | 0;
              e = o;
              d = f[e >> 2] | 0;
              e = sq(d | 0, f[(e + 4) >> 2] | 0, 4, 0) | 0;
              g = I;
              if (
                ((a | 0) < (g | 0)) |
                (((a | 0) == (g | 0)) & (D >>> 0 < e >>> 0))
              )
                break;
              i = ((f[c >> 2] | 0) + d) | 0;
              i =
                h[i >> 0] |
                (h[(i + 1) >> 0] << 8) |
                (h[(i + 2) >> 0] << 16) |
                (h[(i + 3) >> 0] << 24);
              f[A >> 2] = i;
              d = o;
              f[d >> 2] = e;
              f[(d + 4) >> 2] = g;
              d = f[l >> 2] | 0;
              if ((d | 0) == (f[m >> 2] | 0)) hk(j, A);
              else {
                f[d >> 2] = i;
                f[l >> 2] = d + 4;
              }
              k = (k + 1) | 0;
              if (k >>> 0 >= (f[B >> 2] | 0) >>> 0) {
                z = 54;
                break b;
              }
            }
            d = -1;
          }
      while (0);
      if ((z | 0) == 54) d = f[(c + 16) >> 2] | 0;
      D = d;
      u = C;
      return D | 0;
    }
    function Mb(a, c, e) {
      a = a | 0;
      c = c | 0;
      e = e | 0;
      var g = 0,
        i = 0,
        j = 0,
        k = 0,
        l = 0,
        m = 0,
        o = La,
        p = La,
        q = 0,
        r = 0,
        s = 0,
        t = 0,
        v = 0,
        w = 0,
        x = 0,
        y = 0,
        z = 0,
        A = 0,
        B = 0,
        C = 0,
        D = 0,
        E = 0,
        F = 0,
        G = 0,
        H = 0,


1.541-.443 1.909-1.329l1.938.969c-.131.234-1.337 2.436-4.068 2.436-1.418 0-4.622-.617-4.622-4.816 0-3.667 2.686-4.816 4.539-4.816 1.919-.001 3.286.747 4.097 2.241zM15.972.503C7.046.503.5 7.694.5 16.003c0 8.656 7.1 15.5 15.472 15.5 8.121 0 15.528-6.304 15.528-15.5 0-8.617-6.664-15.5-15.528-15.5zm.055 28.176c-7.034 0-12.731-5.815-12.731-12.676 0-6.589 5.339-12.704 12.732-12.704 7.033 0 12.676 5.591 12.676 12.704 0 7.606-6.23 12.676-12.678 12.676z"/></svg>';
  static const String creative_commons_by =
      '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path fill="currentColor" d="M20.181 12.15v6.338h-1.768v7.531h-4.819v-7.525h-1.769V12.15c0-.275.1-.512.288-.706a.967.967 0 01.706-.294h6.369c.256 0 .488.1.694.294.194.2.3.431.3.706zm-6.344-3.981c0-1.456.719-2.188 2.156-2.188s2.156.731 2.156 2.188c0 1.438-.719 2.156-2.156 2.156s-2.156-.719-2.156-2.156zM15.975.5C24.837.5 31.5 7.381 31.5 16c0 9.194-7.406 15.5-15.525 15.5C7.6 31.5.5 24.656.5 16 .5 7.694 7.044.5 15.975.5zm.05 2.794C8.638 3.294 3.294 9.413 3.294 16c0 6.863 5.7 12.675 12.731 12.675 6.45 0 12.675-5.069 12.675-12.675.006-7.113-5.637-12.706-12.675-12.706z"/></svg>';
  static const String creative_commons_nc =
      '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path fill="currentColor" d="M15.975.5C24.712.5 31.5 7.244 31.5 16c0 9.2-7.406 15.5-15.525 15.5C7.569 31.5.5 24.575.5 16 .5 7.694 7.044.5 15.975.5zM3.988 11.819c-.463 1.275-.694 2.669-.694 4.181 0 6.931 5.756 12.65 12.731 12.65 7.65 0 11.075-6.362 11.156-6.506l-5.837-2.6c-.481 2.319-2.575 3.313-4.262 3.463v2.381h-1.8v-2.387c-1.719-.019-3.288-.637-4.706-1.856l2.131-2.156c1.981 1.837 5.4 1.988 5.4-.137a1


		if (e.NameWithoutLocale.IsEquivalentTo(npcPath))
			{
				e.LoadFrom(() => new Dictionary<string, EnvelopeData>(), StardewModdingAPI.Events.AssetLoadPriority.Exclusive);
			}
			else if (e.NameWithoutLocale.IsEquivalentTo(mailPath))
			{
				e.LoadFrom(() => defaultMailSenders, StardewModdingAPI.Events.AssetLoadPriority.Exclusive);
			}
		}

		private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e)
		{
			var phoneAPI = Helper.ModRegistry.GetApi<IMobilePhoneApi>("aedenthorn.MobilePhone");
			if (phoneAPI != null)
			{
				phoneAPI.AddApp("aedenthorn.MailboxMenu", "Mailbox", OpenMenu, Helper.ModContent.Load<Texture2D>(Path.Combine("assets", "icon.png")));
			}
			// get Generic Mod Config Menu's API (if it's installed)
			var configMenu = Helper.ModRegistry.GetApi<IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");
			if (configMenu is null)
				return;

			// register mod
			configMenu.Register(
				mod: ModManifest,
				reset: () => Config = new ModConfig(),
				save: () => Helper.WriteConfig(Config)
			);

			configMenu.AddBoolOption(
				mod: ModManifest,
				name: () => "Mod Enabled",
				getValue: () => Config.ModEnabled,
				setValue: value => Config.ModEnabled = value
			);
			configMenu.AddBoolOption(
				mod: ModManifest,
				name: () => "Click Mailbox To Open",
				getValue: () => Config.MenuOnMailbox,
				setValue: value => Config.MenuOnMailbox = value
			);
			configMenu.AddKeybind(
				mod: ModManifest,
				name: () => "Menu Key",
				getValue: () => Config.MenuKey,
				setValue: value => Config.MenuKey = value
			);
			configMenu.AddKeybind(
				mod: ModManifest,
				name: () => "Mod Key",
				tooltip: () => "Hold this down while interacting with the mailbox",
				getValue: () => Config.ModKey,
				setValue: value => Config.ModKey = value
			);
			configMenu.AddTextOption(
				mod: ModManifest,
				name: () => "Inbox Text",
				getValue: () => Config.InboxText,
				setValue: value => Config.InboxText = value
			);
			configMenu.AddTextOption(
				mod: ModManifest,
				name: () => "Archive Text",
				getValue: () => Config.ArchiveText,
				setValue: value => Config.ArchiveText = value
			);
			configMenu.AddNumberOption(
				mod: ModManifest,
				name: () => "Window Width",
				getValue: () => Config.WindowWidth,
				setValue: value => Config.WindowWidth = value
			);
			configMenu.AddNumberOption(
				mod: ModManifest,
				name: () => "Window Height",
				getValue: () => Config.WindowHeight,
				setValue: value => Config.WindowHeight = value
			);
			configMenu.AddNumberOption(
				mod: ModManifest,
				name: () => "Grid Columns",
				getValue: () => Config.GridColumns,
				setValue: value => Config.GridColumns = value
			);
			configMenu.AddNumberOption(
				mod: ModManifest,
				name: () => "Envelope Width",
				getValue: () => Config.EnvelopeWidth,
				setValue: value => Config.EnvelopeWidth = value
			);
			configMenu.AddNumberOption(
				mod: ModManifest,
				name: () => "Envelope Height",
				getValue: () => Config.EnvelopeHeight,
				setValue: value => Config.EnvelopeHeight = value
			);
			configMenu.AddNumberOption(
				mod: ModManifest,
				name: () => "Side Width",


e-mode .vc_layout-switcher .l_14_14_14_14{background-image:url(../vc/row_layouts/14_14_14_14.gif)}.compose-mode .vc_layout-switcher .l_14_34{background-image:url(../vc/row_layouts/14_34.gif)}.compose-mode .vc_layout-switcher .l_14_12_14{background-image:url(../vc/row_layouts/14_12_14.gif)}.compose-mode .vc_layout-switcher .l_56_16{background-image:url(../vc/row_layouts/56_16.gif)}.compose-mode .vc_layout-switcher .l_16_46_16{background-image:url(../vc/row_layouts/14_46_16.gif)}.compose-mode .vc_layout-switcher .l_16_16_16_12{background-image:url(../vc/row_layouts/16_16_16_12.gif)}.compose-mode .vc_layout-switcher .l_16_16_16_16_16_16{background-image:url(../vc/row_layouts/16_16_16_16_16_16.gif)}.compose-mode .vc_controls-visible{opacity:1!important;filter:alpha(opacity=100)!important;visibility:visible}.compose-mode .vc_control-container{background:#F4AF1C;border-color:#F4AF1C}.compose-mode .vc_control-container .vc_control-btn .vc_btn-content:hover{background-color:#AD790A}.compose-mode .vc_controls-content-widget{background:#0772CE;border-color:#0772CE;top:-17px!important;direction:ltr!important}.compose-mode .vc_controls-content-widget .vc_btn-content:hover{background-color:#00447F}.compose-mode .vc_element-name .vc_btn-content{height:30px}.compose-mode .vc_vc_accordion,.compose-mode .vc_vc_row_inner,.compose-mode .vc_vc_tabs,.compose-mode .vc_vc_tour{margin-top:0!important}.compose-mode .vc_col-sm-1 .controls-out-tr,.compose-mode .vc_col-sm-2 .controls-out-tr,.compose-mode .vc_col-sm-3 .controls-out-tr,.compose-mode .vc_col-sm-4 .controls-out-tr{z-index:1003;left:-1px;top:-30px}.compose-mode .vc_col-sm-1 .vc_vc_tabs .controls-out-tr,.compose-mode .vc_col-sm-2 .vc_vc_tabs .controls-out-tr,.compose-mode .vc_col-sm-3 .vc_vc_tabs .controls-out-tr,.compose-mode .vc_col-sm-4 .vc_vc_tabs .controls-out-tr{top:-64px}.compose-mode .vc_vc_row>.vc_parallax,.compose-mode .vc_vc_row>[data-vc-full-width=true],.compose-mode .vc_vc_row_inner,.compose-mode .vc_vc_section>.vc_parallax,.compose-mode .vc_vc_section>[data-vc-full-width=true],.compose-mode .vc_vc_video{padding-top:32px}.compose-mode .vc_vc_raw_js .wpb_wrapper{height:50px;background:url(../vc/fe/js_icon.png) center center no-repeat}.vc_content .compose-mode .vc_vc_tab:after,.vc_content .compose-mode .vc_vc_tab:before{display:table;content:""}.compose-mode .vc_vc_accordion_tab>.vc_controls .control-btn-append,.compose-mode .vc_vc_tab>.vc_controls .vc_control-btn-append{display:none}.vc_content .compose-mode .vc_vc_tab:after{clear


  ///     decoded_seed,
    ///     validator,
    /// ) {
    ///     Ok((public, private)) => Some((public, private)),
    ///     Err(e) => match e {
    ///         XRPLKeypairsException::InvalidSignature => None,
    ///         XRPLKeypairsException::ED25519Error => None,
    ///         XRPLKeypairsException::UnsupportedValidatorAlgorithm { expected: _ } => None,
    ///         _ => None,
    ///     },
    /// };
    ///
    /// assert_eq!(Some(tuple), derivation);
    /// ```
    fn derive_keypair(
        &self,
        decoded_seed: &[u8],
        is_validator: bool,
    ) -> Result<(String, String), XRPLKeypairsException> {
        if is_validator {
            Err(XRPLKeypairsException::UnsupportedValidatorAlgorithm {
                expected: CryptoAlgorithm::ED25519,
            })
        } else {
            let raw_private = sha512_first_half(decoded_seed);
            let private = ed25519_dalek::SecretKey::from_bytes(&raw_private)?;
            let public = ed25519_dalek::PublicKey::from(&private);

            Ok(Ed25519::_format_keys(public, private))
        }
    }

    /// Signs a message using a given private key.
    /// * `message` - Text about foo.
    /// * `private_key` - Text about bar.
    ///
    /// # Examples
    ///
    /// ## Basic usage
    ///
    /// ```
    /// use xrpl::core::keypairs::Ed25519;
    /// use xrpl::core::keypairs::exceptions::XRPLKeypairsException;
    /// use xrpl::core::keypairs::CryptoImplementation;
    ///
    /// let message: &[u8] = "test message".as_bytes();
    /// let private_key: &str = "<KEY>\
    ///                          <KEY>";
    /// let signature: Vec<u8> = vec![
    ///     203, 25, 158, 27, 253, 78, 61, 170, 16, 94, 72, 50, 238, 223,
    ///     163, 100, 19, 225, 244, 66, 5,228, 239, 185, 226, 126, 130, 96,
    ///     68, 194, 30, 62, 46, 132, 139, 188, 129, 149, 232, 149, 155,
    ///     173, 248, 135, 89, 155, 115, 16, 173, 27, 112, 71, 239, 17,
    ///     182, 130, 224, 208, 104, 247, 55,73, 117, 14,
    /// ];
    ///
    /// let signing: Option<Vec<u8>> = match Ed25519.sign(
    ///     message,
    ///     private_key,
    /// ) {
    ///     Ok(signature) => Some(signature),
    ///     Err(e) => match e {
    ///         XRPLKeypairsException::ED25519Error => None,
    ///         _ => None,
    ///     },
    /// };
    ///
    /// assert_eq!(Some(signature), signing);
    /// ```
    fn sign(&self, message: &[u8], private_key: &str) -> Result<Vec<u8>, XRPLKeypairsException> {
        let raw_private = hex::decode(&private_key[ED25519_PREFIX.len()..])?;
        let private = ed25519_dalek::SecretKey::from_bytes(&raw_private)?;
        let expanded_private = ed25519_dalek::ExpandedSecretKey::from(&private);
        let public = ed25519_dalek::PublicKey::from(&private);
        let signature: ed25519_dalek::Signature = expanded_private.sign(message, &public);

        Ok(signature.to_


_rc.borrow().is_valid() {
            offs_rc.borrow().copy(5, 5, WIDTH - 10, HEIGHT - 10, 0, 0);
        } else {
            offs_rc.borrow_mut().begin();
            set_draw_color(Color::White);
            draw_rectf(0, 0, WIDTH - 10, HEIGHT - 10);
            offs_rc.borrow_mut().end();
        }
    });
    {
        let site1 = [-5165, -5162];
        let site2 = [-5404, -5134];
        let site3 = [-5011, -5195, -5404, -5134];
        let c1 = [-4909.985314685315, -1951.249650349650]; //lx=83.691104228608
        let c2 = [-4909.985314685315, -1951.249650349650]; //l_x=97.17800560721074

        // site3.point0 -> c
        let v_3_c = ((c1[0] - site3[0] as f64), (c1[1] - site3[1] as f64));
        // site3.point0 -> site3.point1
        let v_3 = ((site3[2] - site3[0]) as f64, (site3[3] - site3[1]) as f64);

        let dot = v_3_c.0 * v_3.0 + v_3_c.1 * v_3.1 / (v_3.0 * v_3.0 + v_3.1 * v_3.1);
        println!("dot:{:?}", dot);
        use geo::algorithm::euclidean_distance::*;
        let c = geo::Coordinate { x: c1[0], y: c1[1] };
        println!(
            "site1 dist:{:?}",
            c.euclidean_distance(&geo::Coordinate {
                x: site1[0] as f64,
                y: site1[1] as f64
            })
        );
        println!(
            "site2 dist:{:?}",
            c.euclidean_distance(&geo::Coordinate {
                x: site2[0] as f64,
                y: site2[1] as f64
            })
        );
        println!(
            "site2 dist:{:?}",
            c.euclidean_distance(&geo::Line::new(
                geo::Coordinate {
                    x: site3[0] as f64,
                    y: site3[1] as f64
                },
                geo::Coordinate {
                    x: site3[2] as f64,
                    y: site3[3] as f64
                }
            ),)
        );

        let d_aabb = boostvoronoi::visual_utils::Aabb2::<i64, f64>::new_from_i32(0, 0, 800, 600);
        let mut s_aabb = boostvoronoi::visual_utils::Aabb2::<i64, f64>::default();
        s_aabb.update_i64(site1[0], site1[1]);
        s_aabb.update_i64(site2[0], site2[1]);
        s_aabb.update_i64(site3[0], site3[1]);
        s_aabb.update_i64(site3[2], site3[3]);
        s_aabb.update_f64(c1[0], c1[1]);
        s_aabb.update_f64(c2[0], c2[1]);
        let mut affine =
            boostvoronoi::visual_utils::SimpleAffine::<i64, f64>::new(&s_aabb, &d_aabb).unwrap();
        // flip y
        affine.scale = [affine.scale[0], -affine.scale[1]];
        affine.zoom(0.9);
        let affine


r Berlin – Metalcore ist längst Teil einer globalen Klangsprache geworden, in der sich Wut, Hoffnung und Gemeinschaft auf unzählige Weisen ausdrücken lassen.

## Wurzeln in Aufruhr: Wie Metalcore Klanglandschaften und Generationen umgestaltete

### Vom Grenzgang zum globalen Vorbild: Metalcore prägt Identität und Musikästhetik

Als *Metalcore* Anfang der **1990er Jahre** im Schatten urbaner US-Städte zündete, ahnte wohl niemand, welchen langen Nachhall diese explosive Mischung haben würde. Was als Folge hitziger Debatten und musikalischer Grenzüberschreitungen begann, ist heute ein globales Phänomen, das weit mehr Spuren hinterlässt als nur die Wucht auf Konzerten. Besonders die Verbindung aus kompromissloser Härte und emotionaler Offenheit formte eine neue Klangästhetik, die Musikern aus verschiedensten Stilrichtungen Türen öffnete.

Viele der stilprägenden Elemente – etwa die tiefgestimmten Gitarren, abrupten Tempowechsel oder die berühmten „Breakdowns“, bei denen sich Song, Band und Publikum in roher Energie entladen – fanden nach und nach auch außerhalb des *Metalcore* Anklang. Die Szene selbst war dabei nie abgeschlossen, sondern zeigte sich immer offen für neue Strömungen. Bands wie **Killswitch Engage** und **Underoath** prägten mit ihrem Wechselspiel aus aggressiven Shouts und eingängigen Melodien die Richtung ganzer Musikszenen. So beeinflussten sie nicht nur verwandte Genres wie *Post-Hardcore*, sondern hinterließen ihre Spuren sogar in Bereichen wie *Emo*, *Alternative Rock* oder modernen Pop-Produktionen.

Bereits im Übergang zu den **2000er Jahren** ließen sich zunehmend elektronische Einflüsse erkennen. Labels wie **Solid State Records** oder **Trustkill Records** experimentierten gezielt mit Genregrenzen und förderten Acts, die Synthesizer und Computerprogrammierung für neue Soundlandschaften einsetzten. Dieses stilistische Grenzgängertum machte den Eindruck des *Metalcore* so nachhaltig, dass Musiker und Produzenten unterschiedlicher Herkunft Inspiration aus der Szene ziehen. Nicht zuletzt entstehen daraus neue Subgenres wie der *Electronicore*, der den Geist des *Metalcore* um digitale Klangfarben erweitert.

### Vom musikalischen Ausdruck zur gesellschaftlichen Aussagekraft: Metalcore als Sprachrohr

Doch der Einfluss des *Metalcore* erschöpft sich nicht in kreativen Zutaten für musikalische Stilrichtungen. Vielmehr ist der gesellschaftliche Nachhall ebenso zentral: Hier entstand eine Plattform, auf der sich junge Menschen Gehör verschaffen konnten – teils gegen bestehende Normen, teils für eigene Werte. Die Texte gehen oft weit über gängige Themen von Rebellion und Wut hinaus. Sie verhandeln Fragen von Identität, psychischer Gesundheit oder politischem Widerstand.

Ein besonders prägnantes Beispiel liefert die Band **Architects**, deren Lyrik explizit auf gesellschaftliche Missstände aufmerksam macht – etwa den Umgang mit Klimawandel oder die Abgründe moderner Gesellschaften. Die Ermutigung, laut und unbequem zu sein, formte nach und nach nicht nur das Selbstbewusstsein zahlloser Fans, sondern motivierte zu kollektiven Aktionen, sozialen Projekten und politischem


<', -10.0)
logic.eng1OilTmpConf01 = newLeadingEdgeDelayedConfirmation('eng1OilTmpConf01', 60.0)
logic.eng1OilTmpSRS01 = newSRlatchResetPriority('eng1OilTmpSRS01')

logic.eng2OilTmpThreshold01 = newThreshold('eng2OilTmpThreshold01', '<', 50.0)
logic.eng2OilTmpThreshold02 = newThreshold('eng2OilTmpThreshold02', '<', -10.0)
logic.eng2OilTmpConf01 = newLeadingEdgeDelayedConfirmation('eng2OilTmpConf01', 60.0)
logic.eng2OilTmpSRS01 = newSRlatchResetPriority('eng2OilTmpSRS01')

logic.cabRdyConf01 = newLeadingEdgeDelayedConfirmation('cabRdyConf01', 10.0)

logic.iceNotDetConf01 = newLeadingEdgeDelayedConfirmation('iceNotDetConf01', 130.0)
logic.iceNotDetConf02 = newLeadingEdgeDelayedConfirmation('iceNotDetConf02', 60.0)

logic.eng1RevUnlkConf01 = newFallingEdgeDelayedConfirmation('eng1RevUnlkConf01', 8.0)
logic.eng2RevUnlkConf01 = newFallingEdgeDelayedConfirmation('eng2RevUnlkConf01', 8.0)

logic.stdAltiDiscrepancyConf01 = newLeadingEdgeDelayedConfirmation('alti_discrepancy', 5.0)
logic.stdAltiDiscrepancyConf02 = newLeadingEdgeDelayedConfirmation('alti_discrepancy', 5.0)

logic.aiVlvClsdFltConf01 = newLeadingEdgeDelayedConfirmation('aiVlvClsdFltConf01', 15.0)
logic.aiVlvClsdFltConf02 = newLeadingEdgeDelayedConfirmation('aiVlvClsdFltConf02', 25.0)
logic.aiVlvClsdFltConf03 = newLeadingEdgeDelayedConfirmation('aiVlvClsdFltConf03', 2.0)
logic.aiVlvClsdFltPulse01 = newLeadingEdgePulse('aiVlvClsdFltPulse01')
logic.aiVlvClsdFltsrS01 = newSRlatchSetPriority('aiVlvClsdFltsrS01')

logic.xbleedVlvFltConf01 = newLeadingEdgeDelayedConfirmation('xbleedVlvFltConf01', 10.0)
logic.xbleedVlvFltConf02 = newFallingEdgeDelayedConfirmation('xbleedVlvFltConf02', 10.0)
logic.xbleedVlvFltConf03 = newFallingEdgeDelayedConfirmation('xbleedVlvFltConf03', 15.0)

logic.eng1NacVlvClsdConf01 = newLeadingEdgeDelayedConfirmation('eng1NacVlvClsdConf01', 10.0)

logic.eng2NacVlvClsdConf01 = newLeadingEdgeDelayedConfirmation('eng2NacVlvClsdConf01', 10.0)

logic.lrElevFltConf01 = newLeadingEdgeDelayedConfirmation('lrElevFltConf01', 0.3)

logic.eng1hungStrtPulse01 = newLeadingEdgePulse('eng1hungStrtPulse01')
logic.eng1hungStrtSRR01 = newSRlatchResetPriority('eng1hungStrtSRR01')

logic.eng2hungStrtPulse01 = newLeadingEdgePulse('eng2hungStrtPulse01')
logic.eng2hungStrtSRR01 = newSRlatchResetPriority('eng2hungStrtSRR01')

--*************************************************************************************--
--** 				             FIND X-PLANE DATAREFS            			    	 **--
--*************************************************************************************--

--****************************************************************


    return ShapeBpmnElementKind.SUB_PROCESS === kind;
  }

  public static isBoundaryEvent(kind: ShapeBpmnElementKind): boolean {
    return ShapeBpmnElementKind.EVENT_BOUNDARY === kind;
  }

  public static isStartEvent(kind: ShapeBpmnElementKind): boolean {
    return ShapeBpmnElementKind.EVENT_START === kind;
  }

  public static canHaveNoneEvent(kind: ShapeBpmnElementKind): boolean {
    return ShapeBpmnElementKind.EVENT_INTERMEDIATE_THROW === kind || ShapeBpmnElementKind.EVENT_END === kind || ShapeBpmnElementKind.EVENT_START === kind;
  }

  public static isActivity(kind: ShapeBpmnElementKind): boolean {
    return this.ACTIVITY_KINDS.includes(kind);
  }

  public static isWithDefaultSequenceFlow(kind: ShapeBpmnElementKind): boolean {
    return this.FLOWNODE_WITH_DEFAULT_SEQUENCE_FLOW_KINDS.includes(kind);
  }

  // TODO should we clone the array to avoid modifications of this ref array by client code?
  // topLevelBpmnEventKinds to not mixed with the bpmnEventKinds that currently are the list of non None event subtypes
  public static topLevelBpmnEventKinds(): ShapeBpmnElementKind[] {
    return this.EVENT_KINDS;
  }

  public static activityKinds(): ShapeBpmnElementKind[] {
    return this.ACTIVITY_KINDS;
  }

  public static taskKinds(): ShapeBpmnElementKind[] {
    return this.TASK_KINDS;
  }

  public static gatewayKinds(): ShapeBpmnElementKind[] {
    return this.GATEWAY_KINDS;
  }

  public static flowNodeKinds(): ShapeBpmnElementKind[] {
    return Object.values(ShapeBpmnElementKind).filter(kind => {
      return !ShapeUtil.isPoolOrLane(kind);
    });
  }

  public static isPoolOrLane(kind: ShapeBpmnElementKind): boolean {
    return kind == ShapeBpmnElementKind.POOL || kind == ShapeBpmnElementKind.LANE;
  }
}
import { GraphQLResolveInfo } from 'graphql';
import { GraphQLRateLimitConfig, GraphQLRateLimitDirectiveArgs } from './types';
/**
 * Returns a string key for the given field + args. With no identityArgs are provided, just the fieldName
 * will be used for the key. If an array of resolveArgs are provided, the values of those will be built
 * into the key.
 *
 * Example:
 * 	(fieldName = 'books', identityArgs: ['id', 'title'], resolveArgs: { id: 1, title: 'Foo', subTitle: 'Bar' })
 *  	=> books:1:Foo
 *
 * @param fieldName
 * @param identityArgs
 * @param resolveArgs
 */
declare const getFieldIdentity: (fieldName: string, identityArgs: readonly string[], resolveArgs: any) => string;
/**
 * This is the core rate limiting logic function, APIs (directive, sheild etc.)
 * can wrap this or it can be used directly in resolvers.
 * @param userConfig - global (usually app-wide) rate limiting config
 */
declare const getGraphQLRateLimiter: (userConfig: GraphQLRateLimitConfig) => ({ args, context, info }: {
    parent: any;
    args: Record<string, any>;
    context: any;
    info: GraphQLResolveInfo;
}, { arrayLengthField, identityArgs, max, window, message }: GraphQLRateLimitDirectiveArgs) => Promise<{
    errorMessage: string | undefined;
    reset: () => void | Promise<void>;
}>;
export { getGraphQLRateLimiter, getFieldIdentity };
import * as fs from "fs";
import * as minimatch from "minimatch";

/**
 * Retrieves command names within a directory.
 *
 * @param rootPath   An absolute path to a command's tests folder.
 * @param inclusions   Command groups to only include, if not all.
 * @returns Command names within the directory.
 */
export const findBudgieFilesUnder = (rootPath:


�荐一部符合我的口味的电影。|
|历史事件|请问1997年7月1日发生了什么重大历史事件？|
|交通出行|从北京到上海有哪些交通方式可以选择？请列举至少两种。|
|学术论文写作|如何提高学术论文的写作质量？|
|电商平台|电商平台如何保障消费者的权益？|
|社交媒体|社交媒体对个人和社会的影响有哪些？|
|自然灾害|如何在自然灾害发生时保护自己和他人的生命安全？|
|金融投资|如何进行有效且安全的金融投资？|
|面试准备|面试前应该如何准备自己？|
|职场沟通|在职场中如何进行有效的沟通？|
|健康养生|如何保持身体健康并预防常见疾病？|
|教育改革|如何开展教育改革以提高教育质量？|
|旅游规划|如何规划一次完美的旅行？|
| 健康饮食 | 你能否提供一些健康的早餐选择？|
| 生活方式 | 如何调整生活方式以更好地保持健康？ |
| 投资理财 | 投资股市需要哪些技能和知识？ |
| 人工智能 | 未来会有哪些领域将受益于人工智能技术？ |
| 教育改革 | 教育改革需要实现哪些重要目标？ |
| 环境保护 | 采取哪些措施可以帮助我们更好地保护环境？ |
| 动物保护 | 哪些措施可以促进动物保护事业的发展？ |
| 医疗卫生 | 如何预防感冒和流感等常见疾病？ |
| 科技创新 | 新兴科技如何推动经济增长和社会发展？ |
| 社交礼仪 | 在商务场合中，如何表现出优秀的社交礼仪？ |
| 电影推荐 | 你能否推荐一些年轻人喜欢的电影？ |
| 美食分类 | 请根据菜品的特点，将川菜、湘菜和粤菜分别归类。 |
| 新冠肺炎症状识别 | 我有咳嗽和发热，是否可能感染了新型冠状病毒？ |
| 疫苗种类了解 | 目前市场上有哪些主要类型的新冠疫苗？它们的区别是什么？ |
| 古代文学 | 能否介绍一些中国古代文学名著？ |
| 生物多样性保护 | 生物多样性保护为何如此重


title }}

      {% else %}

{{ post.title }}

{{ post.date | date: "%B %d, %Y" }}

{{ post.description | strip_html | truncate: 500 }}

      {% endif %}

    {% endfor %}

    {% include _footer.html %}

{% include _scripts.html %}

<!doctype html>

{% include _head.html %}

{% if page.og_image %}<meta property="og:image" content="{{ page.og_image }}">{% endif %}

{% include _browser-upgrade.html %}

{% include _navigation.html %}

{% if page.image.feature %}

  {% if page.image.credit %}
    Photo Credit: {{ page.image.credit }}
  {% endif %}

{% endif %}

    {% include _author-bio.html %}

      {% if page.link %}

{{ page.title }}

      {% else %}

{{ page.title }}

      {% endif %}

      {{ content }}

          {% include _author-bio.html %}

{{ page.title }} was published on <time datetime="{{ page.date | date_to_xmlschema }}">{{ page.date | date: "%B %d, %Y" }}</time>{% if page.modified %} and last modified on <time datetime="{{ page.modified | date: "%Y-%m-%d" }}">{{ page.modified | date: "%B %d, %Y" }}</time>{% endif %}.

  {% if site.owner.disqus-shortname and page.comments == true %}

  {% endif %}


anel panel-default">

热门文章

4月26日|最高速度21.9M/S，2025最新Hysteria2免费节点高速订阅链接，便宜机场推荐

兽用疫苗稀释液能冷冻吗多久（兽用活疫苗稀释后多久内使用）

Springboot 使用Maven实现多环境打包

3月2日|最高速度23M/S，2025最新Hysteria2免费节点高速订阅链接，便宜机场推荐

3月8日|最高速度22.8M/S，2025最新Hysteria2免费节点高速订阅链接，便宜机场推荐

打过疫苗的猫抓了一下出了点血要打疫苗吗（打过疫苗的猫抓了一下出了点血要打疫苗吗有事吗）

益宠宠物医院官方店 益宠宠物医院官方店铺

3月27日|最高速度19.6M/S，2025最新Hysteria2免费节点高速订阅链接，便宜机场推荐

南京宠物猫领养中心在哪里 南京宠物猫领养中心在哪里啊

长沙宠


的孙子要紧？”

没用多大的力气，只是提醒了下他“宝眷都已安排妥当”，这个老奸巨猾的前捕头便将张天波的下落供认出来了。

张天波的确在孙大彪那里――不过他混得很不如意。内应没做成，县城没打开，张天波也就成了无用之人，被晾在一旁。

至于张天波的家眷，还在辛劳楠的庄子上。不过那里已经有了另一支人马。名为保护，实则是看守。

“什么人马？”

“小老也不知道。”李双快垂头丧气道，“据闻是一个大明的官儿带来的。为得是要挟张天波。”

“我们从他口中了解到了辛劳楠的庄子所在，派人去侦察了，大约很快就会有消息回来。”

侦察兵很快便带来了消息：辛劳楠的庄子上果然有重兵把守，四处戒备森严。

“庄子所在地方甚是偏僻，地形又险。并不好找。我们没能摸进去，不过从附近的村落打听到了消息：那个辛庄主原就是有海底的人，手下有二三十个喽啰。前不久，庄上来了一支人马将整个庄子都接管了。如今庄上有一百多人――都是外路口音，听说是从广宁县来得！”

“这么说李双快的供词是对得！张天波的家眷的确在辛劳楠的庄子上！”罗奕铭一拳捶在桌子上。

“如果有百多人把守，这抓人可就得出动部队了。”阵焕说，“我们连可以马上出发！”

“我看我们不必去抓张天波的家眷了。”尤辞仁说，“敌人已经防着我们这一手了。我们就算把张天波的家眷抢到手，这消息瞒不住任何人。张天波立马就会成为‘废物’，直接被处置掉的可能性很大……不过，这件事倒是有些蹊跷。”

大家都看着尤辞仁。

“张天波内应失败之后，已经是无足轻重的人了。为什么敌人要在辛劳楠的庄子上还放上一百多人？”

“你是说……”

“这个庄子怕是不止是用来藏家眷这么简单。”尤辞仁说，“搞不好，是敌人的秘密巢穴之一……侦察员说了，新来得人马是从广宁来得――现在县里涌入的许多外县土�


<Value, Value>::deserialize(d)?;

        let kind = match map.remove(&Value::String("kind".to_owned())) {
            Some(kind) => kind.deserialize_into().map_err(|e| e.into_error())?,
            None => return Err(de::Error::missing_field("kind")),
        };

        let filters = match map.remove(&Value::String("filters".to_owned())) {
            Some(filters) => filters.deserialize_into().map_err(|e| e.into_error())?,
            None => vec![],
        };

        Ok(AppenderConfig {
            kind,
            filters,
            config: Value::Map(map),
        })
    }
}
<reponame>razagill/speakers
#[macro_use]
extern crate lazy_static;

use rustler::{Encoder, Env, Error, Term};
use std::io::BufReader;
use std::fs::File;

mod atoms {
    rustler::rustler_atoms! {
        atom ok;
        //atom error;
        //atom __true__ = "true";
        //atom __false__ = "false";
    }
}

rustler::rustler_export_nifs! {
    "Elixir.Speakers.NifAudio",
    [
        ("add_to_queue", 1, add_to_queue),
        ("pause", 0, pause),
        ("resume", 0, resume),
        ("get_queue_len", 0, get_queue_len),
        ("get_volume", 0, get_volume),
        ("set_volume", 1, set_volume)
    ],
    None
}

lazy_static! {
    static ref CURRENT_SINK: rodio::Sink = {
        let device = rodio::default_output_device().unwrap();
        let sink = rodio::Sink::new(&device);
        sink
    };
}

fn pause<'a>(env: Env<'a>, _args: &[Term<'a>]) -> Result<Term<'a>, Error> {
    CURRENT_SINK.pause();
    Ok((atoms::ok()).encode(env))
}

fn resume<'a>(env: Env<'a>, _args: &[Term<'a>]) -> Result<Term<'a>, Error> {
    CURRENT_SINK.play();
    Ok((atoms::ok()).encode(env))
}

fn get_queue_len<'a>(env: Env<'a>, _args: &[Term<'a>]) -> Result<Term<'a>, Error> {
    let queue_len = CURRENT_SINK.len();
    Ok((atoms::ok(), queue_len).encode(env))
}

fn add_to_queue<'a>(env: Env<'a>, args: &[Term<'a>]) -> Result<Term<'a>, Error> {
    let file_path: &str = args[0].decode()?;
    let audio_file = File::open(file_path).unwrap();

    CURRENT_SINK.append(rodio::Decoder::new(BufReader::new(audio_file)).unwrap());

    Ok((atoms::ok()).encode(env))
}

fn get_volume<'a>(env: Env<'a>, _args: &[Term<'a>]) -> Result<Term<'a>, Error> {
    let current_volume = CURRENT_SINK.volume();
    Ok((atoms::ok(), current_volume).encode(env))
}

fn set_volume<'a>(env: Env<'a>, args: &[Term<'a>]) -> Result<Term<'a>, Error> {
    let new_volume: f32 = args[0].decode()?;
    let new_set_volume = CURRENT_SINK.set_volume(new_volume);
    Ok((atoms::ok(), new_set_volume).encode(env))
}use std;

use cookie::Cookie as RawCookie;
use idna;
use publicsuffix::{List, Psl, Suffix};
use serde::{Deserialize, Serialize};
use std::convert::TryFrom;
use url::{Host, Url};

use crate::utils::is_host_name;
use crate::CookieError;

pub fn is_match(domain: &str, request_url: &Url) -> bool {
    CookieDomain::try_from(domain)
        .map(|domain| domain.matches(request_url))
        .unwrap_or(false)
}

/// The domain of a `Cookie`
#[derive(PartialEq, Eq, Clone, Debug, Hash, PartialOrd, Ord, Serialize, Deserialize)]
pub enum CookieDomain {
    /// No Domain at


	qrot[node][0].y = v1 ;
	qrot[node][1].y = v2 ;
	qrot[node][2].y = v3 ;
	qrot[node][3].y = v4 ;
	droterr = max(droterr,float(err[field])) ;
	break ;
      case 3:
	qrot[node][0].z = v1 ;
	qrot[node][1].z = v2 ;
	qrot[node][2].z = v3 ;
	qrot[node][3].z = v4 ;
	droterr = max(droterr,float(err[field])) ;
	break ;
      }
    }
    drot[node]=droterr ;
  }

  void buildTreeSerialPart(vector<nodeDataBase> &nodeDataSort,
			   vector<treeInfoBase> &nodeDataTree,
			   int &pbuild,
			   vector<pair<int,int> > &proclims,
			   vector<int> &proctreebase,
			   vector<int> &treeptn,
			   MPI_Comm comm) {
    // First gather
    int nsz = nodeDataSort.size() ;
    for(int i=0;i<nsz;++i)  {
      nodeDataSort[i].order = i ;
    }
    int p = 1 ;
    int r = 0 ;
    MPI_Comm_size(comm,&p) ;
    MPI_Comm_rank(comm,&r) ;

    pbuild = max(min(p,nsz/4096),1) ;

    // build tree (serially on each processor)
    nodeDataTree = vector<treeInfoBase>() ;
    proclims = vector<pair<int,int> >() ;
    nodeDataTree.push_back(treeInfoBase()) ;
    nodeDataTree[0].start = 0 ;
    nodeDataTree[0].end = nsz ;
    proclims.push_back(pair<int,int>(0,pbuild)) ;
    buildTreeRecurseProc(nodeDataTree,nodeDataSort,proclims,0) ;
    proctreebase = vector<int>(pbuild,-1) ;
    for(size_t i=0;i<proclims.size();++i)
      if(proclims[i].second-proclims[i].first == 1)
	proctreebase[proclims[i].first] = i ;

    treeptn = vector<int>(pbuild+1) ;
    treeptn[0] = nodeDataTree.size() ;
    for(int i=0;i<pbuild;++i) {
      int tp = proctreebase[i] ;
      buildTreeRecurse(nodeDataTree,nodeDataSort,tp) ;
      treeptn[i+1] = nodeDataTree.size() ;
    }
  }

  void buildWeightsApprox(const vector<nodeDataBase> &nodeDataSort,
			  const vector<treeInfoBase> &nodeDataTree,
			  const vector<pair<int,int> > &proclims,
			  const vector<int> &proctreebase,
			  const vector<int> &treeptn,
			  vector<double> &weights,
			  vector<vector3d<float> > &centroid,
			  vector<float> &radius,
			  vector<Array<vector3d<float>,3> > &qpts,
			  vector<float> &qerr,
			  MPI_Comm comm) {
    int p = 1 ;
    int r = 0 ;
    MPI_Comm_size(comm,&p) ;
    MPI_Comm_rank(comm,&r) ;
    int tsz = nodeDataTree.size() ;
    weights = vector<double>(tsz) ;
    centroid = vector<vector3d<float> >(tsz) ;
    radius = vector<float>(tsz)


        lowLink = lowLinks[node] = min(lowLink, indexes[next]!);
      }
    } while (iterator.moveNext());

    if (lowLink == indexes[node]) {
      final component = <T>[];
      T next;
      do {
        next = lastVisited.removeLast();
        onStack.remove(next);
        component.add(next);
      } while (!nonNullEquals(next, node));
      result.add(component);
    }
  }

  return result;
}

/// The state of a pass on a single node in Tarjan's Algorithm.
///
/// This is used to perform the algorithm with an explicit stack rather than
/// recursively, to avoid stack overflow errors for very large graphs.
class _StackState<T> {
  /// The node being inspected.
  final T node;

  /// The iterator traversing [node]'s edges.
  ///
  /// This is null if the node hasn't yet begun being traversed.
  final Iterator<T>? iterator;

  _StackState(this.node, [this.iterator]);
}

bool _defaultEquals(Object a, Object b) => a == b;
// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:math' as math;

import 'package:mime/mime.dart';
import 'package:mime/src/magic_number.dart';
import 'package:test/test.dart';

void _expectMimeType(String path, String? expectedMimeType,
    {List<int>? headerBytes, MimeTypeResolver? resolver}) {
  String? mimeType;
  if (resolver == null) {
    mimeType = lookupMimeType(path, headerBytes: headerBytes);
  } else {
    mimeType = resolver.lookup(path, headerBytes: headerBytes);
  }

  expect(mimeType, expectedMimeType);
}

void main() {
  group('global-lookup', () {
    test('by-path', () {
      _expectMimeType('file.dart', 'text/x-dart');
      // Test mixed-case
      _expectMimeType('file.DaRT', 'text/x-dart');
      _expectMimeType('file.dcm', 'application/dicom');
      _expectMimeType('file.html', 'text/html');
      _expectMimeType('file.xhtml', 'application/xhtml+xml');
      _expectMimeType('file.jpeg', 'image/jpeg');
      _expectMimeType('file.jpg', 'image/jpeg');
      _expectMimeType('file.png', 'image/png');
      _expectMimeType('file.gif', 'image/gif');
      _expectMimeType('file.cc', 'text/x-c');
      _expectMimeType('file.c', 'text/x-c');
      _expectMimeType('file.css', 'text/css');
      _expectMimeType('file.js', 'text/javascript');
      _expectMimeType('file.mjs', 'text/javascript');
      _expectMimeType('file.ps', 'application/postscript');
      _expectMimeType('file.pdf', 'application/pdf');
      _expectMimeType('file.tiff', 'image/tiff');
      _expectMimeType('file.tif', 'image/tiff');
      _expectMimeType('file.webp', 'image/webp');
      _expectMimeType('file.mp3', 'audio/mpeg');
      _expectMimeType('file.aac', 'audio/aac');
      _expectMimeType('file.ogg', 'audio/ogg');
      _expectMimeType('file.aiff', 'audio/x-aiff');
      _expectMimeType('file.m4a', 'audio/mp4');
      _expectMimeType('file.m4b', 'audio/mp4');
      _expectMimeType('file.toml', 'application/toml');
      _expectMimeType('file.md', 'text/markdown');
      _expectMimeType('file.markdown', 'text/markdown');
      _expectMimeType('file.heif', 'image/heif');
      _expect


ा चेहरा | चेहरा',
    ),
    Emoji(
      '😉',
      'आँख मारता चेहरा | आंख मारता चेहरा | आंख मारना | चेहरा',
    ),
    Emoji(
      '😊',
      'मुस्काता चेहरा | मुस्काता चेहरा और आंखें | मुस्काती आंखें | मुस्काती आँखों वाला मुस्काता चेहरा | मुस्कान | शर्माना',
    ),
    Emoji(
      '😇',
      'खुश | चेहरा | प्रभामंडल | प्रभामंडल वाली मुस्कान | प्रभामंडल वाली मुस्कान वाला चेहरा | मुस्कान',
    ),
    Emoji(
      '🥰',
      'चेहरा | दिल | दुलार | प्यार | प्यार में | प्यार में डूबा चेहरा | प्यारा | प्रेमी | लव | लव यू | हँसी | हंसी',
    ),
    Emoji(
      '😍',
      'आंखें | आंखें चार होना | दिल | दिल और आँखें | दिल के आकार वाली आँखों वाला मुस्काता चेहरा | दिल वाली आँखों का मुस्काता चेहरा | प्यार | प्रेममय | मुस्काता चेहरा',
    ),
    Emoji(
      '🤩',
      'आँखें | उत्तेजित | चेहरा | चेहरे पर सितारे वाली आँखें | तारा | मुस्कुराहट | वाह | सितारा आँखें | सितारे | सितारों वाली आँखें',
    ),
    Emoji(
      '😘',
      'चुंबन देता चेहरा | चूमता चेहरा | चेहरा | चेहरे पर चुंबन देना | प्रेम | प्रेमिका | प्रेमी',
    ),
    Emoji(
      '😗',
      'चुंबन | चुंबन वाला चेहरा | चेहरा | प्यार | प्रेम | प्रेम में',
    ),
    Emoji(
      '☺',
      'खुश | चेहरा | मुस्काता चेहरा |


$a1, $a1, $v0
/* 4B69BD0 80083E08 CB89010C */  jal        rand
/* 4B69BD4 80083E0C 00000000 */   nop
/* 4B69BD8 80083E10 3F004230 */  andi       $v0, $v0, 0x3F
/* 4B69BDC 80083E14 18004224 */  addiu      $v0, $v0, 0x18
/* 4B69BE0 80083E18 040022AE */  sw         $v0, 0x4($s1)
.Llevel_53_80083E1C:
/* 4B69BE4 80083E1C 0400228E */  lw         $v0, 0x4($s1)
/* 4B69BE8 80083E20 0780033C */  lui        $v1, %hi(g_DeltaTime)
/* 4B69BEC 80083E24 CC56638C */  lw         $v1, %lo(g_DeltaTime)($v1)
/* 4B69BF0 80083E28 00000000 */  nop
/* 4B69BF4 80083E2C 21104300 */  addu       $v0, $v0, $v1
/* 4B69BF8 80083E30 AF130208 */  j          .Llevel_53_80084EBC
/* 4B69BFC 80083E34 040022AE */   sw        $v0, 0x4($s1)
.Llevel_53_80083E38:
/* 4B69C00 80083E38 0000238E */  lw         $v1, 0x0($s1)
/* 4B69C04 80083E3C 00000000 */  nop
/* 4B69C08 80083E40 500062A0 */  sb         $v0, 0x50($v1)
/* 4B69C0C 80083E44 0000248E */  lw         $a0, 0x0($s1)
/* 4B69C10 80083E48 0C006526 */  addiu      $a1, $s3, 0xC
/* 4B69C14 80083E4C C05D000C */  jal        VecCopy
/* 4B69C18 80083E50 0C008424 */   addiu     $a0, $a0, 0xC
/* 4B69C1C 80083E54 0BB6023C */  lui        $v0, (0xB60B60B7 >> 16)
/* 4B69C20 80083E58 0400248E */  lw         $a0, 0x4($s1)
/* 4B69C24 80083E5C B7604234 */  ori        $v0, $v0, (0xB60B60B7 & 0xFFFF)
/* 4B69C28 80083E60 C0220400 */  sll        $a0, $a0, 11
/* 4B69C2C 80083E64 18008200 */  mult       $a0, $v0
/* 4B69C30 80083E68 10580000 */  mfhi       $t3
/* 4B69C34 80083E6C 21106401 */  addu       $v0, $t3, $a0
/* 4B69C38 80083E70 83110200 */  sra        $v0, $v0, 6
/* 4B69C3C 80083E74 C3270400 */  sra        $a0, $a0, 31
/* 4B69C40 80083E78 165B000C */  jal        Sin
/* 4B69C44 80083E7C 23204400 */   subu      $a0, $v0, $a0
/* 4B69C48 80083E80 5555033C */  lui        $v1, (0x55555556 >> 16)
/* 4B69C4C 80083E84 56556334 */  ori        $v1, $v1, (0x55555556 & 0xFFFF)
/* 4B69C50 80083E88 18004300 */  mult       $v0, $v1
/* 4B69C54 80083E


�攻击后，有<color=#FFC432>75％</color><skillEff=基础概率>使目标增加15%承受伤害，持续2回合',	'6',	'4006003',	'',	''},
{'400600304',	'',	'晦霭隐氤',	'对敌方目标造成6次<color=#FFC432>55％</color>攻击的<color=#6666FF>能量伤害</color>；攻击后，有<color=#FFC432>75％</color><skillEff=基础概率>使目标增加15%承受伤害，持续2回合',	'对敌方目标造成6次<color=#FFC432>55％</color>攻击的<color=#6666FF>能量伤害</color>；造成伤害前，自身每点机动额外增加0.6%造成攻击伤害；攻击后，有<color=#FFC432>75％</color><skillEff=基础概率>使目标增加15%承受伤害，持续2回合',	'对敌方目标造成6次<color=#FFC432>55％</color>攻击的<color=#6666FF>能量伤害</color>；攻击后，有<color=#FFC432>75％（+25%）</color><skillEff=基础概率>使目标增加15%承受伤害，持续2回合',	'对敌方目标造成6次<color=#FFC432>55％</color>攻击的<color=#6666FF>能量伤害</color>；造成伤害前，自身每点机动额外增加0.6%造成攻击伤害；攻击后，有<color=#FFC432>75％（+25%）</color><skillEff=基础概率>使目标增加15%承受伤害，持续2回合',	'6',	'4006003',	'',	''},
{'400600305',	'',	'晦霭隐氤',	'对敌方目标造成6次<color=#FFC432>55％</color>攻击的<color=#6666FF>能量伤害</color>；攻击后，有<color=#FFC432>100％</color><skillEff=基础概率>使目标增加15%承受伤害，持续2回合',	'对敌方目标造成6次<color=#FFC432>55％</color>攻击的<color=#6666FF>能量伤害</color>；造成伤害前，自身每点机动额外增加0.6%造成攻击伤害；攻击后，有<color=#FFC432>100％</color><skillEff=基础概率>使目标增加15%承受伤害，持续2回合',	'对敌方目标造成6次<color=#FFC432>55％</color>攻击的<color=#6666FF>能量伤害</color>；攻击后，有<color=#FFC432>100％</color><skillEff=基础概率>使目标增加15%承受伤害，


Dimensions.items():
        currentGame = Game.Game(activateScreen=True, size=size, name="Test")
        assert currentGame.ScreenSize == size

Functions

def test_ScreenSize() ‑> None

Expand source code

def test_ScreenSize() -> None:
    for _, size in Game.StandardDimensions.items():
        currentGame = Game.Game(activateScreen=True, size=size, name="Test")
        assert currentGame.ScreenSize == size

Index

Super-module

Engine.Testing

Functions

test_ScreenSize

Generated by pdoc 0.10.0.

<!doctype html>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.10.0" />
<title>Engine.Testing.Engine_Color_test API documentation</title>
<meta name="description" content="Test Module for ColorTools" />
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
<link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>


       mnemonic: Mnemonic::VPTESTNMQ,
            operand1: Some(Direct(K5)),
            operand2: Some(Direct(ZMM1)),
            operand3: Some(Indirect(RAX, Some(OperandSize::Zmmword), None)),
            operand4: None,
            lock: false,
            rounding_mode: None,
            merge_mode: None,
            sae: false,
            mask: Some(MaskReg::K5),
            broadcast: None,
        },
        &[98, 242, 246, 77, 39, 40],
        OperandSize::Qword,
    )
}

#[test]
fn vptestnmq_18() {
    run_test(
        &Instruction {
            mnemonic: Mnemonic::VPTESTNMQ,
            operand1: Some(Direct(K7)),
            operand2: Some(Direct(ZMM25)),
            operand3: Some(Indirect(RDX, Some(OperandSize::Qword), None)),
            operand4: None,
            lock: false,
            rounding_mode: None,
            merge_mode: None,
            sae: false,
            mask: Some(MaskReg::K6),
            broadcast: Some(BroadcastMode::Broadcast1To8),
        },
        &[98, 242, 182, 86, 39, 58],
        OperandSize::Qword,
    )
}
<filename>packages/engine/src/datastore/storage/mod.rs
mod markers;
pub mod memory;
mod ptr;
mod visitor;
pub struct BufferChange(bool, bool);

impl BufferChange {
    /// TODO: DOC possibly that this buffer itself didn't change but moved in memory due to another
    ///   buffer possibly growing or shrinking
    pub fn shifted(&self) -> bool {
        self.0
    }

    pub fn resized(&self) -> bool {
        self.1
    }
}
<filename>src/writemem.rs
use winapi::um::memoryapi::{WriteProcessMemory, VirtualProtectEx};
use winapi::shared::minwindef::{LPCVOID, LPVOID};
use winapi::um::winnt::{HANDLE, PAGE_EXECUTE_READWRITE};
use winapi::um::errhandlingapi::GetLastError;

/// Writes bytes in Vec<u8> to memory location.
pub fn write_bytes(handle: HANDLE, address: usize, bytes: Vec<u8>) {
    unsafe {
        if WriteProcessMemory(handle, address as LPVOID, bytes.as_ptr() as LPVOID, bytes.len(), std::ptr::null_mut()) == 0 {
            panic!("Last OS Error: {}", GetLastError());
        };
    }
}

/// Writes an i64 to memory.
pub fn write_i64(handle: HANDLE, address: usize, to_write: i64) {
    write_primitive(handle, address, to_write);
}
/// Writes an i32 to memory.
pub fn write_i32(handle: HANDLE, address: usize, to_write: i32) {
    write_primitive(handle, address, to_write);
}
/// Writes an i16 to memory.
pub fn write_i16(handle: HANDLE, address: usize, to_write: i16) {
    write_primitive(handle, address, to_write);
}
/// Writes an i8 to memory.
pub fn write_i8(handle: HANDLE, address: usize, to_write: i8) {
    write_primitive(handle, address, to_write);
}
/// Writes an u64 to memory.
pub fn write_u64(handle: HANDLE, address: usize, to_write: u64) {
    write_primitive(handle, address, to_write);
}
/// Writes an u32 to memory.
pub fn write_u32(handle: HANDLE, address: usize, to_write: u32) {
    write_primitive(handle, address, to_write);
}
/// Writes an u16 to memory.
pub fn write_u16(handle: HANDLE, address: usize, to_write: u16) {
    write


           type = "mean",
                        n.iter = 2000,
                        n.burnin = 1000,
                        n.thin = 1)
```

---
## WAIC in Jags

``` r
samples$p_waic <- samples$WAIC
samples$waic <- samples$deviance + samples$p_waic
tmp <- sapply(samples, sum)
waic <- round(c(waic = tmp[["waic"]],
                p_waic = tmp[["p_waic"]]),1)
waic
```

```
##   waic p_waic
##  218.4   13.6
```

---
# Problem

---
## Model selection with wAIC

* Fit models with rainfall effect, temperature effect and without any covariate to the stork data.

* Rank them with wAIC.

---
# Solution

---
## Data

``` r
nbchicks <- c(151,105,73,107,113,87,77,108,118,122,112,120,122,
              89,69,71,53,41,53,31,35,14,18)

nbpairs <- c(173,164,103,113,122,112,98,121,132,136,133,137,
             145,117,90,80,67,54,58,39,42,23,23)

temp <- c(15.1,13.3,15.3,13.3,14.6,15.6,13.1,13.1,15.0,11.7,
          15.3,14.4,14.4,12.7,11.7,11.9,15.9,13.4,14.0,13.9,
          12.9,15.1,13.0)

rain <- c(67,52,88,61,32,36,72,43,92,32,86,28,57,55,66,26,
          28,96,48,90,86,78,87)
```

---
## Model with both covariates

.tiny-font[

``` r
model <-
paste("
model
{
	for( i in 1 : N)
		{
		nbchicks[i] ~ dbin(p[i],nbpairs[i])
		logit(p[i]) <- a + b.temp * temp[i] + b.rain * rain[i]
		}

# priors for regression parameters
a ~ dnorm(0,0.001)
b.temp ~ dnorm(0,0.001)
b.rain ~ dnorm(0,0.001)

	}
")
writeLines(model,here::here("slides", "code", "logistic.txt"))
```
]

---
## MCMC details and data

``` r
init1 <- list(a = -0.5, b.temp = -0.5, b.rain = -0.5)
init2 <- list(a = 0.5, b.temp = 0.5, b.rain = 0.5)
inits <- list(init1,init2)
parameters <- c("a","b.temp","b.rain")
nb.burnin <- 1000
nb.iterations <- 2000

datax <- list(N = 23,
              nbchicks = nbchicks,
              nbpairs = nbpairs,
              temp = (temp - mean(temp)) / sd(temp),
              rain = (rain - mean(rain)) / sd(rain))
```

---
## Run Jags

.tiny-font[

``` r
storks <- jags(data  = datax,
               inits = inits,
               parameters.to.save = parameters,
               model.file = here::here("slides", "code", "logistic.txt"),
               n.chains = 2,
               n.iter = nb.iterations,
               n.burnin = nb.burnin)
```

```
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 23
##    Unobserved stochastic nodes: 3
##    Total graph size: 181
##
## Initializing model
```
]


#!/usr/bin/python3
"""
Cleans-up Sphinx-only constructs (ie from README.rst),
so that *PyPi* can format it properly.

To check for remaining errors, install ``sphinx`` and run::

        python setup.py --long-description | sed -file 'this_file.sed' | rst2html.py  --halt=warning

"""

import re
import sys, io

def yield_sphinx_only_markup(lines):
    """
    :param file_inp:     a `filename` or ``sys.stdin``?
    :param file_out:     a `filename` or ``sys.stdout`?`

    """
    substs = [
        ## Selected Sphinx-only Roles.
        #
        (r':abbr:`([^`]+)`',        r'\1'),
        (r':ref:`([^`]+)`',         r'`\1`_'),
        (r':term:`([^`]+)`',        r'**\1**'),
        (r':dfn:`([^`]+)`',         r'**\1**'),
        (r':(samp|guilabel|menuselection):`([^`]+)`',        r'``\2``'),

        ## Sphinx-only roles:
        #        :foo:`bar`   --> foo(``bar``)
        #        :a:foo:`bar` XXX afoo(``bar``)
        #
        #(r'(:(\w+))?:(\w+):`([^`]*)`', r'\2\3(``\4``)'),
        (r':(\w+):`([^`]*)`', r'\1(``\2``)'),

        ## Sphinx-only Directives.
        #
        (r'\.\. doctest',           r'code-block'),
        (r'\.\. plot::',            r'.. '),
        (r'\.\. seealso',           r'info'),
        (r'\.\. glossary',          r'rubric'),
        (r'\.\. figure::',          r'.. '),

        ## Other
        #
        (r'\|version\|',              r'x.x.x'),
    ]

    regex_subs = [ (re.compile(regex, re.IGNORECASE), sub) for (regex, sub) in substs ]

    def clean_line(line):
        try:
            for (regex, sub) in regex_subs:
                line = regex.sub(sub, line)
        except Exception as ex:
            print("ERROR: %s, (line(%s)"%(regex, sub))
            raise ex

        return line

    for line in lines:
        yield clean_line(line)


125rem 0.25rem rgba(0, 0, 0, 0.075);--bs-box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);--bs-box-shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.075);--bs-focus-ring-width: 0.25rem;--bs-focus-ring-opacity: 0.25;--bs-focus-ring-color: rgba(55, 90, 127, 0.25);--bs-form-valid-color: #00bc8c;--bs-form-valid-border-color: #00bc8c;--bs-form-invalid-color: #e74c3c;--bs-form-invalid-border-color: #e74c3c}[data-bs-theme=dark]{color-scheme:dark;--bs-body-color: #dee2e6;--bs-body-color-rgb: 222, 226, 230;--bs-body-bg: #222;--bs-body-bg-rgb: 34, 34, 34;--bs-emphasis-color: #fff;--bs-emphasis-color-rgb: 255, 255, 255;--bs-secondary-color: rgba(222, 226, 230, 0.75);--bs-secondary-color-rgb: 222, 226, 230;--bs-secondary-bg: #303030;--bs-secondary-bg-rgb: 48, 48, 48;--bs-tertiary-color: rgba(222, 226, 230, 0.5);--bs-tertiary-color-rgb: 222, 226, 230;--bs-tertiary-bg: #292929;--bs-tertiary-bg-rgb: 41, 41, 41;--bs-primary-text-emphasis: #879cb2;--bs-secondary-text-emphasis: #8e8e8e;--bs-success-text-emphasis: #66d7ba;--bs-info-text-emphasis: #85c1e9;--bs-warning-text-emphasis: #f8c471;--bs-danger-text-emphasis: #f1948a;--bs-light-text-emphasis: #f8f9fa;--bs-dark-text-emphasis: #dee2e6;--bs-primary-bg-subtle: #0b1219;--bs-secondary-bg-subtle: #0d0d0d;--bs-success-bg-subtle: #00261c;--bs-info-bg-subtle: #0a1e2c;--bs-warning-bg-subtle: #311f04;--bs-danger-bg-subtle: #2e0f0c;--bs-light-bg-subtle: #303030;--bs-dark-bg-subtle: #181818;--bs-primary-border-subtle: #21364c;--bs-secondary-border-subtle: #282828;--bs-success-border-subtle: #007154;--bs-info-border-subtle: #1f5b83;--bs-warning-border-subtle: #925e0b;--bs-danger-border-subtle: #8b2e24;--bs-light-border-subtle: #444;--bs-dark-border-subtle: #303030;--bs-heading-color: inherit;--bs-link-color: #879cb2;--bs-link-hover-color: #9fb0c1;--bs-link-color-rgb: 135, 156, 178;--bs-link-hover-color-rgb: 159, 176, 193;--bs-code-color: white;--bs-border-color: #444;--bs-border-color-translucent: rgba(255, 255, 255, 0.15);--bs-form-valid-color: #66d7ba;--bs-form-valid-border-color: #66d7ba;--bs-form-invalid-color: #f1948a;--bs-form-invalid-border-color: #f1948a}*,*::before,*::after{box-sizing:border-box}:root{font-size:var(--bs-root-font-size)}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height


----------------------------------------------------
.oi, .fa {
    font-weight: $font-weight-normal;
}

// Define base-classes' properties using CSS variables.
// Allows to dinamically update rules according to the context and eventual
// utility classes.
// ----------------------------------------------------------------------------
.oi, .fa {
    &:before {
        font-size: var(--oi-font-size, $oi-default-size);
        vertical-align: var(--oi-vertical-align, 0);
        text-rendering: geometricPrecision;
    }
}

.oi-fw {
    width: calc(#{$oi-fw-ratio} * var(--oi-font-size, #{$oi-default-size}));
    text-align: center;
}

// Print CSS variables for each size/breakpoint
// ----------------------------------------------------------------------------
@each $breakpoint in map-keys($grid-breakpoints) {
    @include media-breakpoint-up($breakpoint) {
        $-infix: breakpoint-infix($breakpoint, $grid-breakpoints);

        @each $-key, $-values in $oi-sizes {
            .oi#{$-infix}-#{$-key} {
                @each $-rule, $-value in $-values {
                    @include print-variable('oi-#{$-rule}', $-value);
                }
            }
        }
    }
}

// Rely on animations already defined by FontAwesome
// ----------------------------------------------------------------------------
.oi-spin {
    animation: fa-spin 2s infinite linear;
}

.oi-pulse {
    animation: fa-spin 1s infinite steps(8);
}

.o_barcode {
    -webkit-mask: url('/web/static/img/barcode.svg') center/contain no-repeat;
    mask: url('/web/static/img/barcode.svg') center/contain no-repeat;
    background-color: $o-brand-primary;
}

.o_fa_stack {
    display: grid;
    align-items: baseline;
    justify-items: center;

    > * {
        grid-column: 1/-1;
        grid-row: 1/-1;
    }

    > :first-child {
        font-size: 2em;
    }
}
/**
 * This file regroups the rules which apply on elements which are shared between
 * all views.
 */

// Sample data global rules
.o_view_sample_data {
    .form-check {
        pointer-events: none !important;
    }
}

// No content helper
.o_view_nocontent {
    @include o-position-absolute(0, 0, 0, 0);
    pointer-events: none;
    z-index: var(--o-view-nocontent-zindex, 1);
    display: flex;
    align-items: center;
    justify-content: center;

    .o_nocontent_help {
        @include o-nocontent-empty;

        .o_view_nocontent_smiling_face:before {
            @extend %o-nocontent-init-image;
            width: 120px;
            height: 140px;
            background: transparent url(/web/static/img/smiling_face.svg) no-repeat center;
        }

        .o_view_nocontent_neutral_face:before {
            @extend %o-nocontent-init-image;
            width: 120px;
            height: 140px;
            background: transparent url(/web/static/img/neutral_face.svg) no-repeat center;
        }

        .o_view_nocontent_empty_folder:before {
            @extend %o-nocontent-empty-document;
        }

        .o_empty_custom_dashboard {
            min-height: 327px;
            margin-left: -$grid-gutter-width/2;


import stop_vr_inference, load_vr_model_stem

	gr.Markdown(
		value=i18n(
			"说明: 本整合包仅融合了UVR的VR Architecture模型, MDX23C和HtDemucs类模型可以直接使用前面的MSST音频分离。
UVR分离使用项目: [https://github.com/nomadkaraoke/python-audio-separator](https://github.com/nomadkaraoke/python-audio-separator) 并进行了优化。"
		)
	)
	vr_select_model = gr.Dropdown(
		label=i18n("选择模型"), choices=load_vr_cloud_model(), value=webui_config["inference"]["vr_select_model"] if webui_config["inference"]["vr_select_model"] else None, interactive=True
	)
	with gr.Row():
		vr_window_size = gr.Dropdown(label=i18n("Window Size: 窗口大小, 用于平衡速度和质量"), choices=[320, 512, 1024], value="512", interactive=True, allow_custom_value=True)
		vr_aggression = gr.Number(label=i18n("Aggression: 主干提取强度, 范围-100-100, 人声请选5"), minimum=-100, maximum=100, value=5, interactive=True)
		vr_output_format = gr.Radio(label=i18n("输出格式"), choices=["wav", "flac", "mp3"], value="wav", interactive=True)
	with gr.Row():
		vr_use_cpu = gr.Checkbox(label=i18n("使用CPU"), value=force_cpu_value, interactive=False if force_cpu_value else True)
		vr_primary_stem_only = gr.Checkbox(label="primary_only", value=False, interactive=True)
		vr_secondary_stem_only = gr.Checkbox(label="secondary_only", value=False, interactive=True)
	with gr.Tabs():
		with gr.TabItem(label=i18n("输入文件夹")) as folder_tab:
			folder_input = gr.Textbox(label=i18n("输入目录"), value="input/", interactive=False, scale=4)
		with gr.TabItem(label=i18n("输入音频")) as audio_tab:
			audio_input = gr.Files(label="上传一个或多个音频文件", type="filepath")
	with gr.Row():
		vr_store_dir = gr.Textbox(label=i18n("输出目录"), value="results/", interactive=False, scale=4)
	with gr.Accordion(i18n("[点击展开] 以下是一些高级设置, 一般保持默认即可"), open=False):
		with gr.Row():
			vr_batch_size = gr.Slider(label="Batch Size", info=i18n("批次大小, 减小此值可以降低显存占用"), minimum=1, maximum=32, step=1, value=2, interactive=True)
			vr_post_process_threshold = gr.Slider(label="Post Process Threshold", info=i18n("后处理特征阈值, 取值为0.1-0.3, 默认0.2"), minimum=0.1, maximum=0.3, step=0.01, value=0.2, interactive=True)
		with gr.Row():
			vr_enable_tta = gr.Checkbox(label="Enable TTA", info=i18n("启用“测试时增强”, 可能会提高质量, 但速度稍慢"), value=False, interactive=True)
			vr_high_end_process = gr.Checkbox(label="High End Process", info=i18n("将输出音频缺失的频率范围镜像输出, 作用不大"), value=False, interactive=True)
			vr_enable_post_process = gr.Checkbox(label="Enable Post Process", info=i18n("识别人声输出中残留的人工痕迹, 可改善某些歌曲的分离效果"), value=False, interactive=True)
	vr_inference_audio = gr.Button(i18n("输入音频分离"), variant="primary", visible=False)
	vr_inference_folder = gr.Button(i18n("输入文件夹分离"), variant="primary", visible=True)
	with gr.Row():
		vr_output_message = gr.Textbox(label="Output Message", scale=5)
		stop_vr = gr.Button(i18n("强制停止"), scale=1)

	audio_tab.select(fn=change_to_audio_infer, outputs=[vr_inference_audio, vr_inference_folder])
	folder_tab.select(fn=change_to_folder_infer, outputs=[vr_inference_audio, vr_inference_folder])
	vr_select_model.change(fn=load_vr_model_stem, inputs=vr_select_model, outputs=[vr_primary_stem_only, vr_secondary_stem_only])
	vr_inference_audio.click(
		fn=cloud_vr_infer_audio,
		inputs=[
			vr_select_model,
			vr_window_size,
			vr_aggression,
			vr_output_format,
			vr_use_cpu,
			vr_primary_stem_only,
			vr_secondary_stem_only,
			audio_input,
			vr_store_dir,
			vr_batch_size,
			vr_post_process_threshold,
			vr_enable_tta,
			vr_high_end_process,
			vr_enable_post_process,
		],
		outputs=vr_output_message,
	)
	vr_inference_folder.click(
		fn=cloud_vr_infer_folder,
		inputs=[
			vr_select_model,
			vr_window_size,
			vr_aggression,
			vr_output_format,
			vr_use_cpu,
			vr_primary_stem_only,
			vr_secondary_stem_only,
			folder_input,
			vr_store_dir,
			vr_batch_size,
			vr_post_process_threshold,
			vr_enable_tta,
			vr_high_end_process,
			vr_enable_post_process,
		],
		outputs=vr_output_message,
	)
	stop_vr.click(fn=stop_vr_inference)

def preset():
	from webui.preset import (
		get_presets_list,
		update_model_stem,
		add_to_flow_func,
		save_flow_func,
		reset_flow_func,
		reset_last_func,
		delete_func,
		load_preset,
		restore_preset_func,
		preset_backup_list,
		stop_preset,
	)

	gr.Markdown(value=i18n("预设流程允许按照预设的顺序运行多个模型。每一个模型的输出将作为下一个模型的输入。"))
	with gr.Tabs():
		with gr.TabItem(label=i18n("使用预设")):
			gr.Markdown(value=i18n("该模式下的UVR推理参数将直接沿用UVR分离页面的推理参数, 如需修改请前往UVR分离页面。
修改完成后, 还需要任意处理一首歌才能保存参数! "))
			with gr.Row():
				preset_dropdown = gr.Dropdown(label=i18n("请选择预设"), choices=get_presets_list(), value=None,


BoundsPoints[2]
          y2 = mBoundsPoints[3]
          x3 = mBoundsPoints[4]
          y3 = mBoundsPoints[5]
        } else {
          x0 = mBoundsPoints[4]
          y0 = mBoundsPoints[5]
          x2 = mBoundsPoints[0]
          y2 = mBoundsPoints[1]
          x3 = mBoundsPoints[2]
          y3 = mBoundsPoints[3]
        }
      } else if (mBoundsPoints[1] > mBoundsPoints[3]) {
        x0 = mBoundsPoints[2]
        y0 = mBoundsPoints[3]
        x2 = mBoundsPoints[6]
        y2 = mBoundsPoints[7]
        x3 = mBoundsPoints[0]
        y3 = mBoundsPoints[1]
      }
      val a0 = (y3 - y0) / (x3 - x0)
      val a1 = -1f / a0
      val b0 = y0 - a0 * x0
      val b1 = y0 - a1 * x0
      val b2 = y2 - a0 * x2
      val b3 = y2 - a1 * x2
      val c0 = (rect.centerY() - rect.top) / (rect.centerX() - rect.left)
      val c1 = -c0
      val d0 = rect.top - c0 * rect.left
      val d1 = rect.top - c1 * rect.right
      left = max(
        left,
        if ((d0 - b0) / (a0 - c0) < rect.right) (d0 - b0) / (a0 - c0) else left,
      )
      left = max(
        left,
        if ((d0 - b1) / (a1 - c0) < rect.right) (d0 - b1) / (a1 - c0) else left,
      )
      left = max(
        left,
        if ((d1 - b3) / (a1 - c1) < rect.right) (d1 - b3) / (a1 - c1) else left,
      )
      right = min(
        right,
        if ((d1 - b1) / (a1 - c1) > rect.left) (d1 - b1) / (a1 - c1) else right,
      )
      right = min(
        right,
        if ((d1 - b2) / (a0 - c1) > rect.left) (d1 - b2) / (a0 - c1) else right,
      )
      right = min(
        right,
        if ((d0 - b2) / (a0 - c0) > rect.left) (d0 - b2) / (a0 - c0) else right,
      )
      top = max(top, max(a0 * left + b0, a1 * right + b1))
      bottom = min(bottom, min(a1 * left + b3, a0 * right + b2))
      mCalcBounds.left = left
      mCalcBounds.top = top
      mCalcBounds.right = right
      mCalcBounds.bottom = bottom
      true
    }
  }

  /** Is the cropping image has been rotated by NOT 0,90,180 or 270 degrees. */
  private val isNonStraightAngleRotated: Boolean
    get() = mBoundsPoints[0] != mBoundsPoints[6] && mBoundsPoints[1] != mBoundsPoints[7]

  /** Interface definition for a callback to be invoked when crop window rectangle is changing. */
  internal fun interface CropWindowChangeListener {
    /**
     * Called after a change in crop window rectangle.
     *
     * [inProgress] if the crop window change operation is still in progress by user touch
     */
    fun onCropWindowChanged(inProgress: Boolean)
  }

  /** Handle scaling the rectangle based on two finger input. */
  private inner class ScaleListener : SimpleOnScaleGestureListener() {
    override fun onScale(detector: ScaleGestureDetector): Boolean {
      val rect = mCropWindowHandler.getRect()
      val x = detector.focusX
      val y = detector.focusY
      val dY = detector.currentSpanY / 2
      val dX = detector.currentSpanX / 2
      val newTop = y - dY
      val newLeft = x - dX
      val newRight = x + dX
      val newBottom = y + dY

      if (newLeft < newRight &&
        newTop <= newBottom


() != 2) {
    samp_->addErrorCode(sistrip::numberOfHistos_);
  }

  // Extract FED key from histo title
  if (!histos.empty()) {
    samp_->fedKey(extractFedKey(histos.front()));
  }

  // Extract
  std::vector<TH1*>::const_iterator ihis = histos.begin();
  for (; ihis != histos.end(); ihis++) {
    // Check pointer
    if (!(*ihis)) {
      edm::LogWarning(mlCommissioning_) << " NULL pointer to histogram!";
      continue;
    }

    // Check name
    SiStripHistoTitle title((*ihis)->GetName());
    if (title.runType() != sistrip::APV_LATENCY && title.runType() != sistrip::FINE_DELAY) {
      samp_->addErrorCode(sistrip::unexpectedTask_);
      continue;
    }
    // Set the mode for later fits
    samp_->runType_ = title.runType();

    // Set the granularity
    samp_->granularity_ = title.granularity();

    // Extract timing histo
    if (title.extraInfo().find(sistrip::extrainfo::clusterCharge_) != std::string::npos) {
      histo_.first = *ihis;
      histo_.second = (*ihis)->GetName();
    }
  }
}

// ----------------------------------------------------------------------------
//
void SamplingAlgorithm::analyse() {
  if (!samp_) {
    edm::LogWarning(mlCommissioning_) << "[SamplingAlgorithm::" << __func__ << "]"
                                      << " NULL pointer to derived Analysis object!";
    return;
  }

  TProfile* prof = (TProfile*)(histo_.first);
  if (!prof) {
    edm::LogWarning(mlCommissioning_) << " NULL pointer to histogram!";
    return;
  }

  // set the right error mode: rms
  prof->SetErrorOption(" ");

  //that should not be needed, but it seems histos are stored with error option " " and errors "s" in all cases.
  //it MUST be removed if the DQM (?) bug is solved
  for (int i = 0; i < prof->GetNbinsX(); ++i) {
    if (prof->GetBinEntries(i) > 0)
      prof->SetBinError(i, prof->GetBinError(i) / sqrt(prof->GetBinEntries(i)));
  }

  // prune the profile
  pruneProfile(prof);

  // correct for the binning
  correctBinning(prof);

  // correct for clustering effects
  correctProfile(prof, samp_->sOnCut_);

  // fit depending on the mode
  if (samp_->runType_ == sistrip::APV_LATENCY) {
    // initialize  the fit (overal latency)
    float max = prof->GetBinCenter(prof->GetMaximumBin());
    float ampl = prof->GetMaximum();
    peak_fitterA_->SetParameters(0., 50 - max, ampl / 20., 50, 10);

    // fit
    if (prof->Fit(peak_fitterA_, "Q") == 0)
      prof->Fit(peak_fitterA_, "QEM");

    // Set monitorables
    samp_->max_ = peak_fitterA_->GetMaximumX();
    samp_->error_ = peak_fitterA_->GetParError(1);

  } else {  // sistrip::FINE_DELAY

    // initialize  the fit (overal latency)
    float max = prof->GetBinCenter(prof->GetMaximumBin());
    float ampl = prof->GetMaximum();
    deconv_fitter_->SetParameters(0., -max, ampl / 10., 50, 20);
    peak_fitterB_->SetParameters(0., 50 - max, ampl / 20., 50, 10);
    if (latencyCode_ & 0x80) {  // deconv mode
      // fit
      if (prof->Fit(deconv_fitter_, "Q") == 0)
        prof->Fit(deconv_fitter_, "QEM");
      //


原则法、配套原则法。 c:574

### 第4节 让所有的铺垫为结尾服务

1．结尾一定要收得住——不要“节外生枝”。2．结尾的地位——所有前面的铺垫都是为结尾服务的。3．结尾的四种形式：恍然大悟式、开放式、揭秘式、场景式。4．结尾既是内容，又是形式。 c:610

### 第1节 语言的三层结构

1．语言是文章最外在的呈现。2．语言的锤炼是个综合性工作。3．找到自己熟悉的句式，并坚持使用。 c:399

### 第2节 每一句话都不应该是多余的

写作要有真内容、真想法、真感受，一个“真”字，其实就是反啰唆最好的工具。天下写作，唯真不破，以真诚的态度对待写作，对待文字，对待读者，多半就不会出现满篇废话的情况。1．语言一要准确，二要精炼。2．避免文章废话的四种方法：词义准确、句意明确、语意丰富、结构清晰。3．真诚，不凑字数，不糊弄读者 c:437

### 第3节 细节大过天

1．细节描写体现写作者的功力。2．细节描写的三种方法：场面描写、侧面描写、环境描写。3．写人物的抓住人物性格，写事件的抓住戏剧性瞬间。4．侧面描写的三种方法：外人评价、外界反馈、两侧包抄。5．环境描写的三种方法：自然环境、闯入者、宏观环境。6．细节描写和叙述交替出现，读者才能抓住重点。7．细节描写带来画面感和沉浸感。 c:670

### 第4节 学会写对话，你就赢了一半

水到渠成必须要出现的时候才出现。 c:261

### 第5节 好文章是改出来的

1．改文章是无限接近完美的过程。2．改文章的五个层面：词、句、段、结构、点睛之笔。3．除了自查，改文章还应该多听听他人的意见。4．写作者要改出好文章，也要相信“改，出好文章”。 c:441

### 第1节 有模板，写作不难

分析类模板包含六大模块，分别是摘要、陈述、对比、分析、建议和参考资料附录。 c:591

### 第2节 会模仿，一切简单

模仿