text:
// Copyright 2019-2022, University of Colorado Boulder

/**
 * Either horizontal or vertical, with helper values.  Moved from Area Model Common on Nov 7, 2019
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 * @author Sam Reid (PhET Interactive Simulations)
 */

import phetCore from './phetCore.js';
import Enumeration from './Enumeration.js';
import EnumerationValue from './EnumerationValue.js';
import Constructor from './types/Constructor.js';
import IntentionalAny from './types/IntentionalAny.js';

// So we don't introduce a dependency on phetcommon
type MVT = {
  modelToViewX: ( n: number ) => number;
  modelToViewY: ( n: number ) => number;
  viewToModelX: ( n: number ) => number;
  viewToModelY: ( n: number ) => number;
};

class Orientation extends EnumerationValue {

  public static HORIZONTAL = new Orientation( 'x', 'centerX', 'minX', 'maxX', 'left', 'right', 'rectX', 'rectWidth', 'horizontal', 'width', 'column', 'preferredWidth', 'localPreferredWidth', 'widthSizable',
    ( modelViewTransform, value ) => modelViewTransform.modelToViewX( value ),
    ( modelViewTransform, value ) => modelViewTransform.viewToModelX( value ),
    // Pad with zeros to support up to Vector4
    <T>( a: number, b: number, VectorType: Constructor<T> ): T => new VectorType( a, b, 0, 0 )
  );

  public static VERTICAL = new Orientation( 'y', 'centerY', 'minY', 'maxY', 'top', 'bottom', 'rectY', 'rectHeight', 'vertical', 'height', 'row', 'preferredHeight', 'localPreferredHeight', 'heightSizable',
    ( modelViewTransform, value ) => modelViewTransform.modelToViewY( value ),
    ( modelViewTransform, value ) => modelViewTransform.viewToModelY( value ),
    // Pad with zeros to support up to Vector4
    <T>( a: number, b: number, VectorType: Constructor<T> ) => new VectorType( b, a, 0, 0 )
  );

  public static enumeration = new Enumeration( Orientation, {
    phetioDocumentation: 'Horizontal or vertical orientation'
  } );

  public readonly coordinate: 'x' | 'y'; // So you can position things like node[ orientation.coordinate ] = value
  public readonly centerCoordinate: 'centerX' | 'centerY'; // So you can center things like node[ orientation.centerCoordinate ] = value
  public readonly minCoordinate: 'minX' | 'minY'; // So you can center things like bounds[ orientation.minCoordinate ] = value
  public readonly maxCoordinate: 'maxX' | 'maxY'; // So you can center things like bounds[ orientation.maxCoordinate ] = value
  public readonly minSide: 'left' | 'top'; // For getting the minimal/maximal values from bounds/nodes
  public readonly maxSide: 'right' | 'bottom';
  public readonly rectCoordinate: 'rectX' | 'rectY'; // For being able to handle Rectangles (x/y) and (width/height)
  public readonly rectSize: 'rectWidth' | 'rectHeight';
  public readonly flowBoxOrientation: 'horizontal' | 'vertical'; // The name of the orientation when used for FlowBox
  public readonly size: 'width' | 'height';
  public readonly line: 'column' | 'row';
  public readonly preferredSize: 'preferredWidth' | 'preferredHeight';
  public readonly localPreferredSize: 'localPreferredWidth' | 'localPreferredHeight';
  public readonly sizable: 'widthSizable' | 'heightSizable';
  public readonly ariaOrientation: 'horizontal' | 'vertical'; // The value of the aria-orientation attribute for this Orientation.

  // Returns the single coordinate transformed by the appropriate dimension.
  public modelToView: ( m: MVT, n: number ) => number;
  public viewToModel: ( m: MVT, n: number ) => number;

  // Creates a vector (primary,secondary) for horizontal orientations, and (secondary,primary) for vertical orientations.
  public toVector: <T>( n: number, m: number, VectorType: Constructor<T> ) => T;

  // @ts-ignore - Assigned after instantiation, see below
  public opposite: Orientation;

  public constructor( coordinate: 'x' | 'y',
               centerCoordinate: 'centerX' | 'centerY',
               minCoordinate: 'minX' | 'minY',
               maxCoordinate: 'maxX' | 'maxY',
               minSide: 'left' | 'top',
               maxSide: 'right' | 'bottom',
               rectCoordinate: 'rectX' | 'rectY',
               rectSize: 'rectWidth' | 'rectHeight',
               flowBoxOrientation: 'horizontal' | 'vertical',
               size: 'width' | 'height',
               line: 'column' | 'row',
               preferredSize: 'preferredWidth' | 'preferredHeight',
               localPreferredSize: 'localPreferredWidth' | 'localPreferredHeight',
               sizable: 'widthSizable' | 'heightSizable',
               modelToView: ( m: MVT, n: number ) => number,
               viewToModel: ( m: MVT, n: number ) => number, toVector: <T>( n: number, m: number, VectorType: new ( x: number, y: number, ...args: IntentionalAny[] ) => T ) => T ) {

    super();
    this.coordinate = coordinate;
    this.centerCoordinate = centerCoordinate;
    this.minCoordinate = minCoordinate;
    this.maxCoordinate = maxCoordinate;
    this.minSide = minSide;
    this.maxSide = maxSide;
    this.rectCoordinate = rectCoordinate;
    this.rectSize = rectSize;
    this.flowBoxOrientation = flowBoxOrientation;
    this.size = size;
    this.line = line;
    this.preferredSize = preferredSize;
    this.localPreferredSize = localPreferredSize;
    this.sizable = sizable;
    this.ariaOrientation = flowBoxOrientation;
    this.modelToView = modelToView;
    this.viewToModel = viewToModel;
    this.toVector = toVector;
  }
}

// Set up opposites as object references (circular)
Orientation.HORIZONTAL.opposite = Orientation.VERTICAL;
Orientation.VERTICAL.opposite = Orientation.HORIZONTAL;

phetCore.register( 'Orientation', Orientation );
export default Orientation;


text:
WebRtcLoggingMessageFilter::WebRtcLoggingMessageFilter(
    const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner)
    : io_task_runner_(io_task_runner),
      log_message_delegate_(NULL),
      sender_(NULL) {
  // May be null in a browsertest using MockRenderThread.
  if (io_task_runner_.get()) {
    io_task_runner_->PostTask(
        FROM_HERE, base::Bind(
            &WebRtcLoggingMessageFilter::CreateLoggingHandler,
            base::Unretained(this)));
  }
}

WebRtcLoggingMessageFilter::~WebRtcLoggingMessageFilter() {
}

bool WebRtcLoggingMessageFilter::OnMessageReceived(
    const IPC::Message& message) {
  DCHECK(io_task_runner_->BelongsToCurrentThread());
  bool handled = true;
  IPC_BEGIN_MESSAGE_MAP(WebRtcLoggingMessageFilter, message)
    IPC_MESSAGE_HANDLER(WebRtcLoggingMsg_StartLogging, OnStartLogging)
    IPC_MESSAGE_HANDLER(WebRtcLoggingMsg_StopLogging, OnStopLogging)
    IPC_MESSAGE_UNHANDLED(handled = false)
  IPC_END_MESSAGE_MAP()
  return handled;
}

void WebRtcLoggingMessageFilter::OnFilterAdded(IPC::Sender* sender) {
  DCHECK(!io_task_runner_.get() || io_task_runner_->BelongsToCurrentThread());
  sender_ = sender;
}

void WebRtcLoggingMessageFilter::OnFilterRemoved() {
  DCHECK(!io_task_runner_.get() || io_task_runner_->BelongsToCurrentThread());
  sender_ = NULL;
  log_message_delegate_->OnFilterRemoved();
}

void WebRtcLoggingMessageFilter::OnChannelClosing() {
  DCHECK(!io_task_runner_.get() || io_task_runner_->BelongsToCurrentThread());
  sender_ = NULL;
  log_message_delegate_->OnFilterRemoved();
}

void WebRtcLoggingMessageFilter::AddLogMessages(
    const std::vector<WebRtcLoggingMessageData>& messages) {
  DCHECK(io_task_runner_->BelongsToCurrentThread());
  Send(new WebRtcLoggingMsg_AddLogMessages(messages));
}

void WebRtcLoggingMessageFilter::LoggingStopped() {
  DCHECK(!io_task_runner_.get() || io_task_runner_->BelongsToCurrentThread());
  Send(new WebRtcLoggingMsg_LoggingStopped());
}

void WebRtcLoggingMessageFilter::CreateLoggingHandler() {
  DCHECK(!io_task_runner_.get() || io_task_runner_->BelongsToCurrentThread());
  log_message_delegate_ =
      new ChromeWebRtcLogMessageDelegate(io_task_runner_, this);
}

void WebRtcLoggingMessageFilter::OnStartLogging() {
  DCHECK(!io_task_runner_.get() || io_task_runner_->BelongsToCurrentThread());
  log_message_delegate_->OnStartLogging();
}

void WebRtcLoggingMessageFilter::OnStopLogging() {
  DCHECK(!io_task_runner_.get() || io_task_runner_->BelongsToCurrentThread());
  log_message_delegate_->OnStopLogging();
}

void WebRtcLoggingMessageFilter::Send(IPC::Message* message) {
  DCHECK(!io_task_runner_.get() || io_task_runner_->BelongsToCurrentThread());
  if (!sender_) {
    DLOG(ERROR) << "IPC sender not available.";
    delete message;
  } else {
    sender_->Send(message);
  }
}

redpajama_set_name: RedPajamaGithub


text:
layout: posts
title: "Bazel 3.6"
authors:
  - laurentlb
---

[Bazel 3.6](https://github.com/bazelbuild/bazel/releases/tag/3.6.0) is a [minor
release](https://docs.bazel.build/versions/3.6.0/backward-compatibility.html).
It is an incremental update to Bazel 3.5.

## Incompatible changes

*   The prelude file (`//tools/build_rules:prelude_bazel`) is now processed as
    a Starlark module, rather than being sourced into the BUILD file textually.
    This may cause slight breakages depending on the content of the prelude
    file. For more details, see the discussion in [issue
    #11940](https://github.com/bazelbuild/bazel/issues/11940).
*   The flag `--experimental_ui_limit_console_output` is removed. If you
    use `--experimental_ui_limit_console_output=1` to silence terminal
    output, you should use `--ui_event_filters=` instead.
*   The flag `--proto:instantiation_stack` must be enabled with
    `--record_rule_instantiation_callstack` to see call stack in proto output
    from Bazel query.
*   A few other flags are removed:
    `--experimental_ignore_deprecated_instrumentation_spec`,
    `--experimental_transparent_compression`, `--experimental_action_args`, and
    `--incompatible_no_support_tools_in_action_inputs`.

## Android

*   NDK 21 is now supported.
*   Building Android apps for legacy multidex (pre-L) now requires a main-dex
    list if the application does not fit into a single DEX file.

## C++

*   [`cc_common.compile`](https://docs.bazel.build/versions/master/skylark/lib/cc_common.html#compile)
    now supports `include_prefix` and `strip_include_prefix`.

## External repositories

*   Stop needlessly parsing WORKSPACE files from external repositories.
*   Dot (`.`) is now allowed in workspace names. See [issue #11837](https://github.com/bazelbuild/bazel/issues/11837).

## Starlark

*   In Starlark, the Args object supports a new parameter file format
    `flag_per_line`, compatible with the Abseil flags library.
*   The Starlark interpreter now correctly emits an error if the operand of the
	first loop in a list comprehension refers to a variable bound by a later
	loop, such as y in this example:
	```python
    [e1 for x in f(**y**) in e2 for y in e3] # error: undefined y`
    ```
    This may cause latent dynamic errors to become static errors.

## Execution

*   Added the `--experimental_worker_max_multiplex_instances` flag to configure
    the number of WorkRequests that are sent concurrently to one multiplex
    worker process. This flag has the same syntax as the
    `--worker-max-instances` flag. The `--worker_max_instances` flag are no
    longer used to determine max instances for multiplex workers, because the
    two have different resource requirements. Multiplex workers have an
    8-instance maximum, by default.
*   Added the `--experimental_worker_multiplex` flag, which is enabled by
    default. When enabled, multiplex workers are used for all mnemonics that
    support them.
*   Added support for a `supports-graceful-termination` execution requirement
    and tag, which causes Bazel to send a SIGTERM to any tagged actions before
    sending a delayed SIGKILL. This is to give actions, and more specifically
    tests, a chance to clean up after themselves.

## Other changes

*   Bazel now skips printing action stdout/stderr contents if they exceed
    `--experimental_ui_max_stdouterr_memory_bytes`.
*   A description of the Bazel codebase is now available in
    [CODEBASE.md](https://github.com/bazelbuild/bazel/blob/master/CODEBASE.md#the-bazel-code-base),
    in the root of the Bazel repository. This can be useful to people willing to
    contribute to Bazel.

## Contributors

This release contains contributions from many people at Google, as well as
Benjamin Peterson, Daniel Wagner-Hall, David Ostrovsky, Emil Kattainen, George
Gensure, Keith Smiley, Michael Eisel, Per Halvor Tryggeseth, Ruixin Bao, Samuel
Giddins, Steeve Morin, Thi Doan, Tom de Goede, Ulf Adams, Zhongpeng Lin, and
mai12.


text:
using UnityEngine;

#if UNITY_EDITOR
using UnityEditor;
#endif
namespace Lockstep
{
	public static class LSFSettingsManager
	{
		public const string DEFAULT_SETTINGS_NAME = "DefaultLockstepFrameworkSettings";
		public const string SETTINGS_NAME = "LockstepFrameworkSettings";
		static LSFSettings MainSettings;

		static LSFSettingsManager()
		{
			Initialize();
		}
		static void Initialize()
		{
			LSFSettings settings = Resources.Load<LSFSettings>(SETTINGS_NAME);

#if UNITY_EDITOR
			if (settings == null)
			{
				if (Application.isPlaying == false)
				{

					settings = ScriptableObject.CreateInstance<LSFSettings>();
					if (!System.IO.Directory.Exists(Application.dataPath + "/Resources"))
						AssetDatabase.CreateFolder("Assets", "Resources");
					AssetDatabase.CreateAsset(settings, "Assets/Resources/" + SETTINGS_NAME + ".asset");
					AssetDatabase.SaveAssets();
					AssetDatabase.Refresh();
					Debug.Log("Successfuly created new settings file.");
				}
				else
				{
				}
			}
#endif

			MainSettings = settings;
			if (MainSettings == null)
			{
				settings = Resources.Load<LSFSettings>(DEFAULT_SETTINGS_NAME);
				Debug.Log("No settings found. Loading default settings.");
			}

		}

		public static LSFSettings GetSettings()
		{

			if (MainSettings == null)
				Initialize();
			return MainSettings;
		}

	}
}


text:
class TYPESHARED_EXPORT Boolean
{
public:
    Boolean(void);
    Boolean(const bool is);
    bool is(void) const;
    void set(const bool is=true);
    bool operator () (void) const;

private:
    bool mValue = false;
    bool mValid = false;
};

#endif // BOOLEAN_H


text:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
	"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
	"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
	<constant name="struts.devMode" value="true" />
	<constant name="struts.enable.DynamicMethodInvocation" value="true" />
	<constant name="struts.i18n.encoding" value="GBK" />
	<package name="Mao" namespace="/hw" extends="struts-default">
		<action name="HelloWorld">
			<result>
				/Jsps/HelloWorld.jsp
			</result>
		</action>
		<action name="C" class="Demo.HelloWorld">
			<result name="d">
				/Jsps/HelloWorld.jsp
			</result>
			<result name="c">
				/Jsps/Error.jsp
			</result>
		</action>
		<action name="*_*" class="Demo.Curl" method="{1}">
			<result name="{2}">
				/Jsps/{1}{2}.jsp
			</result>
			<!--这里是通配符,1和2 一一对应 -->
		</action>
	</package>
</struts>


text:
package org.apache.flink.streaming.connectors.kafka.table;

import org.apache.flink.api.common.serialization.DeserializationSchema;
import org.apache.flink.api.common.serialization.SerializationSchema;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.functions.sink.SinkFunction;
import org.apache.flink.streaming.api.functions.source.SourceFunction;
import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer;
import org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer;
import org.apache.flink.streaming.connectors.kafka.config.StartupMode;
import org.apache.flink.table.api.DataTypes;
import org.apache.flink.table.api.TableSchema;
import org.apache.flink.table.api.ValidationException;
import org.apache.flink.table.catalog.CatalogTable;
import org.apache.flink.table.catalog.CatalogTableImpl;
import org.apache.flink.table.catalog.ObjectIdentifier;
import org.apache.flink.table.connector.ChangelogMode;
import org.apache.flink.table.connector.format.DecodingFormat;
import org.apache.flink.table.connector.format.EncodingFormat;
import org.apache.flink.table.connector.sink.DynamicTableSink;
import org.apache.flink.table.connector.sink.SinkFunctionProvider;
import org.apache.flink.table.connector.source.DynamicTableSource;
import org.apache.flink.table.connector.source.ScanTableSource;
import org.apache.flink.table.connector.source.SourceFunctionProvider;
import org.apache.flink.table.data.RowData;
import org.apache.flink.table.factories.FactoryUtil;
import org.apache.flink.table.factories.TestFormatFactory;
import org.apache.flink.table.runtime.connector.sink.SinkRuntimeProviderContext;
import org.apache.flink.table.runtime.connector.source.ScanRuntimeProviderContext;
import org.apache.flink.table.types.AtomicDataType;
import org.apache.flink.table.types.DataType;
import org.apache.flink.table.types.logical.VarCharType;
import org.apache.flink.util.TestLogger;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.function.Consumer;

import static org.apache.flink.core.testutils.FlinkMatchers.containsCause;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

/**
 * Test for {@link UpsertKafkaDynamicTableFactory}.
 */
public class UpsertKafkaDynamicTableFactoryTest extends TestLogger {

	private static final String SOURCE_TOPIC = "sourceTopic_1";

	private static final String SINK_TOPIC = "sinkTopic";

	private static final TableSchema SOURCE_SCHEMA = TableSchema.builder()
			.field("window_start", DataTypes.STRING().notNull())
			.field("region", DataTypes.STRING().notNull())
			.field("view_count", DataTypes.BIGINT())
			.primaryKey("window_start", "region")
			.build();

	private static final int[] SOURCE_KEY_FIELDS = new int[]{0, 1};

	private static final int[] SOURCE_VALUE_FIELDS = new int[]{0, 1, 2};

	private static final TableSchema SINK_SCHEMA = TableSchema.builder()
			.field("region", new AtomicDataType(new VarCharType(false, 100)))
			.field("view_count", DataTypes.BIGINT())
			.primaryKey("region")
			.build();

	private static final int[] SINK_KEY_FIELDS = new int[]{0};

	private static final int[] SINK_VALUE_FIELDS = new int[]{0, 1};

	private static final Properties UPSERT_KAFKA_SOURCE_PROPERTIES = new Properties();
	private static final Properties UPSERT_KAFKA_SINK_PROPERTIES = new Properties();

	static {
		UPSERT_KAFKA_SOURCE_PROPERTIES.setProperty("bootstrap.servers", "dummy");

		UPSERT_KAFKA_SINK_PROPERTIES.setProperty("bootstrap.servers", "dummy");
	}

	@Rule
	public ExpectedException thrown = ExpectedException.none();

	@Test
	public void testTableSource() {
		final DataType producedDataType = SOURCE_SCHEMA.toPhysicalRowDataType();

		DecodingFormat<DeserializationSchema<RowData>> keyDecodingFormat =
				new TestFormatFactory.DecodingFormatMock(
						",", true, ChangelogMode.insertOnly(), Collections.emptyMap());

		DecodingFormat<DeserializationSchema<RowData>> valueDecodingFormat =
				new TestFormatFactory.DecodingFormatMock(
						",", true, ChangelogMode.insertOnly(), Collections.emptyMap());

		// Construct table source using options and table source factory
		final DynamicTableSource actualSource = createActualSource(SOURCE_SCHEMA, getFullSourceOptions());

		final KafkaDynamicSource expectedSource = createExpectedScanSource(
				producedDataType,
				keyDecodingFormat,
				valueDecodingFormat,
				SOURCE_KEY_FIELDS,
				SOURCE_VALUE_FIELDS,
				null,
				SOURCE_TOPIC,
				UPSERT_KAFKA_SOURCE_PROPERTIES);
		assertEquals(actualSource, expectedSource);

		final KafkaDynamicSource actualUpsertKafkaSource = (KafkaDynamicSource) actualSource;
		ScanTableSource.ScanRuntimeProvider provider =
				actualUpsertKafkaSource.getScanRuntimeProvider(ScanRuntimeProviderContext.INSTANCE);
		assertThat(provider, instanceOf(SourceFunctionProvider.class));
		final SourceFunctionProvider sourceFunctionProvider = (SourceFunctionProvider) provider;
		final SourceFunction<RowData> sourceFunction = sourceFunctionProvider.createSourceFunction();
		assertThat(sourceFunction, instanceOf(FlinkKafkaConsumer.class));
	}

	@Test
	public void testTableSink() {
		EncodingFormat<SerializationSchema<RowData>> keyEncodingFormat =
				new TestFormatFactory.EncodingFormatMock(",", ChangelogMode.insertOnly());
		EncodingFormat<SerializationSchema<RowData>> valueEncodingFormat =
				new TestFormatFactory.EncodingFormatMock(",", ChangelogMode.insertOnly());

		// Construct table sink using options and table sink factory.
		final DynamicTableSink actualSink = createActualSink(SINK_SCHEMA, getFullSinkOptions());

		final DynamicTableSink expectedSink = createExpectedSink(
				SINK_SCHEMA.toPhysicalRowDataType(),
				keyEncodingFormat,
				valueEncodingFormat,
				SINK_KEY_FIELDS,
				SINK_VALUE_FIELDS,
				null,
				SINK_TOPIC,
				UPSERT_KAFKA_SINK_PROPERTIES,
				null);

		// Test sink format.
		final KafkaDynamicSink actualUpsertKafkaSink = (KafkaDynamicSink) actualSink;
		assertEquals(expectedSink, actualSink);

		// Test kafka producer.
		DynamicTableSink.SinkRuntimeProvider provider =
				actualUpsertKafkaSink.getSinkRuntimeProvider(new SinkRuntimeProviderContext(false));
		assertThat(provider, instanceOf(SinkFunctionProvider.class));
		final SinkFunctionProvider sinkFunctionProvider = (SinkFunctionProvider) provider;
		final SinkFunction<RowData> sinkFunction = sinkFunctionProvider.createSinkFunction();
		assertThat(sinkFunction, instanceOf(FlinkKafkaProducer.class));
	}

	@Test
	public void testTableSinkWithParallelism() {
		final Map<String, String> modifiedOptions = getModifiedOptions(
			getFullSinkOptions(),
			options -> options.put("sink.parallelism", "100"));
		final DynamicTableSink actualSink = createActualSink(SINK_SCHEMA, modifiedOptions);

		EncodingFormat<SerializationSchema<RowData>> keyEncodingFormat =
			new TestFormatFactory.EncodingFormatMock(",", ChangelogMode.insertOnly());
		EncodingFormat<SerializationSchema<RowData>> valueEncodingFormat =
			new TestFormatFactory.EncodingFormatMock(",", ChangelogMode.insertOnly());

		final DynamicTableSink expectedSink = createExpectedSink(
			SINK_SCHEMA.toPhysicalRowDataType(),
			keyEncodingFormat,
			valueEncodingFormat,
			SINK_KEY_FIELDS,
			SINK_VALUE_FIELDS,
			null,
			SINK_TOPIC,
			UPSERT_KAFKA_SINK_PROPERTIES,
			100);
		assertEquals(expectedSink, actualSink);

		final DynamicTableSink.SinkRuntimeProvider provider =
			actualSink.getSinkRuntimeProvider(new SinkRuntimeProviderContext(false));
		assertThat(provider, instanceOf(SinkFunctionProvider.class));
		final SinkFunctionProvider sinkFunctionProvider = (SinkFunctionProvider) provider;
		assertTrue(sinkFunctionProvider.getParallelism().isPresent());
		assertEquals(100, (long) sinkFunctionProvider.getParallelism().get());
	}

	// --------------------------------------------------------------------------------------------
	// Negative tests
	// --------------------------------------------------------------------------------------------

	@Test
	public void testCreateSourceTableWithoutPK() {
		thrown.expect(ValidationException.class);
		thrown.expect(containsCause(new ValidationException("'upsert-kafka' tables require to define a PRIMARY KEY constraint. " +
				"The PRIMARY KEY specifies which columns should be read from or write to the Kafka message key. " +
				"The PRIMARY KEY also defines records in the 'upsert-kafka' table should update or delete on which keys.")));

		TableSchema illegalSchema = TableSchema.builder()
				.field("window_start", DataTypes.STRING())
				.field("region", DataTypes.STRING())
				.field("view_count", DataTypes.BIGINT())
				.build();
		createActualSource(illegalSchema, getFullSinkOptions());
	}

	@Test
	public void testCreateSinkTableWithoutPK() {
		thrown.expect(ValidationException.class);
		thrown.expect(containsCause(new ValidationException("'upsert-kafka' tables require to define a PRIMARY KEY constraint. " +
				"The PRIMARY KEY specifies which columns should be read from or write to the Kafka message key. " +
				"The PRIMARY KEY also defines records in the 'upsert-kafka' table should update or delete on which keys.")));

		TableSchema illegalSchema = TableSchema.builder()
				.field("region", DataTypes.STRING())
				.field("view_count", DataTypes.BIGINT())
				.build();
		createActualSink(illegalSchema, getFullSinkOptions());
	}

	@Test
	public void testSerWithCDCFormatAsValue() {
		thrown.expect(ValidationException.class);
		thrown.expect(containsCause(
				new ValidationException(String.format(
						"'upsert-kafka' connector doesn't support '%s' as value format, " +
								"because '%s' is not in insert-only mode.",
						TestFormatFactory.IDENTIFIER, TestFormatFactory.IDENTIFIER
				))));

		createActualSink(SINK_SCHEMA,
				getModifiedOptions(
						getFullSinkOptions(),
						options -> options.put(
								String.format("value.%s.%s", TestFormatFactory.IDENTIFIER, TestFormatFactory.CHANGELOG_MODE.key()),
								"I;UA;UB;D")));
	}

	@Test
	public void testDeserWithCDCFormatAsValue() {
		thrown.expect(ValidationException.class);
		thrown.expect(containsCause(
				new ValidationException(String.format(
						"'upsert-kafka' connector doesn't support '%s' as value format, " +
								"because '%s' is not in insert-only mode.",
						TestFormatFactory.IDENTIFIER,
						TestFormatFactory.IDENTIFIER
				))));

		createActualSource(SOURCE_SCHEMA,
				getModifiedOptions(
						getFullSinkOptions(),
						options -> options.put(
								String.format("value.%s.%s", TestFormatFactory.IDENTIFIER, TestFormatFactory.CHANGELOG_MODE.key()),
								"I;UA;UB;D")));
	}

	// --------------------------------------------------------------------------------------------
	// Utilities
	// --------------------------------------------------------------------------------------------

	/**
	 * Returns the full options modified by the given consumer {@code optionModifier}.
	 *
	 * @param optionModifier Consumer to modify the options
	 */
	private static Map<String, String> getModifiedOptions(
			Map<String, String> options,
			Consumer<Map<String, String>> optionModifier) {
		optionModifier.accept(options);
		return options;
	}

	private static Map<String, String> getFullSourceOptions() {
		// table options
		Map<String, String> options = new HashMap<>();
		options.put("connector", UpsertKafkaDynamicTableFactory.IDENTIFIER);
		options.put("topic", SOURCE_TOPIC);
		options.put("properties.bootstrap.servers", "dummy");
		// key format options
		options.put("key.format", TestFormatFactory.IDENTIFIER);
		options.put(
				String.format("key.%s.%s", TestFormatFactory.IDENTIFIER, TestFormatFactory.DELIMITER.key()), ",");
		options.put(
				String.format("key.%s.%s", TestFormatFactory.IDENTIFIER, TestFormatFactory.FAIL_ON_MISSING.key()), "true");
		options.put(
				String.format("key.%s.%s", TestFormatFactory.IDENTIFIER, TestFormatFactory.CHANGELOG_MODE.key()), "I");
		// value format options
		options.put("value.format", TestFormatFactory.IDENTIFIER);
		options.put(
				String.format("value.%s.%s", TestFormatFactory.IDENTIFIER, TestFormatFactory.DELIMITER.key()), ",");
		options.put(
				String.format("value.%s.%s", TestFormatFactory.IDENTIFIER, TestFormatFactory.FAIL_ON_MISSING.key()), "true");
		options.put(
				String.format("value.%s.%s", TestFormatFactory.IDENTIFIER, TestFormatFactory.CHANGELOG_MODE.key()), "I");
		return options;
	}

	private static Map<String, String> getFullSinkOptions() {
		Map<String, String> options = new HashMap<>();
		options.put("connector", UpsertKafkaDynamicTableFactory.IDENTIFIER);
		options.put("topic", SINK_TOPIC);
		options.put("properties.bootstrap.servers", "dummy");
		// key format options
		options.put("value.format", TestFormatFactory.IDENTIFIER);
		options.put(
				String.format("key.%s.%s", TestFormatFactory.IDENTIFIER, TestFormatFactory.DELIMITER.key()), ",");
		options.put(
				String.format("key.%s.%s", TestFormatFactory.IDENTIFIER, TestFormatFactory.CHANGELOG_MODE.key()), "I"
		);
		// value format options
		options.put("key.format", TestFormatFactory.IDENTIFIER);
		options.put(
				String.format("value.%s.%s", TestFormatFactory.IDENTIFIER, TestFormatFactory.DELIMITER.key()), ",");
		options.put(
				String.format("value.%s.%s", TestFormatFactory.IDENTIFIER, TestFormatFactory.CHANGELOG_MODE.key()), "I"
		);
		return options;
	}

	private static DynamicTableSource createActualSource(TableSchema schema, Map<String, String> options) {
		ObjectIdentifier objectIdentifier = ObjectIdentifier.of(
				"default",
				"default",
				"sourceTable");
		final CatalogTable sourceTable =
				new CatalogTableImpl(schema, options, "sinkTable");

		return FactoryUtil.createTableSource(
				null,
				objectIdentifier,
				sourceTable,
				new Configuration(),
				Thread.currentThread().getContextClassLoader(),
				false);
	}

	private static DynamicTableSink createActualSink(TableSchema schema, Map<String, String> options) {
		ObjectIdentifier objectIdentifier = ObjectIdentifier.of(
				"default",
				"default",
				"sinkTable");
		final CatalogTable sinkTable =
				new CatalogTableImpl(schema, options, "sinkTable");
		return FactoryUtil.createTableSink(
				null,
				objectIdentifier,
				sinkTable,
				new Configuration(),
				Thread.currentThread().getContextClassLoader(),
				false);
	}

	private static KafkaDynamicSource createExpectedScanSource(
			DataType producedDataType,
			DecodingFormat<DeserializationSchema<RowData>> keyDecodingFormat,
			DecodingFormat<DeserializationSchema<RowData>> valueDecodingFormat,
			int[] keyFields,
			int[] valueFields,
			String keyPrefix,
			String topic,
			Properties properties) {
		return new KafkaDynamicSource(
				producedDataType,
				keyDecodingFormat,
				new UpsertKafkaDynamicTableFactory.DecodingFormatWrapper(valueDecodingFormat),
				keyFields,
				valueFields,
				keyPrefix,
				Collections.singletonList(topic),
				null,
				properties,
				StartupMode.EARLIEST,
				Collections.emptyMap(),
				0,
				true);
	}

	private static KafkaDynamicSink createExpectedSink(
			DataType consumedDataType,
			EncodingFormat<SerializationSchema<RowData>> keyEncodingFormat,
			EncodingFormat<SerializationSchema<RowData>> valueEncodingFormat,
			int[] keyProjection,
			int[] valueProjection,
			String keyPrefix,
			String topic,
			Properties properties,
			Integer parallelism) {
		return new KafkaDynamicSink(
				consumedDataType,
				keyEncodingFormat,
				new UpsertKafkaDynamicTableFactory.EncodingFormatWrapper(valueEncodingFormat),
				keyProjection,
				valueProjection,
				keyPrefix,
				topic,
				properties,
				null,
				KafkaSinkSemantic.AT_LEAST_ONCE,
				true,
				parallelism);
	}
}


text:
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Testing;
using Xunit;
using VerifyCS = Test.Utilities.CSharpCodeFixVerifier<
    Microsoft.NetCore.CSharp.Analyzers.Resources.CSharpMarkAssembliesWithNeutralResourcesLanguageAnalyzer,
    Microsoft.CodeAnalysis.Testing.EmptyCodeFixProvider>;
using VerifyVB = Test.Utilities.VisualBasicCodeFixVerifier<
    Microsoft.NetCore.VisualBasic.Analyzers.Resources.BasicMarkAssembliesWithNeutralResourcesLanguageAnalyzer,
    Microsoft.CodeAnalysis.Testing.EmptyCodeFixProvider>;

namespace Microsoft.NetCore.Analyzers.Resources.UnitTests
{
    public class MarkAssembliesWithNeutralResourcesLanguageTests
    {
        private const string CSharpDesignerFile = @"
namespace DesignerFile {
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute(""System.Resources.Tools.StronglyTypedResourceBuilder"", ""4.0.0.0"")]
    internal class Resource1 { }
}";

        private const string BasicDesignerFile = @"
Namespace My.Resources
    <Global.System.CodeDom.Compiler.GeneratedCodeAttribute(""System.Resources.Tools.StronglyTypedResourceBuilder"", ""4.0.0.0"")> _
    Friend Class Resource1
    End Class
End Namespace";

        [Fact]
        public async Task TestCSharpNoResourceFileAsync()
        {
            await VerifyCS.VerifyAnalyzerAsync(@"class C {}");
        }

        [Fact]
        public async Task TestBasicNoResourceFileAsync()
        {
            await VerifyVB.VerifyAnalyzerAsync(@"Class C
End Class");
        }

        [Fact]
        public async Task TestCSharpResourceFileAsync()
        {
            await VerifyCSharpWithDependenciesAsync(@"class C {}", VerifyCS.Diagnostic());
        }

        [Fact]
        public async Task TestBasicResourceFileAsync()
        {
            await VerifyBasicWithDependenciesAsync(@"Class C
End Class", VerifyVB.Diagnostic());
        }

        [Fact]
        public async Task TestCSharpInvalidAttribute1Async()
        {
#pragma warning disable RS0030 // Do not used banned APIs
            await VerifyCSharpWithDependenciesAsync(@"[assembly: System.Resources.NeutralResourcesLanguage("""")]", VerifyCS.Diagnostic().WithLocation(1, 12));
#pragma warning restore RS0030 // Do not used banned APIs
        }

        [Fact]
        public async Task TestCSharpInvalidAttribute2Async()
        {
#pragma warning disable RS0030 // Do not used banned APIs
            await VerifyCSharpWithDependenciesAsync(@"[assembly: System.Resources.NeutralResourcesLanguage(null)]", VerifyCS.Diagnostic().WithLocation(1, 12));
#pragma warning restore RS0030 // Do not used banned APIs
        }

        [Fact]
        public async Task TestBasicInvalidAttribute1Async()
        {
#pragma warning disable RS0030 // Do not used banned APIs
            await VerifyBasicWithDependenciesAsync(@"<Assembly: System.Resources.NeutralResourcesLanguage("""")>", VerifyVB.Diagnostic().WithLocation(1, 2));
#pragma warning restore RS0030 // Do not used banned APIs
        }

        [Fact]
        public async Task TestBasicInvalidAttribute2Async()
        {
#pragma warning disable RS0030 // Do not used banned APIs
            await VerifyBasicWithDependenciesAsync(@"<Assembly: System.Resources.NeutralResourcesLanguage(Nothing)>", VerifyVB.Diagnostic().WithLocation(1, 2));
#pragma warning restore RS0030 // Do not used banned APIs
        }

        [Fact]
        public async Task TestCSharpvalidAttributeAsync()
        {
            await VerifyCSharpWithDependenciesAsync(@"[assembly: System.Resources.NeutralResourcesLanguage(""en"")]");
        }

        [Fact]
        public async Task TestBasicvalidAttributeAsync()
        {
            await VerifyBasicWithDependenciesAsync(@"<Assembly: System.Resources.NeutralResourcesLanguage(""en"")>");
        }

        private async Task VerifyCSharpWithDependenciesAsync(string source, params DiagnosticResult[] expected)
        {
            var csharpTest = new VerifyCS.Test
            {
                TestState =
                {
                    Sources =
                    {
                        source,
                        ("Test.Designer.cs", CSharpDesignerFile),
                    },
                },
            };

            csharpTest.ExpectedDiagnostics.AddRange(expected);

            await csharpTest.RunAsync();
        }

        private async Task VerifyBasicWithDependenciesAsync(string source, params DiagnosticResult[] expected)
        {
            var vbTest = new VerifyVB.Test
            {
                TestState =
                {
                    Sources =
                    {
                        source,
                        ("Test.Designer.vb", BasicDesignerFile),
                    },
                },
            };

            vbTest.ExpectedDiagnostics.AddRange(expected);

            await vbTest.RunAsync();
        }
    }
}


text:
from IPython.lib import passwd
from IPython.lib.security import passwd_check, salt_len
import nose.tools as nt

def test_passwd_structure():
    p = passwd('passphrase')
    algorithm, salt, hashed = p.split(':')
    nt.assert_equals(algorithm, 'sha1')
    nt.assert_equals(len(salt), salt_len)
    nt.assert_equals(len(hashed), 40)

def test_roundtrip():
    p = passwd('passphrase')
    nt.assert_equals(passwd_check(p, 'passphrase'), True)

def test_bad():
    p = passwd('passphrase')
    nt.assert_equals(passwd_check(p, p), False)
    nt.assert_equals(passwd_check(p, 'a:b:c:d'), False)
    nt.assert_equals(passwd_check(p, 'a:b'), False)


text:
import flask

blueprint = flask.Blueprint('voting', __name__, template_folder='templates')

from . import routes


text:
#include "test.h"
__FBSDID("$FreeBSD: head/lib/libarchive/test/test_open_filename.c 191183 2009-04-17 01:06:31Z kientzle $");

DEFINE_TEST(test_open_filename)
{
	char buff[64];
	struct archive_entry *ae;
	struct archive *a;

	/* Write an archive through this FILE *. */
	assert((a = archive_write_new()) != NULL);
	assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_ustar(a));
	assertEqualIntA(a, ARCHIVE_OK, archive_write_set_compression_none(a));
	assertEqualIntA(a, ARCHIVE_OK,
	    archive_write_open_filename(a, "test.tar"));

	/*
	 * Write a file to it.
	 */
	assert((ae = archive_entry_new()) != NULL);
	archive_entry_set_mtime(ae, 1, 0);
	archive_entry_copy_pathname(ae, "file");
	archive_entry_set_mode(ae, S_IFREG | 0755);
	archive_entry_set_size(ae, 8);
	assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
	archive_entry_free(ae);
	assertEqualIntA(a, 8, archive_write_data(a, "12345678", 9));

	/*
	 * Write a second file to it.
	 */
	assert((ae = archive_entry_new()) != NULL);
	archive_entry_copy_pathname(ae, "file2");
	archive_entry_set_mode(ae, S_IFREG | 0755);
	archive_entry_set_size(ae, 819200);
	assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
	archive_entry_free(ae);

	/* Close out the archive. */
	assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a));
	assertEqualInt(ARCHIVE_OK, archive_write_finish(a));

	/*
	 * Now, read the data back.
	 */
	assert((a = archive_read_new()) != NULL);
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a));
	assertEqualIntA(a, ARCHIVE_OK,
	    archive_read_open_filename(a, "test.tar", 512));

	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
	assertEqualInt(1, archive_entry_mtime(ae));
	assertEqualInt(0, archive_entry_mtime_nsec(ae));
	assertEqualInt(0, archive_entry_atime(ae));
	assertEqualInt(0, archive_entry_ctime(ae));
	assertEqualString("file", archive_entry_pathname(ae));
	assert((S_IFREG | 0755) == archive_entry_mode(ae));
	assertEqualInt(8, archive_entry_size(ae));
	assertEqualIntA(a, 8, archive_read_data(a, buff, 10));
	assertEqualMem(buff, "12345678", 8);

	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
	assertEqualString("file2", archive_entry_pathname(ae));
	assert((S_IFREG | 0755) == archive_entry_mode(ae));
	assertEqualInt(819200, archive_entry_size(ae));
	assertEqualIntA(a, ARCHIVE_OK, archive_read_data_skip(a));

	/* Verify the end of the archive. */
	assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
	assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
	assertEqualInt(ARCHIVE_OK, archive_read_finish(a));

	/*
	 * Verify some of the error handling.
	 */
	assert((a = archive_read_new()) != NULL);
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a));
	assertEqualIntA(a, ARCHIVE_FATAL,
	    archive_read_open_filename(a, "nonexistent.tar", 512));
	assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
	assertEqualInt(ARCHIVE_OK, archive_read_finish(a));

}


text:
from .. import NextGenInstanceResource, NextGenListResource
from .statistics import Statistics

class Workflow(NextGenInstanceResource):
    """
    A Workflow resource
    """
    subresources = [
        Statistics,
    ]

    def delete(self):
        """
        Delete a workflow.
        """
        return self.parent.delete_instance(self.name)

    def update(self, **kwargs):
        """
        Update a workflow.
        """
        return self.parent.update_instance(self.name, kwargs)

class Workflows(NextGenListResource):
    """ A list of Workflow resources """

    name = "Workflows"
    instance = Workflow

    def create(self, friendly_name, configuration, assignment_callback_url,
               **kwargs):
        """
        Create a Workflow.

        :param friendly_name: A string representing a human readable name for
            this Workflow. Examples include 'Inbound Call Workflow' or '2014
            Outbound Campaign'.
        :param configuration: JSON document configuring the rules for this
            Workflow.
        :param assignment_callback_url: A valid URL for the application that
            will process task assignment events.
        :param fallback_assignment_callback_url: If the request to the
            assignment_callback_url fails, the assignment callback will be made
            to this URL.
        :param task_reservation_timeout: An integer value controlling how long
            in seconds Work Distribution Service will wait for a confirmation
            response from your application after assigning a Task to a worker.
            Defaults to 120 seconds.
        """
        kwargs['friendly_name'] = friendly_name
        kwargs['configuration'] = configuration
        kwargs['assignment_callback_url'] = assignment_callback_url
        return self.create_instance(kwargs)

    def delete(self, sid):
        """
        Delete the given workflow
        """
        return self.delete_instance(sid)

    def update(self, sid, **kwargs):
        """
        Update a :class:`Workflow` with the given parameters.

        All the parameters are describe above in :meth:`create`
        """
        return self.update_instance(sid, kwargs)


text:
package com.att.xgen;

import java.io.PrintWriter;
import java.io.Writer;
import java.util.Stack;

import com.att.inno.env.util.IndentPrintWriter;
import com.att.inno.env.util.StringBuilderWriter;

public class XGen<RT extends XGen<RT>> {

	public static int COMMENT_COLUMN = 40;
	private StringBuilder backSB = new StringBuilder();
	private Stack<Back> backStack = new Stack<Back>();

	protected XGen(Writer w) {
		forward = new IndentPrintWriter(w);
	}

	public int pushBack(Back b) {
		int rv = backStack.size();
		backStack.push(b);
		return rv;
	}

	public boolean pretty = false;
	protected IndentPrintWriter forward;

	public IndentPrintWriter getWriter() {
		return forward;
	}

	protected PrintWriter back = new PrintWriter(
				new StringBuilderWriter(backSB));

	@SuppressWarnings("unchecked")
	public RT pretty() {
		pretty = true;
		return (RT) this;
	}

	protected void prettyln(PrintWriter pw) {
		if(pretty)pw.println();
	}

	public RT leaf(Mark mark, String tag, String ... args) {
		mark.spot = backStack.size();
		return leaf(tag, args);
	}

	@SuppressWarnings("unchecked")
	public RT leaf(String tag, String ... attrs) {
		forward.append('<');
		forward.append(tag);
		addAttrs(attrs);
		forward.append('>');
		back.append("</");
		back.append(tag);
		back.append('>');
		backStack.push(new Back(backSB.toString(), false, true));
		backSB.setLength(0);
		return (RT)this;
	}

	public RT incr(String tag, String ... args) {
		return incr(null, tag, false, args);
	}

	public RT incr(String tag, boolean oneLine, String ... args) {
		return incr(null, tag, oneLine, args);
	}

	public RT incr(Mark mark) {
		return incr(mark,mark.comment, false, new String[0]);
	}

	public RT incr(Mark mark, String tag, String ... attrs) {
		return incr(mark, tag, false, attrs);
	}

	@SuppressWarnings("unchecked")
	public RT incr(Mark mark, String tag, boolean oneLine, String ... attrs) {
		forward.append('<');
		forward.append(tag);
		addAttrs(attrs);
		forward.append('>');

		back.append("</");
		back.append(tag);
		back.append('>');

		if(pretty) {
			if(mark!=null && mark.comment!=null) {
				int fi = forward.getIndent()*IndentPrintWriter.INDENT;
				for(int i = fi+backSB.length();i<=COMMENT_COLUMN;++i) {
					back.append(' ');
				}
				back.append("<!-- end ");
				back.append(mark.comment);
				back.append(" -->");

				forward.toCol(COMMENT_COLUMN);
				forward.append("<!-- begin ");
				forward.append(mark.comment);
				forward.append(" -->");
			}
			forward.inc();
			if(!oneLine) {
				forward.println();
			}
			back.println();
		}
		if(mark!=null)mark.spot = backStack.size();
		backStack.push(new Back(backSB.toString(),true, false));
		backSB.setLength(0);
		return (RT)this;
	}

	@SuppressWarnings("unchecked")
	public RT tagOnly(String tag, String ... attrs) {
		forward.append('<');
		forward.append(tag);
		addAttrs(attrs);
		forward.append(" />");
		if(pretty) {
			forward.println();
		}
		return (RT)this;
	}

	@SuppressWarnings("unchecked")
	public RT text(String txt) {
		forward.append(txt);
		return (RT)this;
	}

	@SuppressWarnings("unchecked")
	public RT xml(String txt) {
		for(int i=0; i<txt.length();++i) {
			char c = txt.charAt(i);
			switch(c) {
				case '<':
					forward.append("<");
					break;
				case '>':
					forward.append(">");
					break;
				case '&':
					forward.append("&");
					break;
				default:
					forward.append(c);
			}
		}
		return (RT)this;
	}

	@SuppressWarnings("unchecked")
	public RT textCR(int tabs, String txt) {
		for(int i=0;i<tabs;++i) {
			forward.append("  ");
		}
		forward.append(txt);
		if(pretty)forward.println();
		return (RT)this;
	}

	@SuppressWarnings("unchecked")
	public RT value() {
		Mark mark = new Mark();
		mark.spot = backStack.size()-1;
		end(mark);
		return (RT)this;
	}

	@SuppressWarnings("unchecked")
	public RT value(String txt) {
		forward.append(txt);
		Mark mark = new Mark();
		mark.spot = backStack.size()-1;
		end(mark);
		return (RT)this;
	}

	@SuppressWarnings("unchecked")
	public RT value(String txt, int levels) {
		forward.append(txt);
		Mark mark = new Mark();
		mark.spot = backStack.size()-levels;
		end(mark);
		return (RT)this;
	}

	@SuppressWarnings("unchecked")
	public RT end(Mark mark) {
		int size = backStack.size();
		Back c;
		boolean println = false;
		for(int i=mark==null?0:mark.spot;i<size;++i) {
			c = backStack.pop();
			if(c.dec)forward.dec();
			forward.append(c.str);
			println = c.cr;
		}
		if(pretty && println) {
			forward.println();
		}
		return (RT)this;
	}

	public RT end() {
		Mark mark = new Mark();
		mark.spot=backStack.size()-1;
		if(mark.spot<0)mark.spot=0;
		return end(mark);
	}

	public RT end(int i) {
		Mark mark = new Mark();
		mark.spot=backStack.size()-i;
		if(mark.spot<0)mark.spot=0;
		return end(mark);
	}

	public void endAll() {
		end(new Mark());
		forward.flush();
	}

	protected void addAttrs(String[] attrs) {
		if(attrs!=null) {
			for(String attr : attrs) {
				if(attr!=null && attr.length()>0) {
					forward.append(' ');
					String[] split = attr.split("=",2);
					switch(split.length) {
						case 0:
							break;
						case 1:
							forward.append(split[0]);
//							forward.append("=\"\"");
							break;
						default:
							forward.append(split[0]);
							forward.append("=\"");
							forward.append(split[1]);
							forward.append('"');
							break;
					}
				}
			}
		}
	}

	@SuppressWarnings("unchecked")
	public RT comment(String string) {
		if(pretty) {
			forward.print("<!--  ");
			forward.print(string);
			forward.println("  -->");
		}
		return (RT)this;
	}

	public void setIndent(int indent) {
		forward.setIndent(indent);
		forward.toIndent();
	}

	public int getIndent() {
		return forward.getIndent();
	}

}


text:
local core = require ("core")
local utils = require ("utils")

local function marry (prefix, channel, suffix)
  local target = utils.split (suffix)[1] or "Ratbot"

  target = target:gsub ("!$","")

  if target == "me" then
    target = utils.getNick (prefix) or prefix
  end

  core:respond (channel, string.format ("%s: marry me!", target))
end

core:addCommand ("marry", marry)


text:
class Solution:

    def reverseWords(self, s):
        return ' '.join(reversed(s.split()), )


text: Drain-The-Swamp


text:
package nsq

const (
	StateInit = iota
	StateDisconnected
	StateConnected
	StateSubscribed
	StateClosing // close has started. responses are ok, but no new messages will be sent
)


text:
package org.apache.spark.sql.execution.datasources.hbase.types

import org.apache.hadoop.hbase.io.ImmutableBytesWritable
import org.apache.phoenix.query.QueryConstants
import org.apache.phoenix.schema._
import org.apache.phoenix.schema.RowKeySchema.RowKeySchemaBuilder
import org.apache.phoenix.schema.types._
import org.apache.spark.sql.Row
import org.apache.spark.sql.execution.datasources.hbase._
import org.apache.spark.sql.types._

class Phoenix(f:Option[Field] = None) extends SHCDataType {
  private var schema: RowKeySchema = null

  def fromBytes(src: HBaseType): Any = {
    if (f.isDefined) {
      mapToPhoenixTypeInstance(f.get.dt).toObject(src)
    } else {
      throw new UnsupportedOperationException(
        "Phoenix coder: without field metadata, 'fromBytes' conversion can not be supported")
    }
  }

  def toBytes(input: Any): Array[Byte] = {
    input match {
      case data: Boolean => PBoolean.INSTANCE.toBytes(data)
      case data: Byte => PTinyint.INSTANCE.toBytes(data)
      case data: Array[Byte] => PVarbinary.INSTANCE.toBytes(data)
      case data: Double => PDouble.INSTANCE.toBytes(data)
      case data: Float => PFloat.INSTANCE.toBytes(data)
      case data: Int => PInteger.INSTANCE.toBytes(data)
      case data: Long => PLong.INSTANCE.toBytes(data)
      case data: Short => PSmallint.INSTANCE.toBytes(data)
      case data: String => PVarchar.INSTANCE.toBytes(data)
      case _ => throw new UnsupportedOperationException(s"unsupported data type $input")
    }
  }

  override def isRowKeySupported(): Boolean = true

  override def isCompositeKeySupported(): Boolean = true

  override def decodeCompositeRowKey(row: Array[Byte], keyFields: Seq[Field]): Map[Field, Any] = {
    if (schema == null) schema = buildSchema(keyFields)
    val ptr: ImmutableBytesWritable = new ImmutableBytesWritable
    val maxOffest = schema.iterator(row, 0, row.length, ptr)
    var ret = Map.empty[Field, Any]
    for (i <- 0 until schema.getFieldCount) {
      if (schema.next(ptr, i, maxOffest) != null) {
        val value = mapToPhoenixTypeInstance(keyFields(i).dt)
          .toObject(ptr, schema.getField(i).getDataType, SortOrder.getDefault)
        ret += ((keyFields(i), value))
      }
    }
    ret
  }

  override def encodeCompositeRowKey(rkIdxedFields: Seq[(Int, Field)], row: Row): Seq[Array[Byte]] = {
    rkIdxedFields.map { case (x, y) =>
      var ret = toBytes(row(x))
      // the last dimension of composite key does not need SEPARATOR
      if (y.length == -1 && x < rkIdxedFields.size - 1)
        ret ++= QueryConstants.SEPARATOR_BYTE_ARRAY
      ret
    }
  }

  private def buildSchema(keyFields: Seq[Field]): RowKeySchema = {
    val builder: RowKeySchemaBuilder = new RowKeySchemaBuilder(keyFields.length)
    keyFields.foreach{ x =>
      builder.addField(buildPDatum(x.dt), false, SortOrder.getDefault)
    }
    builder.build
  }

  private def mapToPhoenixTypeInstance(input: DataType): PDataType[_] = {
    input match {
      case BooleanType => PBoolean.INSTANCE
      case ByteType => PTinyint.INSTANCE
      case DoubleType => PDouble.INSTANCE
      case IntegerType => PInteger.INSTANCE
      case FloatType => PFloat.INSTANCE
      case LongType => PLong.INSTANCE
      case ShortType => PSmallint.INSTANCE
      case StringType => PVarchar.INSTANCE
      case BinaryType => PVarbinary.INSTANCE
      case _ => throw new UnsupportedOperationException(s"unsupported data type $input")
    }
  }

  private def buildPDatum(input: DataType): PDatum = new PDatum {
    override def getScale: Integer = null
    override def isNullable: Boolean = false
    override def getDataType: PDataType[_] = mapToPhoenixTypeInstance(input)
    override def getMaxLength: Integer = null
    override def getSortOrder: SortOrder = SortOrder.getDefault
  }
}


text:
package org.apache.causeway.extensions.excel.fixtures.demoapp.demomodule.fixturescripts;

import java.net.URL;
import java.util.List;

import javax.inject.Inject;

import org.apache.causeway.applib.services.user.UserService;
import org.apache.causeway.applib.services.xactn.TransactionService;
import org.apache.causeway.commons.internal.collections._Lists;
import org.apache.causeway.commons.internal.resources._Resources;
import org.apache.causeway.extensions.excel.fixtures.demoapp.demomodule.fixturehandlers.demotodoitem.DemoToDoItemRowHandler;
import org.apache.causeway.extensions.excel.fixtures.demoapp.todomodule.dom.ExcelDemoToDoItem;
import org.apache.causeway.extensions.excel.testing.ExcelFixture;
import org.apache.causeway.testing.fixtures.applib.fixturescripts.FixtureScript;

import lombok.Getter;

public class DemoToDoItem_create_usingExcelFixture extends FixtureScript {

    private final String user;

    public DemoToDoItem_create_usingExcelFixture() {
        this(null);
    }

    public DemoToDoItem_create_usingExcelFixture(String ownedBy) {
        this.user = ownedBy;
    }

    @Getter
    private List<ExcelDemoToDoItem> todoItems = _Lists.newArrayList();

    @Override
    public void execute(ExecutionContext executionContext) {

        final String ownedBy = this.user != null ? this.user : userService.currentUserNameElseNobody();

        installFor(ownedBy, executionContext);

        transactionService.flushTransaction();
    }

    private void installFor(String user, ExecutionContext ec) {

        ec.setParameter("user", user);

        this.todoItems.addAll(load(ec, "ToDoItems.xlsx"));
        this.todoItems.addAll(load(ec, "MoreToDoItems.xlsx"));

        transactionService.flushTransaction();
    }

    private List<ExcelDemoToDoItem> load(
            final ExecutionContext executionContext,
            final String resourceName) {

        final URL excelResource = _Resources.getResourceUrl(getClass(), resourceName);
        final ExcelFixture excelFixture = new ExcelFixture(excelResource, DemoToDoItemRowHandler.class);
        excelFixture.setExcelResourceName(resourceName);
        executionContext.executeChild(this, excelFixture);

        return (List<ExcelDemoToDoItem>) excelFixture.getObjects();
    }

    @Inject UserService userService;
    @Inject TransactionService transactionService;

}


text:
@implementation sellectEditCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(!self)
    {
        return nil;
    }
    if(!_titleLabel)
    {
        _titleLabel = [UILabel createLabelWithFrame:CGRectMake(20, 10, 80, 20)
                                    backgroundColor:KCOLOR_WHITE
                                          textColor:KCOLOR_Black_343434
                                               font:KICON_FONT_(15)
                                      textalignment:NSTextAlignmentLeft
                                               text:@""];
        [self addSubview:_titleLabel];
    }
    if(!_contentLabel)
    {
        _contentLabel = [UILabel createLabelWithFrame:CGRectMake(_titleLabel.right, 10, SCREEN_WIDTH-(_titleLabel.right+25), 20)
                                      backgroundColor:KCOLOR_WHITE
                                            textColor:KCOLOR_Black_343434
                                                 font:KICON_FONT_(13)
                                        textalignment:NSTextAlignmentRight
                                                 text:@""];
        [self addSubview:_contentLabel];
    }

    return self ;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end


text:
require File.expand_path('../spec_helper', __FILE__)

describe "A library with no enum defined" do
  it "returns nil when asked for an enum" do
    FFISpecs::TestEnum0.enum_type(:foo).should == nil
  end
end

describe "An untagged enum" do
  it "constants can be used as function parameters and return value" do
    FFISpecs::TestEnum1.test_untagged_enum(:c1).should == 0
    FFISpecs::TestEnum1.test_untagged_enum(:c2).should == 1
    FFISpecs::TestEnum1.test_untagged_enum(:c3).should == 2
    FFISpecs::TestEnum1.test_untagged_enum(:c4).should == 3
    FFISpecs::TestEnum1.test_untagged_enum(:c5).should == 42
    FFISpecs::TestEnum1.test_untagged_enum(:c6).should == 43
    FFISpecs::TestEnum1.test_untagged_enum(:c7).should == 44
    FFISpecs::TestEnum1.test_untagged_enum(:c8).should == 45
    FFISpecs::TestEnum1.test_untagged_enum(:c9).should == 42
    FFISpecs::TestEnum1.test_untagged_enum(:c10).should == 43
    FFISpecs::TestEnum1.test_untagged_enum(:c11).should == 4242
    FFISpecs::TestEnum1.test_untagged_enum(:c12).should == 4243
    FFISpecs::TestEnum1.test_untagged_enum(:c13).should == 42
    FFISpecs::TestEnum1.test_untagged_enum(:c14).should == 4242
    FFISpecs::TestEnum1.test_untagged_enum(:c15).should == 424242
    FFISpecs::TestEnum1.test_untagged_enum(:c16).should == 42424242
  end
end

describe "A tagged typedef enum" do
  it "is accessible through its tag" do
    FFISpecs::TestEnum3.enum_type(:enum_type1).should_not == nil
    FFISpecs::TestEnum3.enum_type(:enum_type2).should_not == nil
    FFISpecs::TestEnum3.enum_type(:enum_type3).should_not == nil
    FFISpecs::TestEnum3.enum_type(:enum_type4).should_not == nil
  end

  it "contains enum constants" do
    FFISpecs::TestEnum3.enum_type(:enum_type1).symbols.length.should == 4
    FFISpecs::TestEnum3.enum_type(:enum_type2).symbols.length.should == 4
    FFISpecs::TestEnum3.enum_type(:enum_type3).symbols.length.should == 4
    FFISpecs::TestEnum3.enum_type(:enum_type4).symbols.length.should == 4
  end

  it "constants can be used as function parameters and return value" do
    FFISpecs::TestEnum3.test_tagged_typedef_enum1(:c1).should == :c1
    FFISpecs::TestEnum3.test_tagged_typedef_enum1(:c2).should == :c2
    FFISpecs::TestEnum3.test_tagged_typedef_enum1(:c3).should == :c3
    FFISpecs::TestEnum3.test_tagged_typedef_enum1(:c4).should == :c4
    FFISpecs::TestEnum3.test_tagged_typedef_enum2(:c5).should == :c5
    FFISpecs::TestEnum3.test_tagged_typedef_enum2(:c6).should == :c6
    FFISpecs::TestEnum3.test_tagged_typedef_enum2(:c7).should == :c7
    FFISpecs::TestEnum3.test_tagged_typedef_enum2(:c8).should == :c8
    FFISpecs::TestEnum3.test_tagged_typedef_enum3(:c9).should == :c9
    FFISpecs::TestEnum3.test_tagged_typedef_enum3(:c10).should == :c10
    FFISpecs::TestEnum3.test_tagged_typedef_enum3(:c11).should == :c11
    FFISpecs::TestEnum3.test_tagged_typedef_enum3(:c12).should == :c12
    FFISpecs::TestEnum3.test_tagged_typedef_enum4(:c13).should == :c13
    FFISpecs::TestEnum3.test_tagged_typedef_enum4(:c14).should == :c14
    FFISpecs::TestEnum3.test_tagged_typedef_enum4(:c15).should == :c15
    FFISpecs::TestEnum3.test_tagged_typedef_enum4(:c16).should == :c16
  end
end

describe "All enums" do
  it "have autonumbered constants when defined with names only" do
    FFISpecs::TestEnum1.enum_value(:c1).should == 0
    FFISpecs::TestEnum1.enum_value(:c2).should == 1
    FFISpecs::TestEnum1.enum_value(:c3).should == 2
    FFISpecs::TestEnum1.enum_value(:c4).should == 3

    FFISpecs::TestEnum3.enum_value(:c1).should == 0
    FFISpecs::TestEnum3.enum_value(:c2).should == 1
    FFISpecs::TestEnum3.enum_value(:c3).should == 2
    FFISpecs::TestEnum3.enum_value(:c4).should == 3
  end

  it "can have an explicit first constant and autonumbered subsequent constants" do
    FFISpecs::TestEnum1.enum_value(:c5).should == 42
    FFISpecs::TestEnum1.enum_value(:c6).should == 43
    FFISpecs::TestEnum1.enum_value(:c7).should == 44
    FFISpecs::TestEnum1.enum_value(:c8).should == 45

    FFISpecs::TestEnum3.enum_value(:c5).should == 42
    FFISpecs::TestEnum3.enum_value(:c6).should == 43
    FFISpecs::TestEnum3.enum_value(:c7).should == 44
    FFISpecs::TestEnum3.enum_value(:c8).should == 45
  end

  it "can have a mix of explicit and autonumbered constants" do
    FFISpecs::TestEnum1.enum_value(:c9).should  == 42
    FFISpecs::TestEnum1.enum_value(:c10).should == 43
    FFISpecs::TestEnum1.enum_value(:c11).should == 4242
    FFISpecs::TestEnum1.enum_value(:c12).should == 4243

    FFISpecs::TestEnum3.enum_value(:c9).should  == 42
    FFISpecs::TestEnum3.enum_value(:c10).should == 43
    FFISpecs::TestEnum3.enum_value(:c11).should == 4242
    FFISpecs::TestEnum3.enum_value(:c12).should == 4243
  end

  it "can have all its constants explicitely valued" do
    FFISpecs::TestEnum1.enum_value(:c13).should == 42
    FFISpecs::TestEnum1.enum_value(:c14).should == 4242
    FFISpecs::TestEnum1.enum_value(:c15).should == 424242
    FFISpecs::TestEnum1.enum_value(:c16).should == 42424242

    FFISpecs::TestEnum3.enum_value(:c13).should == 42
    FFISpecs::TestEnum3.enum_value(:c14).should == 4242
    FFISpecs::TestEnum3.enum_value(:c15).should == 424242
    FFISpecs::TestEnum3.enum_value(:c16).should == 42424242
  end

  it "return the constant corresponding to a specific value" do
    enum = FFISpecs::TestEnum3.enum_type(:enum_type1)
    enum[0].should == :c1
    enum[1].should == :c2
    enum[2].should == :c3
    enum[3].should == :c4

    enum = FFISpecs::TestEnum3.enum_type(:enum_type2)
    enum[42].should == :c5
    enum[43].should == :c6
    enum[44].should == :c7
    enum[45].should == :c8

    enum = FFISpecs::TestEnum3.enum_type(:enum_type3)
    enum[42].should == :c9
    enum[43].should == :c10
    enum[4242].should == :c11
    enum[4243].should == :c12

    enum = FFISpecs::TestEnum3.enum_type(:enum_type4)
    enum[42].should == :c13
    enum[4242].should == :c14
    enum[424242].should == :c15
    enum[42424242].should == :c16
  end
end


text:
<?php namespace Illuminate\Routing\Controllers;

use Symfony\Component\HttpFoundation\Request;

class FilterParser {

	/**
	 * Parse the given filters from the controller.
	 *
	 * @param  \Illuminate\Routing\Controllers\Controller  $controller
	 * @param  \Symfony\Component\HttpFoundation\Request  $request
	 * @param  string  $method
	 * @param  string  $filter
	 * @return array
	 */
	public function parse(Controller $controller, Request $request, $method, $filter)
	{
		return $this->getCodeFilters($controller, $request, $method, $filter);
	}

	/**
	 * Get the filters that were specified in code.
	 *
	 * @param  \Illuminate\Routing\Controllers\Controller  $controller
	 * @param  \Symfony\Component\HttpFoundation\Request  $request
	 * @param  string  $method
	 * @param  string  $filter
	 * @return array
	 */
	protected function getCodeFilters($controller, $request, $method, $filter)
	{
		$filters = $this->filterByClass($controller->getControllerFilters(), $filter);

		return $this->getNames($this->filter($filters, $request, $method));
	}

	/**
	 * Filter the annotation instances by class name.
	 *
	 * @param  array   $filters
	 * @param  string  $filter
	 * @return array
	 */
	protected function filterByClass($filters, $filter)
	{
		return array_filter($filters, function($annotation) use ($filter)
		{
			return $annotation instanceof $filter;
		});
	}

	/**
	 * Filter the annotation instances by request and method.
	 *
	 * @param  array  $filters
	 * @param  \Symfony\Component\HttpFoundation\Request  $request
	 * @param  string  $method
	 * @return array
	 */
	protected function filter($filters, $request, $method)
	{
		$filtered = array_filter($filters, function($annotation) use ($request, $method)
		{
			return $annotation->applicable($request, $method);
		});

		return array_values($filtered);
	}

	/**
	 * Get the filter names from an array of filter objects.
	 *
	 * @param  array  $filters
	 * @return array
	 */
	protected function getNames(array $filters)
	{
		return array_map(function($filter) { return $filter->run; }, $filters);
	}

}


text:
package com.linecorp.armeria.client;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.Test;

import com.linecorp.armeria.common.HttpHeaderNames;
import com.linecorp.armeria.common.HttpHeaders;

import io.netty.util.AsciiString;

public class ClientOptionsTest {

    @Test
    public void testSetHttpHeader() {
        final HttpHeaders httpHeader = HttpHeaders.of(AsciiString.of("x-user-defined"), "HEADER_VALUE");

        final ClientOptions options = ClientOptions.of(ClientOption.HTTP_HEADERS.newValue(httpHeader));
        assertThat(options.get(ClientOption.HTTP_HEADERS)).contains(httpHeader);

        final ClientOptions options2 = ClientOptions.DEFAULT;
        assertThat(options2.get(ClientOption.HTTP_HEADERS)).contains(HttpHeaders.EMPTY_HEADERS);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testSetBlackListHeader() {
        ClientOptions.of(ClientOption.HTTP_HEADERS.newValue(
                HttpHeaders.of(HttpHeaderNames.HOST, "localhost")));
    }

    @Test(expected = NullPointerException.class)
    public void testInvalidDefaultWriteTimeoutMillis() {
        ClientOptions.of(ClientOption.DEFAULT_WRITE_TIMEOUT_MILLIS.newValue(null));
    }

    @Test(expected = NullPointerException.class)
    public void testInvalidDefaultResponseTimeoutMillis() {
        ClientOptions.of(ClientOption.DEFAULT_RESPONSE_TIMEOUT_MILLIS.newValue(null));
    }

    @Test(expected = NullPointerException.class)
    public void testInvalidDefaultMaxResponseLength() {
        ClientOptions.of(ClientOption.DEFAULT_MAX_RESPONSE_LENGTH.newValue(null));
    }
}


text:
		{{options.label}}
		{{options.required ? '*' : ''}}

				 {{options.textbutton}}

			<input type="text"
			   class="form-control  input-{{options.inputSize || 'default'}}"
			   id="{{id}}"
			   name="{{name}}"
			   placeholder="{{options.placeholder}}"
			   autofocus="{{options.autofocus}}"
			   ng-required="{{options.required}}"
			   ng-disabled="{{options.disabled}}"
			   ng-pattern="{{options.pattern}}"
			   ng-minlength="{{options.min}}"
			   ng-maxlength="{{options.max}}"
			   ng-model="value"
			   ng-blur="onBlur()"
			   ng-focus="onFocus()"
			   ng-change="onChange()">

		Campo obligatorio. Introduzca un valor
		Debe tener al menos {{options.min}} caracteres
		No puede tener más de {{options.max}} caracteres
		Introduzca un valor válido


text:
using System;
using System.Runtime.CompilerServices;

namespace Godot
{
    public sealed partial class RID : IDisposable
    {
        private bool disposed = false;

        internal IntPtr ptr;

        internal static IntPtr GetPtr(RID instance)
        {
            if (instance == null)
                throw new NullReferenceException($"The instance of type {nameof(RID)} is null.");

            if (instance.disposed)
                throw new ObjectDisposedException(instance.GetType().FullName);

            return instance.ptr;
        }

        ~RID()
        {
            Dispose(false);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (disposed)
                return;

            if (ptr != IntPtr.Zero)
            {
                godot_icall_RID_Dtor(ptr);
                ptr = IntPtr.Zero;
            }

            disposed = true;
        }

        internal RID(IntPtr ptr)
        {
            this.ptr = ptr;
        }

        public IntPtr NativeInstance
        {
            get { return ptr; }
        }

        internal RID()
        {
            this.ptr = IntPtr.Zero;
        }

        public RID(Object from)
        {
            this.ptr = godot_icall_RID_Ctor(Object.GetPtr(from));
        }

        public int GetId()
        {
            return godot_icall_RID_get_id(RID.GetPtr(this));
        }

        public override string ToString() => "[RID]";

        [MethodImpl(MethodImplOptions.InternalCall)]
        internal extern static IntPtr godot_icall_RID_Ctor(IntPtr from);

        [MethodImpl(MethodImplOptions.InternalCall)]
        internal extern static void godot_icall_RID_Dtor(IntPtr ptr);

        [MethodImpl(MethodImplOptions.InternalCall)]
        internal extern static int godot_icall_RID_get_id(IntPtr ptr);
    }
}


text:
***

## What is
  It is a small plugin that makes SlickGrid pagination use much easier.

## Features
* Easy-to-use server-side paging.
* Standard paging navigation buttons(First, Previous, Next and Last).
* Drop-down selection of page size.
* Jumping to the specified page support.
* Slider pager support.
* Display current paging infomation(e.g. Display 1-10 / 100).
* i18n support.

## Parameters
* container:  an element that renders SlickGrid Enhancement Pager(e.g. div element).
* remoteUrl: a http remote handler that returns json string(Note: content-type: text/plain, charset: utf-8).

[json string example]

 `{"Total":3,"Rows":"[{\"Id\":\"1\",\"Name\":\"Tim\"},{\"Id\":\"2\",\"Name\":\"Mary\"},{\"Id\":\"3\",\"Name\":\"Tom\"}]"}// "Total" means the count of the whole recordset, while "Rows" means the returned records of the current page.For details, please see the example.`

* datagrid: the SlickGrid object.
* pagerType: slider or standard paging navigation buttons.(See the example)
* waiting: set ajax timeout.(default value: 30000, 30s)
* params : addtional params passed to http post.(See the example)
* trans : translation for i18n.

## Usage
> [html code]

  `<div id="myGrid" style="width:700px;height:500px;"></div>`

  `<div id="pager" style="width:700px;" class="slick-enhancement-pager">`

> [js code]

  `var grid;`

  `var columns = [`

  `               { id: "id", name: "id", field: "id" },`

  `               { id: "name", name: "name", field: "name" }`

  `             ];`

  `var options = {`

  `   enableCellNavigation: true,`

  `   enableColumnReorder: false`

  `};`

> `$(function () {`

 `  var data = [];`

 `  grid = new Slick.Grid("#myGrid", data, columns, options);`

 `  var pager = new Slick.Controls.EnhancementPager({`

 `                container: $("#pager"), `

 `                remoteUrl: "http://localhost:1690/Data.ashx",`

 `                datagrid: grid`

 `            });`

 `});`

## Example
Please see the details from the example.zip file.(the example.html file under the ASP.NET\SlickgridEnhancementPagerDemo\slickgrid\examples folder or under the PHP folder)

## Icons
Some of icons are from [famfamfam](http://www.famfamfam.com/).

## License
This plugin is released under the MIT license (See the MIT-LICENSE.txt file), so it is free for both personal and commercial use.

## Donate
This small plugin is developed in my spare time.If you like it or feel useful, just "buy me a beer" ;) .

Any amount will be deeply appreciated with my sincerity!


text:
import pytest
import gevent
import json

from volttron.platform.agent.known_identities import PLATFORM_ALERTER

ALERT_CONFIG = {
    "group1": {
        "fakedevice": 5,
        "fakedevice2": {
            "seconds": 5,
            "points": ["point"]
        }
    }
}

alert_messages = {}

@pytest.fixture(scope='module')
def agent(request, volttron_instance1):

    alert_uuid = volttron_instance1.install_agent(
        agent_dir="services/core/AlertAgent",
        config_file=ALERT_CONFIG)
    gevent.sleep(2)

    agent = volttron_instance1.build_agent()

    def onmessage(peer, sender, bus, topic, headers, message):
        global alert_messages

        alert = json.loads(message)["context"]

        try:
            alert_messages[alert] += 1
        except KeyError:
            alert_messages[alert] = 1

    agent.vip.pubsub.subscribe(peer='pubsub',
                               prefix='alert',
                               callback=onmessage)

    def stop():
        volttron_instance1.stop_agent(alert_uuid)
        agent.core.stop()

    request.addfinalizer(stop)
    return agent

def test_alert_agent(agent):
    global alert_messages
    for _ in range(10):
        agent.vip.pubsub.publish(peer='pubsub',
                                 topic='fakedevice')
        agent.vip.pubsub.publish(peer='pubsub',
                                 topic='fakedevice2',
                                 message=[{'point': 'value'}])
        gevent.sleep(1)

    assert not alert_messages
    gevent.sleep(6)

    assert len(alert_messages) == 1

def test_ignore_topic(agent):
    global alert_messages

    agent.vip.rpc.call(PLATFORM_ALERTER, 'ignore_topic', 'group1', 'fakedevice2').get()
    alert_messages.clear()
    gevent.sleep(6)

    assert len(alert_messages) == 1
    assert u"Topic(s) not published within time limit: ['fakedevice']" in alert_messages

def test_watch_topic(agent):
    global alert_messages

    agent.vip.rpc.call(PLATFORM_ALERTER, 'watch_topic', 'group1', 'newtopic', 5).get()
    gevent.sleep(6)

    assert u"Topic(s) not published within time limit: ['newtopic']" in alert_messages

def test_watch_device(agent):
    global alert_messages

    agent.vip.rpc.call(PLATFORM_ALERTER, 'watch_device', 'group1', 'newdevice', 5, ['point']).get()
    gevent.sleep(6)

    assert u"Topic(s) not published within time limit: ['newdevice', ('newdevice', 'point')]" in alert_messages


text:
namespace DurandalAuth.Web.Areas.HelpPage.ModelDescriptions
{
    public class EnumValueDescription
    {
        public string Documentation { get; set; }

        public string Name { get; set; }

        public string Value { get; set; }
    }
}


text:
package io.gravitee.gateway.reactor;

import io.gravitee.common.service.Service;
import io.gravitee.gateway.api.ExecutionContext;
import io.gravitee.gateway.api.Request;
import io.gravitee.gateway.api.Response;
import io.gravitee.gateway.api.handler.Handler;

/**
 * @author David BRASSELY (david at graviteesource.com)
 * @author GraviteeSource Team
 */
public interface Reactor extends Service {
    void route(Request request, Response response, Handler<ExecutionContext> handler);
}


text:
package com.flaptor.indextank.index.term.query;

import java.util.List;

import com.flaptor.indextank.util.IdentityUnion;
import com.flaptor.indextank.util.SkippableIterable;

class OrMerger extends IdentityUnion<RawMatch> {

    @SuppressWarnings("unchecked")
	OrMerger(SkippableIterable<RawMatch> left, SkippableIterable<RawMatch> right) {
        super(left, right);
    }

    @Override
    protected boolean shouldUse(RawMatch result, List<RawMatch> originals) {
        double score = 0.0;
        for (RawMatch p : originals) {
            score += p.getScore();
        }
        result.setScore(score);

        return true; // every element of the union should be returned
    }
}