text:
'use strict'

var fs = require('fs')
var path = require('path');
var async = require('async')
var acorn = require('acorn')
var walk = require('acorn/dist/walk')

var browserResolve = require('./resolve2.js');
var nodeResolve = require('./resolve.js');

var requireRe = /\brequire\b/;

function nextTick (cb) {
    var args = [].slice.call(arguments, 1);
    process.nextTick(function () { cb.apply(null, args) });
}

function defined() {
    for (var i = 0; i < arguments.length; i++) {
        if (arguments[i] !== undefined) return arguments[i];
    }
}

function parse (src, opts) {
    if (!opts) opts = {};
    return acorn.parse(src, {
        ecmaVersion: defined(opts.ecmaVersion, 6),
        sourceType: opts.sourceType,
        ranges: defined(opts.ranges, opts.range),
        locations: defined(opts.locations, opts.loc),
        allowReserved: defined(opts.allowReserved, true),
        allowReturnOutsideFunction: defined(
            opts.allowReturnOutsideFunction, true
        ),
        allowHashBang: defined(opts.allowHashBang, true)
    });
}

var findRequires = function(src){
    var modules = { strings : [], expressions : [] };
    var word = 'require'
    var wordRe = requireRe;
    if (!wordRe.test(src)) return modules;

    function isRequire(node) {
        return node.callee.type === 'Identifier'
            && node.callee.name === word
        ;
    }

    var ast = parse(src);

    function visit(node, st, c) {
        var hasRequire = wordRe.test(src.slice(node.start, node.end));
        if (!hasRequire) return
        walk.base[node.type](node, st, c)
        if (node.type !== 'CallExpression') return;
        if (isRequire(node)) {
            if (node.arguments.length) {
                var arg = node.arguments[0];
                if (arg.type === 'Literal') {
                    modules.strings.push(arg.value);
                }
                else {
                    modules.expressions.push(src.slice(arg.start, arg.end));
                }
            }
        }
    }

    walk.recursive(ast, null, {
        Statement: visit,
        Expression: visit
    });

    return modules;
}

var pkgCache = {}

var loadPackage = function(source, pkg, cb){
    console.log('loadPackage', source)
    var cached = pkgCache[source]
    if (cached) return nextTick(cb, null, cached)
    var parent = path.dirname(source)
    fs.readFile(source, function(err, src){
        var requires = findRequires(src)
        console.log('find requires', requires)
        for(var i=0; i<requires.strings.length; i++){
            var mod = requires.strings[i]
            console.log('parent', parent)
            browserResolve(mod, {filename:source},  function(err, source, pkg){
                console.log('resolved', mod, source, pkg)
                if(pkg){
                }else{

                }
            })
        }
    })
}

var depends = function(code){
    var requires = findRequires(code)
    console.log(requires.strings)
    for(var i=0; i<requires.strings.length; i++){
        var mod = requires.strings[i]
        browserResolve(mod, null,  function(err, source, pkg){
            if(pkg){
                loadPackage(source, pkg)
            }else{

            }
        })
    }
}

module.exports = depends


text:
var map = L.map('map', {
	minZoom: 1,
	maxZoom: 6,
	center: [0, 0],
	zoom: 2,
	crs: L.CRS.Simple,
    });

// dimensions of the image
var w = 6000,
    h = 4000,
// you will need to replace this with a link to your own image.
    url = 'http://stanford.edu/~rkeisler/tsne_galzoo/big.jpg';

// calculate the edges of the image, in coordinate space
var southWest = map.unproject([0, h], map.getMaxZoom()-1);
var northEast = map.unproject([w, 0], map.getMaxZoom()-1);
var bounds = new L.LatLngBounds(southWest, northEast);

// add the image overlay,
// so that it covers the entire map
L.imageOverlay(url, bounds).addTo(map);

// tell leaflet that the map is exactly as big as the image
map.setMaxBounds(bounds);

redpajama_set_name: RedPajamaGithub


text:
package org.broadinstitute.gatk.queue.qscripts

import org.broadinstitute.gatk.queue.QScript
import org.broadinstitute.gatk.queue.extensions.gatk._

class BaseRecalibration extends QScript {
  qscript =>

  @Input(doc="The reference file for the bam files.", shortName="R", required=true)
  var referenceFile: File = _

  @Input(doc="One bam file.", shortName="I",required=true)
  var bamFile: File = _

  @Argument(doc="Maxmem.", shortName="mem", required=true)
  var maxMem: Int = _

  @Argument(doc="Number of cpu threads per data thread", shortName="nct", required=true)
  var numCPUThreads: Int = _

  @Argument(doc="Number of scatters", shortName="nsc", required=true)
  var numScatters: Int = _

  @Input(doc="Database of known polymorphic sites to skip over in the recalibration algorithm", shortName="knownSites", required=false)
  var knownFiles: List[File] = Nil

  // This trait allows us set the variables below in one place,
  // and then reuse this trait on each CommandLineGATK function below.
  trait BR_Arguments extends CommandLineGATK {
    this.reference_sequence = qscript.referenceFile
    this.memoryLimit = maxMem
  }

  def script() {
    val baseRecalibrator = new BaseRecalibrator with BR_Arguments
    val printReads = new PrintReads with BR_Arguments

    // KODU: Analyze patterns of covariation in the sequence dataset
    baseRecalibrator.input_file :+= bamFile
    if (knownFiles != Nil) {
      baseRecalibrator.knownSites = knownFiles
    }
    baseRecalibrator.out = swapExt(bamFile, ".bam", "_recal_data.table")

    baseRecalibrator.scatterCount = numScatters
    baseRecalibrator.nct = numCPUThreads

    // KODU: Apply the recalibration to the sequence data
    printReads.input_file :+= bamFile
    printReads.BQSR = baseRecalibrator.out
    printReads.out = swapExt(bamFile, "bam", "recalibrated.bam")

    printReads.scatterCount = numScatters
    printReads.nct = numCPUThreads

    add(baseRecalibrator, printReads)
  }
}


text:
from os import path

from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import (
    ObjectDoesNotExist, PermissionDenied, ValidationError)
from django.core.urlresolvers import reverse
from django.db import models

from .managers import DocumentManager, RevisionQuerySet, SpaceManager
from .utils import normalize_path, to_slug

class Space(models.Model):

    """
    A general Space.
    """

    ROOT_SPACE_NAME = '__ROOT__'
    USER_SPACE_NAME = '__USER__'

    objects = SpaceManager()

    name = models.CharField(max_length=100, unique=True)
    path = models.CharField(max_length=40, unique=True)
    created_on = models.DateTimeField(auto_now_add=True)

    class Meta:
        permissions = (
            ("view_space", "Can view a space"),
        )

    def __unicode__(self):
        return self.name

    def get_user_space_root(user):
        """
        Return the root document to a space for a specific user.
        """
        user_space = Space.objects.get(name=Space.USER_SPACE_NAME)
        doc, created = Document.objects.get_or_create(
            path=user.username,
            space=user_space,
            parent=None)

        return doc

    def get_root_document(self):
        """
        Return the root document for the space.
        """
        # Can't use get_or_create, since we don't want to find by title
        try:
            doc = Document.objects.get(
                path="",
                space=self,
                is_space_root=True,
                parent=None)
        except ObjectDoesNotExist:
            title = self.name

            if title == Space.ROOT_SPACE_NAME:
                title = "Welcome to Spaces"

            doc = Document.objects.create(
                title=title,
                path="",
                space=self,
                is_space_root=True,
                parent=None
            )

        return doc

    def full_clean(self, *args, **kwargs):
        self.path = to_slug(self.path)
        super(Space, self).full_clean(*args, **kwargs)

    def save(self, *args, **kwargs):
        self.full_clean()
        super(Space, self).save(*args, **kwargs)

class Document(models.Model):

    """
    A single document.

    The actual content existing in the revisions.
    """

    objects = DocumentManager()

    path = models.CharField(max_length=100, blank=True)
    title = models.CharField(max_length=100)
    is_space_root = models.BooleanField(
        "Is this a space's root document",
        default=False)
    space = models.ForeignKey('Space')
    parent = models.ForeignKey('Document', null=True, blank=True)

    class Meta:
        unique_together = ("path", "parent"),
        permissions = (
            ("view_document", "Can view a document"),
        )

    def __init__(self, *args, **kwargs):
        super(Document, self).__init__(*args, **kwargs)

        # Process space and path
        if not self.has_space() and self.parent and self.parent.has_space:
            self.space = self.parent.space
        if "path" in kwargs:
            self._process_path(kwargs["path"])

    def __unicode__(self):
        return self.title

    @property
    def latest(self):
        """ Get the latest revision """
        return self.revision_set.order_by('-id').first()

    def has_space(self):
        """
        Return the space attached to this document, otherwise, return False
        """
        try:
            return self.space
        except ObjectDoesNotExist:
            return False

    def full_path(self, inc_space=True):
        """ The full path to this document. """
        uri = self.path

        parent = self.parent
        while parent is not None:
            uri = path.join(parent.path, uri)
            parent = parent.parent

        if inc_space and self.space.name != Space.ROOT_SPACE_NAME:
            uri = path.join(self.space.path, uri)

        return uri

    @property
    def full_path_with_space(self):
        """ full_path wrapper property for templates and API serializer. """
        return self.full_path()

    @property
    def full_path_without_space(self):
        """ full_path wrapper property for templates and API serializer. """
        return self.full_path(False)

    @property
    def children(self):
        """ Convenience alias """
        return self.document_set

    def get_absolute_url(self):
        """ Get the absolute URL route to the document. """
        return reverse('spaces:document', kwargs={'path': self.full_path()})

    def _process_path(self, path):
        """ Take a path and set the space and parent """

        path = normalize_path(self.path).split("/")

        if not self.has_space():
            spacePath = path.pop(0)
            try:
                self.space = Space.objects.get(path=spacePath)
            except ObjectDoesNotExist:
                # Space might not be included in path, add it back to path
                path.insert(0, spacePath)

        parentPath = path[0:-1]
        if len(path) >= 1:
            self.path = path[-1]
        else:
            self.path = ""

        parentPath = filter(len, parentPath)  # remove empty path sections
        if parentPath:
            self.parent = Document.objects.get_by_path(
                parentPath,
                space=self.space,
                create=True)

    def view_count(self):
        """ Return the number of times this document has been viewed. """
        return self.accesslog_set.count()

    def full_clean(self, override_path_normalization=False, *args, **kwargs):
        """ Custom clean method """

        # Parent document needs to be in same space
        if (self.parent and self.has_space() and self.parent.space != self.space):
            raise ValidationError("Parent not in the same space")

        # If no space, default to parent's
        elif not self.has_space():
            if self.parent is not None:
                self.space = self.parent.space
            else:
                raise ValidationError("No space defined")

        # Convert path to parent node
        if self.path.find('/') > -1:
            self._process_path(self.path)

        # Normalize path
        elif not self.is_space_root:
            self.path = to_slug(self.path)

        # Set no parent to root document
        if self.parent is None and not self.is_space_root:
            self.parent = self.space.get_root_document()

        # If we're a root level document, we can't have the
        # same path as the space. This is to cut down on confusion
        if (not self.is_space_root and self.parent.is_space_root
                and self.path.lower() == self.space.path.lower()):
            raise ValidationError(
                "This document cannot have the same path name as it's space (%s)"
                % self.space.path)

        # User Space: Cannot create a root document that is not a username
        if self.space.name == Space.USER_SPACE_NAME and self.parent is None:
            try:
                get_user_model().objects.get(username=self.path)
            except ObjectDoesNotExist:
                raise ObjectDoesNotExist(
                    "Invalid username '%s'" % self.path)

        #  No hierarchy is allowed under the __ROOT__ space
        if self.space.name == Space.ROOT_SPACE_NAME and not self.is_space_root:
            raise ValidationError(
                "Cannot put child pages under the root space")

        super(Document, self).full_clean(*args, **kwargs)

    def save(self, override_path_normalization=False, *args, **kwargs):
        self.full_clean(override_path_normalization)

        # Save parents
        if (self.parent is not None
                and self.parent.pk is None
                and not self.is_space_root):
            self.parent.save()
            self.parent_id = self.parent.id

        super(Document, self).save(*args, **kwargs)

    def delete(self, with_children=False, *args, **kwargs):
        """
        If passed with with_children=True, all child documents will also be deleted
        """

        # Update child documents
        for d in self.document_set.all():
            if with_children:
                d.delete(with_children=True)
            else:
                d.parent = self.parent
                d.save()

        # Cannot delete root space document
        if self.is_space_root:
            raise ValidationError(
                "Cannot remove the root space document")

        super(Document, self).delete(*args, **kwargs)

class Revision(models.Model):

    """
    A revision for a document.

    Every time a document is edited, a new revision is created.
    """

    doc = models.ForeignKey('Document', verbose_name="Document")
    author = models.ForeignKey(settings.AUTH_USER_MODEL) #editable=False
    content = models.TextField()
    created_on = models.DateTimeField(auto_now_add=True)

    objects = RevisionQuerySet()

    def __unicode__(self):
        return "created on %s by %s" % (self.created_on, self.author.username)

    def save(self, *args, **kwargs):
        self.full_clean()

        # If it's the same content as the current revision, don't save
        latestContent = self.doc.latest
        if latestContent and latestContent.content == self.content:
            return

        # Otherwise, always create new revision
        else:
            self.id = None
            self.created_on = None

        super(Revision, self).save(*args, **kwargs)

class Comment(models.Model):
    """ A comment on a document """

    document = models.ForeignKey('Document')
    parent = models.ForeignKey('Comment')
    author = models.ForeignKey(settings.AUTH_USER_MODEL)
    content = models.TextField()
    created_on = models.DateTimeField(auto_now_add=True)
    updated_on = models.DateTimeField(auto_now=True)

    def __unicode__(self):
        return "created on %s by %s" % (self.created_on, self.author.username)

class AccessLog(models.Model):

    """ Tracks every time a user views a document. """

    document = models.ForeignKey('Document')
    user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, blank=True)
    accessed_on = models.DateTimeField(auto_now_add=True)

    def __unicode__(self):
        return "accessed %s on %s" % (self.document.title, self.accessed_on)


text:
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Globalization;
using System.Linq;
using cmstar.Data.Dynamic;

namespace cmstar.Data
{
    ///
    /// 提供<see cref="IDbClient"/>的扩展方法,这些方法允许使用基于索引的SQL参数表以简化编码过程。
    ///
    /// <remarks>
    /// 这些扩展方法允许SQL中使用类似@n的形式指定参数:
    /// sql = "SELECT id FROM table WHERE name=@0 AND city=@1 AND age>@2";
    /// 其中n对应参数表param中的索引位置为n的值。
    /// <example>client.Scalar(sql, "John Doe", "New York", 35);</example>
    /// * 参数本身也可以是<see cref="DbParameter"/>的实例,此时参数会被直接使用。
    /// * 这些方法默认<see cref="CommandType"/>为<see cref="CommandType.Text"/>,
    /// 若需要执行存储过程,需要使用类似如下的方式:
    /// sql = "EXEC proc @0, @1, @2";
    /// </remarks>
#if NET35
    public static class IndexingExtension
#else
    public static partial class IndexingExtension
#endif
    {
        ///
        /// 获取查询的第一行第一列的值。
        ///
        /// <param name="client"><see cref="IDbClient"/>的实例。</param>
        /// <param name="sql">SQL语句。</param>
        /// <param name="param">参数表。</param>
        /// <returns>查询结果的第一行第一列的值。若查询结果行数为0,返回<c>null</c>。</returns>
        public static object IxScalar(this IDbClient client, string sql, params object[] param)
        {
            return client.Scalar(sql, GenerateParameters(client, param));
        }

        ///
        /// 执行非查询SQL语句,并返回所影响的行数。
        ///
        /// <param name="client"><see cref="IDbClient"/>的实例。</param>
        /// <param name="sql">SQL语句。</param>
        /// <param name="param">参数表。</param>
        /// <returns>SQL所影响的行数。</returns>
        public static int IxExecute(this IDbClient client, string sql, params object[] param)
        {
            return client.Execute(sql, GenerateParameters(client, param));
        }

        ///
        /// 执行非查询SQL语句,并断言所影响的行数。若影响的函数不正确,抛出异常。
        ///
        /// <param name="client"><see cref="IDbClient"/>的实例。</param>
        /// <param name="expectedSize">被断言的影响行数。</param>
        /// <param name="sql">SQL语句。</param>
        /// <param name="param">参数表。</param>
        /// <exception cref="IncorrectResultSizeException">当影响的行数不正确。</exception>
        public static void IxSizedExecute(this IDbClient client, int expectedSize, string sql, params object[] param)
        {
            client.SizedExecute(expectedSize, sql, GenerateParameters(client, param));
        }

        ///
        /// 返回查询语句对应查询结果的<see cref="System.Data.DataTable"/>。
        ///
        /// <param name="client"><see cref="IDbClient"/>的实例。</param>
        /// <param name="sql">SQL语句。</param>
        /// <param name="param">参数表。</param>
        /// <returns>表示查询结果的<see cref="System.Data.DataTable"/>。</returns>
        public static DataTable IxDataTable(this IDbClient client, string sql, params object[] param)
        {
            return client.DataTable(sql, GenerateParameters(client, param));
        }

        ///
        /// 返回查询语句对应查询结果的<see cref="System.Data.DataSet"/>。
        ///
        /// <param name="client"><see cref="IDbClient"/>的实例。</param>
        /// <param name="sql">SQL语句。</param>
        /// <param name="param">参数表。</param>
        /// <returns>表示查询结果的<see cref="System.Data.DataTable"/>。</returns>
        public static DataSet IxDataSet(this IDbClient client, string sql, params object[] param)
        {
            return client.DataSet(sql, GenerateParameters(client, param));
        }

        ///
        /// 判断给定的查询的结果是否至少包含1行。
        ///
        /// <param name="client"><see cref="IDbClient"/>的实例。</param>
        /// <param name="sql">SQL语句。</param>
        /// <param name="param">参数表。</param>
        /// <returns>若查询结果至少包含1行,返回<c>true</c>;否则返回<c>false</c>。</returns>
        public static bool IxExists(this IDbClient client, string sql, params object[] param)
        {
            return client.Exists(sql, GenerateParameters(client, param));
        }

        ///
        /// 获取查询结果的第一行记录。
        /// 若查询命中的行数为0,返回null。
        ///
        /// <param name="client"><see cref="IDbClient"/>的实例。</param>
        /// <param name="sql">SQL语句。</param>
        /// <param name="param">参数表。</param>
        /// <returns><see cref="IDataRecord"/>的实现,包含查询的第一行记录。</returns>
        public static IDataRecord IxGetRow(this IDbClient client, string sql, params object[] param)
        {
            return client.GetRow(sql, GenerateParameters(client, param));
        }

        ///
        /// 获取查询结果的第一行记录,以数组形式返回记录内各列的值。
        /// 数组元素顺序与列顺序一致。若查询命中的行数为0,返回null。
        ///
        /// <param name="client"><see cref="IDbClient"/>的实例。</param>
        /// <param name="sql">SQL语句。</param>
        /// <param name="param">记录SQL参数的对象。</param>
        /// <returns>包含了各列的值的数组。</returns>
        public static object[] IxItemArray(this IDbClient client, string sql, params object[] param)
        {
            return client.ItemArray(sql, GenerateParameters(client, param));
        }

        ///
        /// 使用<see cref="IMapper{T}"/>查询指定对象。
        /// 若满足条件的记录不存在,返回目标类型的默认值(对于引用类型为<c>null</c>)。
        ///
        /// <typeparam name="T">查询的目标类型。</typeparam>
        /// <param name="client"><see cref="IDbClient"/>的实例。</param>
        /// <param name="sql">SQL语句。</param>
        /// <param name="param">参数表。</param>
        /// <param name="mapper"><see cref="IMapper{T}"/>的实例。</param>
        /// <returns>目标类型的实例。</returns>
        public static T IxGet<T>(this IDbClient client, IMapper<T> mapper, string sql, params object[] param)
        {
            return client.Get(mapper, sql, GenerateParameters(client, param));
        }

        ///
        /// 使用<see cref="IMapper{T}"/>查询指定对象。
        /// SQL命中的记录必须为1行,否则抛出异常。
        ///
        /// <typeparam name="T">查询的目标类型。</typeparam>
        /// <param name="client"><see cref="IDbClient"/>的实例。</param>
        /// <param name="mapper"><see cref="IMapper{T}"/>的实例。</param>
        /// <param name="sql">SQL语句。</param>
        /// <param name="param">参数表。</param>
        /// <returns>目标类型的实例。</returns>
        /// <exception cref="IncorrectResultSizeException">当SQL命中的记录行数不为 1。</exception>
        public static T IxForceGet<T>(this IDbClient client, IMapper<T> mapper, string sql, params object[] param)
        {
            return client.ForceGet(mapper, sql, GenerateParameters(client, param));
        }

        ///
        /// 使用<see cref="IMapper{T}"/>查询指定对象的集合。
        ///
        /// <typeparam name="T">查询的目标类型。</typeparam>
        /// <param name="client"><see cref="IDbClient"/>的实例。</param>
        /// <param name="mapper"><see cref="IMapper{T}"/>的实例。</param>
        /// <param name="sql">SQL语句。</param>
        /// <param name="param">参数表。</param>
        /// <returns>目标类型的实例的集合。若查询命中的行数为0,返回空集合。</returns>
        public static IList<T> IxList<T>(this IDbClient client, IMapper<T> mapper, string sql, params object[] param)
        {
            return client.List(mapper, sql, GenerateParameters(client, param));
        }

        ///
        /// 获取查询结果得行序列。
        ///
        /// <param name="client"><see cref="IDbClient"/>的实例。</param>
        /// <param name="sql">SQL语句。</param>
        /// <param name="param">参数表。</param>
        /// <returns>查询结果得行序列。</returns>
        public static IEnumerable<IDataRecord> IxRows(this IDbClient client, string sql, params object[] param)
        {
            return client.Rows(sql, GenerateParameters(client, param));
        }

        ///
        /// 查询并根据结果创建目标类型的实例,由一个模板对象指定目标类型。
        /// 若满足条件的记录不存在,返回目标类型的默认值(对于引用类型为<c>null</c>)。
        ///
        /// <typeparam name="T">查询的目标类型。</typeparam>
        /// <param name="client"><see cref="IDbClient"/>的实例。</param>
        /// <param name="template">用于指定目标类型的模板对象。</param>
        /// <param name="sql">SQL语句。</param>
        /// <param name="param">参数表。</param>
        /// <returns>目标类型的实例。</returns>
        public static T IxTemplateGet<T>(this IDbClient client, T template, string sql, params object[] param)
        {
            return IxGet<T>(client, sql, param);
        }

        ///
        /// 查询并根据结果创建目标类型的实例。
        /// 若满足条件的记录不存在,返回目标类型的默认值(对于引用类型为<c>null</c>)。
        ///
        /// <typeparam name="T">查询的目标类型。</typeparam>
        /// <param name="client"><see cref="IDbClient"/>的实例。</param>
        /// <param name="sql">SQL语句。</param>
        /// <param name="param">参数表。</param>
        /// <returns>目标类型的实例。</returns>
        public static T IxGet<T>(this IDbClient client, string sql, params object[] param)
        {
            var identity = new CommandIdentity(client.ConnectionString, sql, null, null, typeof(T));
            var cache = CommandCache.Get(identity);
            if (cache != null)
                return IxGet(client, (IMapper<T>)cache.Mapper, sql, param);

            var row = IxGetRow(client, sql, param);
            if (row == null)
                return default(T);

            var mapper = MapperParser.Parse<T>(row);
            CommandCache.Set(identity, new CommandCacheItem { Mapper = mapper });
            return mapper.MapRow(row, 1);
        }

        ///
        /// 查询并根据结果创建目标类型的实例,由一个模板对象指定目标类型。
        /// SQL命中的记录必须为1行,否则抛出异常。
        ///
        /// <typeparam name="T">查询的目标类型。</typeparam>
        /// <param name="client"><see cref="IDbClient"/>的实例。</param>
        /// <param name="template">用于指定目标类型的模板对象。</param>
        /// <param name="sql">SQL语句。</param>
        /// <param name="param">参数表。</param>
        /// <returns>目标类型的实例。</returns>
        public static T IxTemplateForceGet<T>(this IDbClient client, T template, string sql, params object[] param)
        {
            return IxForceGet<T>(client, sql, param);
        }

        ///
        /// 查询并根据结果创建目标类型的实例。
        /// SQL命中的记录必须为1行,否则抛出异常。
        ///
        /// <typeparam name="T">查询的目标类型。</typeparam>
        /// <param name="client"><see cref="IDbClient"/>的实例。</param>
        /// <param name="sql">SQL语句。</param>
        /// <param name="param">参数表。</param>
        /// <returns>目标类型的实例。</returns>
        /// <exception cref="IncorrectResultSizeException">当SQL命中的记录行数不为 1。</exception>
        public static T IxForceGet<T>(this IDbClient client, string sql, params object[] param)
        {
            var identity = new CommandIdentity(client.ConnectionString, sql, null, null, typeof(T));
            var cache = CommandCache.Get(identity);
            if (cache != null)
                return IxForceGet(client, (IMapper<T>)cache.Mapper, sql, param);

            var dbParam = GenerateParameters(client, param).ToList();
            var rows = client.Rows(sql, dbParam);
            var rowCount = 0;
            var res = default(T);

            foreach (var row in rows)
            {
                if (rowCount == 0)
                {
                    var mapper = MapperParser.Parse<T>(row);
                    CommandCache.Set(identity, new CommandCacheItem { Mapper = mapper });
                    res = mapper.MapRow(row, 1);
                }

                rowCount++;
            }

            if (rowCount == 1)
                return res;

            throw new IncorrectResultSizeException(sql, CommandType.Text, dbParam, 1, rowCount);
        }

        ///
        /// 查询并根据结果返回目标类型的实例集合,由一个模板对象指定目标类型。
        ///
        /// <typeparam name="T">查询的目标类型。</typeparam>
        /// <param name="client"><see cref="IDbClient"/>的实例。</param>
        /// <param name="template">用于指定目标类型的模板对象。</param>
        /// <param name="sql">SQL语句。</param>
        /// <param name="param">参数表。</param>
        /// <returns>目标类型的实例集合。</returns>
        public static IList<T> IxTemplateList<T>(this IDbClient client, T template, string sql, params object[] param)
        {
            return IxQuery<T>(client, sql, param).ToList();
        }

        ///
        /// 查询并根据结果返回目标类型的实例集合。
        ///
        /// <typeparam name="T">查询的目标类型。</typeparam>
        /// <param name="client"><see cref="IDbClient"/>的实例。</param>
        /// <param name="sql">SQL语句。</param>
        /// <param name="param">参数表。</param>
        /// <returns>目标类型的实例集合。</returns>
        public static IList<T> IxList<T>(this IDbClient client, string sql, params object[] param)
        {
            return IxQuery<T>(client, sql, param).ToList();
        }

        ///
        /// 查询并根据结果返回目标类型的实例序列,由一个模板对象指定目标类型。
        ///
        /// <typeparam name="T">查询的目标类型。</typeparam>
        /// <param name="client"><see cref="IDbClient"/>的实例。</param>
        /// <param name="template">用于指定目标类型的模板对象。</param>
        /// <param name="sql">SQL语句。</param>
        /// <param name="param">参数表。</param>
        /// <returns>目标类型的实例集合。</returns>
        public static IEnumerable<T> IxTemplateQuery<T>(this IDbClient client, T template, string sql, params object[] param)
        {
            return IxQuery<T>(client, sql, param);
        }

        ///
        /// 查询并根据结果返回目标类型的实例序列。
        ///
        /// <typeparam name="T">查询的目标类型。</typeparam>
        /// <param name="client"><see cref="IDbClient"/>的实例。</param>
        /// <param name="sql">SQL语句。</param>
        /// <param name="param">参数表。</param>
        /// <returns>目标类型的实例序列。</returns>
        public static IEnumerable<T> IxQuery<T>(this IDbClient client, string sql, params object[] param)
        {
            var identity = new CommandIdentity(client.ConnectionString, sql, null, null, typeof(T));
            var cache = CommandCache.Get(identity);

            var mapper = (IMapper<T>)cache?.Mapper;
            var rowNum = 0;

            // 展开foreach循环,使mapper == null的仅判断一次
            using (var iter = IxRows(client, sql, param).GetEnumerator())
            {
                if (!iter.MoveNext())
                    yield break;

                if (mapper == null)
                {
                    mapper = MapperParser.Parse<T>(iter.Current);
                    CommandCache.Set(identity, new CommandCacheItem { Mapper = mapper });
                }

                do
                {
                    yield return mapper.MapRow(iter.Current, ++rowNum);

                } while (iter.MoveNext());
            }
        }

        private static IEnumerable<DbParameter> GenerateParameters(IDbClient client, object[] param)
        {
            for (int i = 0; i < param.Length; i++)
            {
                yield return client.CreateParameter(i.ToString(CultureInfo.InvariantCulture), param[i]);
            }
        }
    }
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.Serialization;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Simplification;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.CSharp.Simplification
{
    [DataContract]
    internal sealed class CSharpSimplifierOptions : SimplifierOptions, IEquatable<CSharpSimplifierOptions>
    {
        private static readonly CodeStyleOption2<PreferBracesPreference> s_defaultPreferBraces =
            new(PreferBracesPreference.Always, NotificationOption2.Silent);

        private static readonly CodeStyleOption2<bool> s_trueWithSuggestionEnforcement =
            new(value: true, notification: NotificationOption2.Suggestion);

        private static readonly CodeStyleOption2<bool> s_trueWithSilentEnforcement =
            new(value: true, notification: NotificationOption2.Silent);

        public static readonly CSharpSimplifierOptions Default = new();

        [DataMember] public CodeStyleOption2<bool> VarForBuiltInTypes { get; init; } = CodeStyleOption2<bool>.Default;
        [DataMember] public CodeStyleOption2<bool> VarWhenTypeIsApparent { get; init; } = CodeStyleOption2<bool>.Default;
        [DataMember] public CodeStyleOption2<bool> VarElsewhere { get; init; } = CodeStyleOption2<bool>.Default;
        [DataMember] public CodeStyleOption2<bool> PreferSimpleDefaultExpression { get; init; } = s_trueWithSuggestionEnforcement;
        [DataMember] public CodeStyleOption2<bool> PreferParameterNullChecking { get; init; } = s_trueWithSuggestionEnforcement;
        [DataMember] public CodeStyleOption2<bool> AllowEmbeddedStatementsOnSameLine { get; init; } = s_trueWithSilentEnforcement;
        [DataMember] public CodeStyleOption2<PreferBracesPreference> PreferBraces { get; init; } = s_defaultPreferBraces;
        [DataMember] public CodeStyleOption2<bool> PreferThrowExpression { get; init; } = s_trueWithSuggestionEnforcement;

        public override bool Equals(object? obj)
            => Equals(obj as CSharpSimplifierOptions);

        public bool Equals([AllowNull] CSharpSimplifierOptions other)
            => other is not null &&
               Common.Equals(other.Common) &&
               VarForBuiltInTypes.Equals(other.VarForBuiltInTypes) &&
               VarWhenTypeIsApparent.Equals(other.VarWhenTypeIsApparent) &&
               VarElsewhere.Equals(other.VarElsewhere) &&
               PreferSimpleDefaultExpression.Equals(other.PreferSimpleDefaultExpression) &&
               PreferParameterNullChecking.Equals(other.PreferParameterNullChecking) &&
               AllowEmbeddedStatementsOnSameLine.Equals(other.AllowEmbeddedStatementsOnSameLine) &&
               PreferBraces.Equals(other.PreferBraces) &&
               PreferThrowExpression.Equals(other.PreferThrowExpression);

        public override int GetHashCode()
            => Hash.Combine(VarForBuiltInTypes,
               Hash.Combine(VarWhenTypeIsApparent,
               Hash.Combine(VarElsewhere,
               Hash.Combine(PreferSimpleDefaultExpression,
               Hash.Combine(PreferParameterNullChecking,
               Hash.Combine(AllowEmbeddedStatementsOnSameLine,
               Hash.Combine(PreferBraces,
               Hash.Combine(PreferThrowExpression, 0))))))));
    }

    internal static class CSharpSimplifierOptionsProviders
    {
        public static CSharpSimplifierOptions GetCSharpSimplifierOptions(this AnalyzerConfigOptions options, CSharpSimplifierOptions? fallbackOptions)
        {
            fallbackOptions ??= CSharpSimplifierOptions.Default;

            return new()
            {
                Common = options.GetCommonSimplifierOptions(fallbackOptions.Common),
                VarForBuiltInTypes = options.GetEditorConfigOption(CSharpCodeStyleOptions.VarForBuiltInTypes, fallbackOptions.VarForBuiltInTypes),
                VarWhenTypeIsApparent = options.GetEditorConfigOption(CSharpCodeStyleOptions.VarWhenTypeIsApparent, fallbackOptions.VarWhenTypeIsApparent),
                VarElsewhere = options.GetEditorConfigOption(CSharpCodeStyleOptions.VarElsewhere, fallbackOptions.VarElsewhere),
                PreferSimpleDefaultExpression = options.GetEditorConfigOption(CSharpCodeStyleOptions.PreferSimpleDefaultExpression, fallbackOptions.PreferSimpleDefaultExpression),
                AllowEmbeddedStatementsOnSameLine = options.GetEditorConfigOption(CSharpCodeStyleOptions.AllowEmbeddedStatementsOnSameLine, fallbackOptions.AllowEmbeddedStatementsOnSameLine),
                PreferBraces = options.GetEditorConfigOption(CSharpCodeStyleOptions.PreferBraces, fallbackOptions.PreferBraces),
                PreferThrowExpression = options.GetEditorConfigOption(CSharpCodeStyleOptions.PreferThrowExpression, fallbackOptions.PreferThrowExpression)
            };
        }
    }
}


text:
pthread_mutex_t allprogsStackMutex;

class ProgEntry
{
private:
    Demo* d;
public:
    ProgEntry(Demo * _d):d(_d){;}
    ~ProgEntry()
	{
	    d->Exit(4);
	    cout << "-";
	}
    friend bool operator<(const ProgEntry& a, const ProgEntry& b);

};

// for set<ProgEntry> underlaying tree.
bool operator<(const ProgEntry& a, const ProgEntry& b) {
    // comparing addresses of a and b would be wrong, as they may
    // differ while referencing the same Demo class object.
    return a.d < b.d;
}

set<ProgEntry> allprogs;
Server s;

void starter(std::istream & in, std::ostream & out)
{
    Demo prog(in,out);

	pthread_mutex_lock(&allprogsStackMutex);// prevent accidental stack
    allprogs.insert(ProgEntry(&prog));// data structure destruction
    pthread_mutex_unlock(&allprogsStackMutex);
    cout << "Trying to initialize connection" << endl;
    try
    {
	int i = prog.Start(); // start
	cout << "Connection finished with code " << i <<endl;// result
							     // on success
    }
    catch (exception)// exception caught. try to recover by ignoring it.
    {
	cout << "Connection finished with exception, but app is fine." <<endl;
    }
    pthread_mutex_lock(&allprogsStackMutex);
    cout << "Requesting erase of 1 app out of "<<allprogs.size()<<endl;;

    // if ProgEntry exists (not deleted by localInterface func)
    if (allprogs.find(ProgEntry(&prog)) != allprogs.end())
	allprogs.erase(ProgEntry(&prog));//erase it.
    cout << endl;
    pthread_mutex_unlock(&allprogsStackMutex);
    return;
}


text:
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TupleSections #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}

module Test.PGDeclaration (
    spec'
  ) where

import Data.Text (Text)
import Database.PostgreSQL.Simple.Bind.Parser
import Database.PostgreSQL.Simple.Bind.Representation (PGFunction(..), PGResult(..), PGIdentifier(..))
import Test.Hspec (Spec, describe, it)
import Data.Map.Strict (Map, (!))
import Test.Utils (testParser)

spec' :: Map FilePath Text -> Spec
spec' samples = do
  describe "pgDeclarations" $ do
    let test t = testParser pgDeclarations t . Right
    let functionTemplate = PGFunction {
          pgfIdentifier = PGIdentifier { pgiSchema = Nothing, pgiName = "" }
        , pgfArguments = []
        , pgfResult = PGSingle ["bigint"]}

    let foo = functionTemplate {pgfIdentifier = PGIdentifier { pgiSchema = Nothing, pgiName = "foo" }}
    let bar = functionTemplate {pgfIdentifier = PGIdentifier { pgiSchema = Nothing, pgiName = "bar" }}

    it "works with single function declaration" $ do
      test (samples ! "declarations-0001") [foo]

    it "works with multiple function declaration" $ do
      test (samples ! "declarations-0002") [foo, bar]

    it "ignores comments" $ do
      test (samples ! "declarations-0003") [foo, bar]

    it "ignores other clauses" $ do
      test (samples ! "declarations-0004") []


text:
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/

Route::get('auth/login', function() {
    if (Auth::check()) redirect('admin/domains');
    return \View::make('auth.login');
});

Route::post('auth/login', [
    'as' => 'login',
    'uses' => 'Auth\AuthController@authenticate',
]);

Route::get('auth/logout', [
    'as' => 'logout',
    'uses' => 'Auth\AuthController@logout',
]);

Route::group(['prefix' => 'admin', 'namespace' => 'Admin', 'middleware' => 'auth'], function () {
    Route::resource('domains', 'DomainsController');
});

Route::group(['prefix' => '_debugbar', 'namespace' => 'Barryvdh\Debugbar\Controllers'], function() {
    Route::get('open', [
        'as' => 'debugbar.openhandler',
        'uses' => 'OpenHandlerController@handle',
    ]);
    Route::get('assets/stylesheets', [
        'as' => 'debugbar.assets.css',
        'uses' => 'AssetController@css',
    ]);
    Route::get('assets/javascript', [
        'as' => 'debugbar.assets.js',
        'uses' => 'AssetController@js',
    ]);
});

Route::any('{all}', 'DomainsController@index')
    ->where('all', '.*');


text:
#include "config.h"

#if ENABLE(WEBGL)
#include "EXTBlendMinMax.h"

namespace WebCore {

EXTBlendMinMax::EXTBlendMinMax(WebGLRenderingContextBase& context)
    : WebGLExtension(context)
{
}

EXTBlendMinMax::~EXTBlendMinMax() = default;

WebGLExtension::ExtensionName EXTBlendMinMax::getName() const
{
    return EXTBlendMinMaxName;
}

} // namespace WebCore

#endif // ENABLE(WEBGL)


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
Agropyron spurium Melderis

### Remarks
null


text:
package servlet.people;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import servlet.GetResult;
import servlet.MyServlet;
import servlet.ServletResult;
import storage.DatabaseManager;

import com.j256.ormlite.stmt.QueryBuilder;

import entity.People;

/**
 * Servlet implementation class GetAllPeople
 */
@WebServlet("/People/GetAll")
public class GetAllPeople extends MyServlet {
	private static final long serialVersionUID = 1L;

	public GetAllPeople() {

    }

	@Override
	protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
		DatabaseManager manager=DatabaseManager.getManager();

		String fistName=request.getParameter(People.FIRST_NAME);

		try {
			if(!MyServlet.isEmpty(fistName)){
				QueryBuilder<People, Integer> query=manager.getPeopleDao().queryBuilder();

				query.where().like("firstName", fistName);

				ServletResult.sendResult(response, new GetResult(
						ServletResult.SUCCESS, query.query()));
			}
			else{
				ServletResult.sendResult(response, new GetResult(
						ServletResult.SUCCESS, manager.getPeopleDao().queryForAll()));
			}
		} catch (SQLException e) {
			e.printStackTrace();
			ServletResult.sendResult(response, ServletResult.ERROR);
		}
	}

}


text:
module Oden.Infer.Subsumption (
  SubsumptionError(..),
  subsumedBy,
  collectSubstitutions
) where

import Oden.Core as Core
import Oden.Infer.Substitution
import Oden.Metadata
import Oden.Type.Kind
import Oden.Type.Polymorphic
import Oden.SourceInfo

import           Control.Monad
import           Control.Monad.State
import           Control.Monad.Except

import qualified Data.Map               as Map

data SubsumptionError = SubsumptionError SourceInfo Type Type
                      deriving (Show, Eq)

type Subsume a = StateT (Map.Map TVar Type) (Except SubsumptionError) a

-- | Collects the substitutions in the 'Subsume' state for matching types and
-- throws 'SubsumptionError' on mismatches.
collectSubstitutions :: Type -> Type -> Subsume ()
collectSubstitutions t1 (TNamed _ _ t2) = collectSubstitutions t1 t2
collectSubstitutions (TNamed _ _ t1) t2 = collectSubstitutions t1 t2
collectSubstitutions (TCon _ n1) (TCon _ n2)
  | n1 == n2 = return ()
collectSubstitutions t (TVar (Metadata si) tv) = do
  st <- gets (Map.lookup tv)
  case st of
    Just t' | t == t'   -> return ()
            | otherwise -> throwError (SubsumptionError si t t')
    Nothing -> modify (Map.insert tv t)
collectSubstitutions (TFn _ a1 r1) (TFn _ a2 r2) = do
  collectSubstitutions a1 a2
  collectSubstitutions r1 r2
collectSubstitutions (TNoArgFn _ r1) (TNoArgFn _ r2) = collectSubstitutions r1 r2
collectSubstitutions (TForeignFn _ _ a1 r1) (TForeignFn _ _ a2 r2) =
  mapM_ (uncurry collectSubstitutions) (zip a1 a2 ++ zip r1 r2)
collectSubstitutions (TSlice _ t1) (TSlice _ t2) = collectSubstitutions t1 t2
collectSubstitutions (TTuple _ f1 s1 r1) (TTuple _ f2 s2 r2) = do
  collectSubstitutions f1 f2
  collectSubstitutions s1 s2
  zipWithM_ collectSubstitutions r1 r2
collectSubstitutions (TRecord _ r1) (TRecord _ r2) =
  collectSubstitutions r1 r2
collectSubstitutions r1 r2 | kindOf r1 == Row && kindOf r2 == Row = do
  let f1 = rowToList r1
      f2 = rowToList r2
  mapM_ (collectFromFields (Map.fromList f2)) f1
  where
  collectFromFields general (label, type') =
    case Map.lookup label general of
      Just genType -> collectSubstitutions type' genType
      Nothing -> throwError (SubsumptionError (getSourceInfo r2) r1 r2)
collectSubstitutions t1 t2 = throwError (SubsumptionError (getSourceInfo t2) t1 t2)

-- | Test if a type scheme is subsumed by an expression with a more general
-- type. If so, return the expression specialized to the less general type (all
-- subexpression types being substituted as well).
subsumedBy :: Scheme -> Core.Expr Type -> Either SubsumptionError Core.CanonicalExpr
subsumedBy s@(Forall _ _ st) expr = do
  subst <- snd <$> runExcept (runStateT (collectSubstitutions st (Core.typeOf expr)) Map.empty)
  return (s, apply (Subst subst) expr)


text:
body, html {
    font-family:georgia;
    color: #666666;
}
body, html, table, tr, td, tbody {
    padding:0;
    margin:0;
    vertical-align: top;
}

h1, h2, h3, h4, h5, h6 {
    overflow: visible;
    color: black;
}
p { margin-bottom:0px; }

a { text-decoration: none; color:#00AA00; }
a:hover { color: #820000; text-decoration: underline;}
img {border: none;}

a.main { font-size: 12pt; }

.wrapper { min-width: 762px; width: 762px; margin: 0 auto; }

#navigation {
    width: 100%; clear: both;
    font-family: HelveticaNeue,"Helvetica Neue",Helvetica,Arial,Verdana,sans-serif;
    background: #0F0F0F; text-align:center; padding: 8px;
    border-bottom:2px solid #00FF00;
    color: white; font-size: 10pt; font-weight: bold;
}
#navigation a { color: white; }
#navigation ul { display: block; margin:0; padding:0; }
#navigation li { list-style-type: none; display: inline; margin:0 5px 0 5px;}

#overview { width: 100%; clear: both; padding: 0px 0px 20px 0px;}
#overview div.logo {padding: 0px 20px 20px 0px; float: left;}
#overview div.message {
    font-size: 14pt;
}
#overview div.message h1{ margin-bottom: 5px; }

#spot { width: 100%;
    margin-top: 15px;
    background:transparent url(../images/spot-banner.gif) repeat-x scroll 0 0;
    height: 277px;
}
#spot div.title {
    text-align:center; height:25px;
    text-align:center; padding-top: 2px;
    color: white; font-size: 10pt; font-weight: bold;
    font-family: HelveticaNeue,"Helvetica Neue",Helvetica,Arial,Verdana,sans-serif;
}
#spot div.content table {
    width: 100%; text-align:center;
    color: black; font-size: 10pt;
}

#spot a:hover {text-decoration: none; }

#spot div.spot-balloon {
  background:transparent url( ../../../images/spot-get-involved.gif ) no-repeat;
  background-position:center;
  height: 121px;
  text-align:left;
  padding-top: 25px;
  padding-left: 35px;
}

#spot div.spot-balloon li {

  list-style: none;
}

#content { width: 100%; clear: both; }
#content .wrapper { min-width: 700px; width: 700px; margin: 0 auto; }
#content div.left {
  float:left;
  width:200px;
  text-align:right;
  font-size: 18pt;
  clear:both;
}
#content h1 {
  font-size: 18pt;
}
#content div.right {
  float:right;
  width:450px;
  text-align:left;
}

#blog { width: 100%;  }
#blog .wrapper { min-width: 600px; width: 600px; margin: 0 auto; }
#blog h1 {
  font-family: HelveticaNeue,"Helvetica Neue",Helvetica,Arial,Verdana,sans-serif;
  font-size: 18pt; color: #00AA00;
}
#blog h2 {
  border-bottom: thin dashed #DDD;
  font-size: 16pt;
  margin-bottom: 5px;
}
#blog div.post p {
  padding-left: 10px;
}
#blog div.post .details {
  padding-top: 5px;
  color: #ccc;
  font-size: 10pt;
  font-family: HelveticaNeue,"Helvetica Neue",Helvetica,Arial,Verdana,sans-serif;
}

#content .post h2 {
  margin-bottom:5px;
}
#content .post .details {
  color: #ccc;
  font-size: 10pt;
  font-family: HelveticaNeue,"Helvetica Neue",Helvetica,Arial,Verdana,sans-serif;
  margin-top:0px;
}

img.example {
  padding: 10px;
}


text:
import React from 'react'
import { Collapse } from 'react-bootstrap'
import GroupItem from './GroupItem'
import ConditionTag from './ConditionTag'
import classNames from 'classnames'
import './style.scss'

class TableSelector extends React.Component {
  static propTypes = {
    catpath: React.PropTypes.shape({
      text: React.PropTypes.string
    }),

    // 所有待选项目
    common: React.PropTypes.arrayOf(
      React.PropTypes.shape({
        text: React.PropTypes.string.isRequired,
        field: React.PropTypes.string.isRequired,
        required: React.PropTypes.bool,
        multiple: React.PropTypes.bool,
        sub: React.PropTypes.arrayOf(
          React.PropTypes.shape({
            text: React.PropTypes.string.isRequired,
            value: React.PropTypes.string.isRequired
          })
        )
      })
    ),

    // 选中的项目
    propSelected: React.PropTypes.arrayOf(
      React.PropTypes.shape({
        text: React.PropTypes.string.isRequired,
        field: React.PropTypes.string.isRequired,
        required: React.PropTypes.bool,
        multiple: React.PropTypes.bool,
        sub: React.PropTypes.arrayOf(
          React.PropTypes.shape({
            text: React.PropTypes.string.isRequired,
            value: React.PropTypes.string.isRequired
          })
        )
      })
    ),
    expand: React.PropTypes.bool,
    total: React.PropTypes.number,
    onPropChange: React.PropTypes.func,
    onToggleExpand: React.PropTypes.func
  }

  constructor (props, context) {
    super(props, context)

    this.state = {
      expand: true,  // 是否展开筛选
      propSelected: []
    }
  }

  componentWillReceiveProps (nextProps) {
    this.setState({
      'propSelected': nextProps.propSelected,
      'expand': nextProps.expand
    })
  }

  // shouldComponentUpdate(nextProps, nextState) {
  //   console.log('shouldComponentUpdate')
  //   if(!Object.is(nextState.propSelected, this.state.propSelected) || nextState.expand !== this.state.expand){
  //     return true
  //   }else{
  //     return false
  //   }
  // }

  selectCondition = (field, value) => {
    var condition = Object.assign({}, this.props.common.filter((x) => { return x.field === field })[0])
    condition.sub = condition.sub.filter((x) => { return value.some((v) => { return v === x.value }) })
    this.addCondition(condition)
  }

  unSelectCondition = (field, value) => {
    var condition = Object.assign({}, this.props.common.filter((x) => { return x.field === field })[0])
    condition.sub = condition.sub.filter((x) => { return value.some((v) => { return v === x.value }) })
    this.removeCondition(condition)
  }

  removeCondition (condition) {
    if (this.state.propSelected.filter((x) => { return x.field === condition.field }).length !== 0) {
      let propSelected = this.state.propSelected.filter((x) => {
        return x.field !== condition.field
      })
      this.setState({ 'propSelected': propSelected })
      this.props.onPropChange(propSelected)
    }
  }

  addCondition (condition) {
    let propSelected
    if (this.state.propSelected.filter((x) => { return x.field === condition.field }).length !== 0) {
      propSelected = this.state.propSelected.map((x) => {
        if (x.field === condition.field) {
          return condition
        } else {
          return x
        }
      })
      this.setState({ 'propSelected': propSelected })
      this.props.onPropChange(propSelected)
    } else {
      propSelected = this.state.propSelected.concat([condition])
      this.setState({ 'propSelected': propSelected })
    }
    this.props.onPropChange(propSelected)
  }

  toggleConditions = () => {
    this.setState({expand: !this.state.expand})
    this.props.onToggleExpand(this.state.expand)
  }

  render () {
    var component = this
    const propSelected = this.state.propSelected

    const toggleClasses = classNames({
      'show-collapse': this.state.expand,
      'J_ToggleNav': true,
      'icon-tag': true,
      'toggle-btn': true
    })

    return (

              显示筛选

              隐藏筛选

          {this.props.catpath.text}

          {
            (propSelected || []).map(function (cond, index) {
              const candidate = component.props.common.filter((x) => { return x.field === cond.field })[0].sub
              return (
                <ConditionTag key={index} condition={cond} candidate={candidate}
                  onSelectCondition={component.selectCondition} onUnSelectCondition={component.unSelectCondition} />
              )
            })
          }
          共{this.props.total}条记录

        <Collapse in={this.state.expand}>

          {
            this.props.common.map(function (cond, index) {
              /* 如果条件是非必须的 且 没有出现在propSelected当中渲染出来 */
              if (cond.required !== true && (propSelected || []).every((x) => { return x.field !== cond.field })) {
                return (
                  <GroupItem key={index} condition={cond} onSubmit={component.selectCondition} />)
              }
            })
          }

        </Collapse>

     )
  }
}

TableSelector.defaultProps = {
  catpath: {
    text: '条件'
  },
  common: [{
    text: '条件显示名称',
    field: '条件对应字段',
    required: false,
    multiple: false,
    sub: []
  }],
  propSelected: [],
  total: 0,
  onPropChange: function (propSelected) {
    console.log(propSelected)
  }
}
export default TableSelector


text:
boardinghouse\.migrations\.0005\_group\_views module
====================================================

.. automodule:: boardinghouse.migrations.0005_group_views
    :members:
    :show-inheritance:


text: <?php print $participants; ?>


text:
<!doctype html>

<meta charset="utf-8">
<link href="layout.css" charset="utf-8" type="text/css" rel="stylesheet"></link>
<title>SDL_HapticOpenFromMouse</title>

SDL_HapticOpenFromMouse

Use this function to try to open a haptic device from the current mouse.

Syntax

SDL_Haptic* SDL_HapticOpenFromMouse(void)

Return Value

Returns the haptic device identifier or NULL on failure; call SDL_GetError() for more information.

Code Examples

Remarks

Related Functions

SDL_HapticOpen

SDL_MouseIsHaptic


text:
require('chai').should();
var viewTestUtils = require('./utils/view-test-utils');
var _ = require('underscore');

var test_date = new Date();

var juttleEnv = {
    now : new Date()
};

describe('Time Chart Sink View', function () {
    var TimeChartView = require('../../src/views/timechart');

    describe('Series Labels', function () {
        describe('keyField specified', function() {
            it('series label should be the value of the keyField', function() {
                var chart = new TimeChartView({
                    juttleEnv : juttleEnv,
                    params : {
                        keyField : 'host'
                    }
                });

                chart.consume([
                    { time : test_date, host : 'host1', pop : 'pop1', value : 1 },
                    { time : test_date, host : 'host1', pop : 'pop2', value : 2 },
                    { time : test_date, host : 'host2', pop : 'pop2', value : 3 }
                ]);

                chart.chart.series['0'].label.should.equal('host1');
                chart.chart.series['1'].label.should.equal('host2');
            });
        });

        describe('keyField not specified', function() {
            it('series label should update based on new points.', function() {
                var chart = new TimeChartView({
                    juttleEnv : juttleEnv
                });

                chart.consume([
                    { time : test_date, host : 'host1', pop : 'pop1', country : 'Canada', value : 10 }
                ]);

                chart.chart.series['0'].label.should.equal('country: Canada');

                chart.consume([
                    { time : test_date, host : 'host1', pop : 'pop2', country : 'Canada', value : 10 },
                    { time : test_date, host : 'host2', pop : 'pop2', country : 'Canada', value : 10 }
                ]);

                chart.chart.series['0'].label.should.equal('host: host1, pop: pop1');
                chart.chart.series['1'].label.should.equal('host: host1, pop: pop2');
                chart.chart.series['2'].label.should.equal('host: host2, pop: pop2');

                chart.consume([
                    { time : test_date, host : 'host1', pop : 'pop2', country : 'Portugal', value : 10 }
                ]);

                chart.chart.series['0'].label.should.equal('country: Canada, host: host1, pop: pop1');
                chart.chart.series['1'].label.should.equal('country: Canada, host: host1, pop: pop2');
                chart.chart.series['2'].label.should.equal('country: Canada, host: host2, pop: pop2');
                chart.chart.series['3'].label.should.equal('country: Portugal, host: host1, pop: pop2');
            });

            it('Stream of points of only time and value fields should have series label of value field', function() {
                var chart = new TimeChartView({
                    juttleEnv : juttleEnv
                });

                chart.consume([
                    { time : test_date, value : 10 },
                    { time : test_date, value : 10 },
                    { time : test_date, value : 10 }
                ]);

                chart.chart.series['0'].label.should.equal('value');
            });

            it('numeric fields should be ignored for determining series', function() {
                var chart = new TimeChartView({
                    juttleEnv : juttleEnv,
                    params : {
                        valueField : 'value'
                    }
                });

                chart.consume([
                    { time : test_date, value : 10, value2 : 20, host : 'host1' },
                    { time : test_date, value : 11, value2 : 30, host : 'host2' }
                ]);

                chart.chart.series['0'].label.should.equal('host: host1');
                chart.chart.series['1'].label.should.equal('host: host2');
            });

            it('null fields should be ignored for determining series', function() {
                var chart = new TimeChartView({
                    juttleEnv : juttleEnv,
                    params : {
                        valueField : 'value'
                    }
                });

                // The second two points should fall into the two series of the first two points
                // despite having an extra field with a `null` value.
                chart.consume([
                    {time: test_date, name: 'metric1', host: 'A', value: 1},
                    {time: test_date, name: 'metric2', host: 'A', value: 1},
                    {time: new Date(test_date.getTime() + 1000), name: 'metric1', host: 'A', value: 2, numCores: null},
                    {time: new Date(test_date.getTime() + 1000), name: 'metric2', host: 'A', value: 2, numCores: null}
                ]);

                chart.chart.series['0'].label.should.equal('name: metric1');
                chart.chart.series['1'].label.should.equal('name: metric2');
                Object.keys(chart.chart.series).length.should.equal(2);
            });
        });

        describe('missing fields', function() {
            it('not shown if there are other non-missing keyfields', function() {
                var chart = new TimeChartView({
                    juttleEnv : juttleEnv
                });

                chart.consume([
                    { time : test_date, value : 10, common: 'test', not_common: 'shown' },
                    { time : test_date, value : 10, common: 'test1' }
                ]);

                chart.chart.series['0'].label.should.equal('common: test, not_common: shown');
                chart.chart.series['1'].label.should.equal('common: test1');
            });

            it('shown if there are no other non-missing keyfields', function() {
                var chart = new TimeChartView({
                    juttleEnv : juttleEnv
                });

                chart.consume([
                    { time : test_date, value : 10, common: 'test', some_field: 'shown' },
                    { time : test_date, value : 10, common: 'test'}
                ]);

                chart.chart.series['0'].label.should.equal('some_field: shown');
                chart.chart.series['1'].label.should.equal('some_field: null');
            });
        });
    });

    describe('invalid params', function() {
        it('unknown top level field', function() {
            viewTestUtils.verifyValidationError({
                viewConstructor : TimeChartView,
                params : {
                    columnOrder : 'asdf'
                },
                errorPath : 'columnOrder',
                error : {
                    'code' : 'UNKNOWN',
                    'info' : {}
                }
            });
        });

        it('non-string valueField', function() {
            viewTestUtils.verifyValidationError({
                viewConstructor : TimeChartView,
                params : {
                    valueField : []
                },
                errorPath : 'valueField',
                error : {
                    'code' : 'INVALID_TYPE',
                    'info' : {
                        'type' : 'STRING'
                    }
                }
            });
        });

        it('invalid axis', function() {
            viewTestUtils.verifyValidationError({
                viewConstructor : TimeChartView,
                params : {
                    yScales : {
                        primary : {
                            displayOnAxis : 'diagonal'
                        }
                    }
                },
                errorPath : 'yScales.primary.displayOnAxis',
                error : {
                    'code' : 'ENUM',
                    'info' : {
                        'allowedValues' : 'top, bottom, left, right'
                    }
                }
            });
        });

        it('invalid scale', function() {
            viewTestUtils.verifyValidationError({
                viewConstructor : TimeChartView,
                params : {
                    yScales : {
                        secondary : {},
                        invalid : {}
                    }
                },
                errorPath : 'yScales',
                error : {
                    'code' : 'INVALID_SCALE',
                    'info' : {
                        'scale' : 'invalid'
                    }
                }
            });
        });

        it('min value greater than max value', function() {
            viewTestUtils.verifyValidationError({
                viewConstructor : TimeChartView,
                params : {
                    yScales : {
                        primary : {
                            minValue : 100,
                            maxValue : 50
                        }
                    }
                },
                errorPath : 'yScales.primary.minValue',
                error : {
                    'code' : 'MIN_VALUE_LESS_THAN_MAX_VALUE',
                    'info' : {}
                }
            });
        });

        it('min value greater than max value', function() {
            viewTestUtils.verifyValidationError({
                viewConstructor : TimeChartView,
                params : {
                    yScales : {
                        primary : {
                            minValue : 100,
                            maxValue : 50
                        }
                    }
                },
                errorPath : 'yScales.primary.minValue',
                error : {
                    'code' : 'MIN_VALUE_LESS_THAN_MAX_VALUE',
                    'info' : {}
                }
            });
        });

        it('series with in-existant scale', function() {
            viewTestUtils.verifyValidationError({
                viewConstructor : TimeChartView,
                params : {
                    series : [{
                        name : 'host1',
                        yScale : 'nonExistantScale'
                    }]
                },
                errorPath : 'series.0.yScale',
                error : {
                    'code' : 'SERIES_SCALE_NOT_FOUND',
                    'info' : {
                        'scale': 'nonExistantScale'
                    }
                }
            });
        });

        it('interval with non-duration value', function() {
            viewTestUtils.verifyValidationError({
                viewConstructor : TimeChartView,
                params : {
                    interval : 'someString'
                },
                errorPath : 'interval',
                error : {
                    'code' : 'INVALID_TYPE',
                    'info' : {
                        'type' : 'DURATION'
                    }
                }
            });
        });
    });

    describe('Runtime Messages', function () {
        it('Waiting for Data', function() {
            var chart = new TimeChartView({
                juttleEnv : juttleEnv
            });
            chart.setDimensions(null, 100, 100);

            viewTestUtils.verifyRuntimeMessage(chart, 'WAITING_FOR_DATA');

            chart.consume([
                { time : test_date, host : 'host1', pop : 'pop1', value : 1 }
            ]);

            viewTestUtils.verifyNoRuntimeMessages(chart);
        });

        it('No Data Received', function() {
            var chart = new TimeChartView({
                juttleEnv : juttleEnv
            });
            chart.setDimensions(null, 100, 100);

            chart.consume_eof();
            viewTestUtils.verifyRuntimeMessage(chart, 'NO_DATA_RECEIVED');
        });

        it('Value field does not exist', function() {
            var chart = new TimeChartView({
                juttleEnv : juttleEnv,
                params : {
                    valueField : 'v',
                    keyField : 'host'
                }
            });
            chart.setDimensions(null, 100, 100);

            chart.consume([
                { time: test_date, host: 'host1', value: 1 },
                { time: test_date, host: 'host2', value: 1 },
                { time: test_date, host: 'host3', value: 1 },
                { time: test_date, host: 'host4', value: 1 },
                { time: test_date, host: 'host5', value: 1 }
            ]);

            viewTestUtils.verifyRuntimeMessage(chart, 'VALUE_FIELD_NON_NUMERIC', {
                valueField : 'v'
            });
        });

        it('null valueField does not trigger VALUE_FIELD_NON_NUMERIC', function() {
            var chart = new TimeChartView({
                juttleEnv : juttleEnv,
                params : {
                    valueField : 'value',
                    keyField : 'host'
                }
            });
            chart.setDimensions(null, 100, 100);

            chart.consume([
                { time: test_date, host: 'host1', value: null },
                { time: test_date, host: 'host2', value: null },
                { time: test_date, host: 'host3', value: null },
                { time: test_date, host: 'host4', value: null },
                { time: test_date, host: 'host5', value: null }
            ]);

            viewTestUtils.verifyNoRuntimeMessages(chart);
        });

        it('test COULD_NOT_DETERMINE_VALUE_FIELD', function() {
            var chart = new TimeChartView({
                juttleEnv : juttleEnv,
                params : {
                    keyField : 'host'
                }
            });
            chart.setDimensions(null, 100, 100);

            chart.consume([
                { time: test_date, host: 'host1', value: 'A' }
            ]);

            viewTestUtils.verifyRuntimeMessage(chart, 'COULD_NOT_DETERMINE_VALUE_FIELD');
        });

        it('Invalid time field', function() {
            var chart = new TimeChartView({
                juttleEnv : juttleEnv,
                params : {
                    timeField: 'host'
                }
            });
            chart.setDimensions(null, 100, 100);

            chart.consume([
                { time: test_date, host: 'host1', value: 1 },
                { time: test_date, host: 'host2', value: 1 },
                { time: test_date, host: 'host3', value: 1 },
                { time: test_date, host: 'host4', value: 1 },
                { time: test_date, host: 'host5', value: 1 }
            ]);

            viewTestUtils.verifyRuntimeMessage(chart, 'TIME_FIELD_ERROR');
        });

        it('Multiple points with the same timestamp and series', function() {
            var chart = new TimeChartView({
                juttleEnv : juttleEnv,
                params : {
                    keyField : 'host'
                }
            });
            chart.setDimensions(null, 100, 100);

            chart.consume([
                { time: test_date, host: 'host1', value: 1 },
                { time: test_date, host: 'host1', value: 2 },
                { time: test_date, host: 'host2', value: 3 },
                { time: test_date, host: 'host2', value: 4 }
            ]);

            viewTestUtils.verifyRuntimeMessage(chart, 'MULTIPLE_POINTS_SAME_TIME_SAME_SERIES');
        });

        it('downsampling defaults to 2 pixels per point', function() {
            var chart = new TimeChartView({
                juttleEnv : juttleEnv,
                params : {}
            });

            chart.setDimensions(null, 800, 500);

            var points = [];
            for(var i = 0; i < 401; i++) {
                points.push({
                    time: new Date(i * 1000),
                    value: 1
                });
            }

            chart.consume(points.slice(0, 400));
            viewTestUtils.verifyNoRuntimeMessages(chart);

            chart.consume([points[points.length - 1]]);
            viewTestUtils.verifyRuntimeMessage(chart, 'DOWNSAMPLING_WARNING');
        });

        it('downsampling can be turned off', function() {
            var chart = new TimeChartView({
                juttleEnv : juttleEnv,
                params : {
                    downsample: false
                }
            });

            chart.setDimensions(null, 800, 500);

            var points = [];
            for(var i = 0; i < 500; i++) {
                points.push({
                    time: new Date(i * 1000),
                    value: 1
                });
            }

            chart.consume(points);
            viewTestUtils.verifyNoRuntimeMessages(chart);
        });

        it('Show downsampling warning', function() {
            var chart = new TimeChartView({
                juttleEnv : juttleEnv,
                params : {
                    keyField : 'host'
                }
            });
            chart.setDimensions(null, 800, 500);

            // push points in that will create 2 series
            chart.consume([
                { time: test_date, host: 'host1', value: 1 },
                { time: test_date, host: 'host2', value: 1 }
            ]);

            // simulate downsampling in one series
            _.values(chart.series)[0].series.target.trigger('downsample', 2);
            viewTestUtils.verifyRuntimeMessage(chart, 'DOWNSAMPLING_WARNING');

            // and turn it off
            _.values(chart.series)[0].series.target.trigger('downsample', 1);
            viewTestUtils.verifyNoRuntimeMessages(chart);

            // simulate downsampling in both series
            _.values(chart.series)[0].series.target.trigger('downsample', 2);
            _.values(chart.series)[1].series.target.trigger('downsample', 2);
            viewTestUtils.verifyRuntimeMessage(chart, 'DOWNSAMPLING_WARNING');

            // simulate downsampling turnoff in one of the series
            // and ensure the warning is still there
            _.values(chart.series)[0].series.target.trigger('downsample', 1);
            viewTestUtils.verifyRuntimeMessage(chart, 'DOWNSAMPLING_WARNING');

            // simulate downsampling turnoff in the remaining series
            // and ensure the warning is gone
            _.values(chart.series)[1].series.target.trigger('downsample', 1);
            viewTestUtils.verifyNoRuntimeMessages(chart);
        });

        it('default series limit reached', function() {
            var NUM_POINTS = 20;
            var chart = new TimeChartView({
                juttleEnv : juttleEnv,
                params : {
                    keyField : 'host'
                }
            });
            chart.setDimensions(null, 100, 100);

            var points = [];

            for (var i = 0; i < NUM_POINTS; i++) {
                points.push({ time: test_date, host: 'host' + i, value: i });
            }

            chart.consume(points);

            viewTestUtils.verifyNoRuntimeMessages(chart);

            chart.consume([
                { time: test_date, host: 'host' + NUM_POINTS + 1, value: NUM_POINTS + 1 }
            ]);

            viewTestUtils.verifyRuntimeMessage(chart, 'SERIES_LIMIT_REACHED', {
                seriesLimit: NUM_POINTS
            });
        });

        it('configured series limit reached', function() {
            var NUM_POINTS = 3;
            var chart = new TimeChartView({
                juttleEnv : juttleEnv,
                params : {
                    keyField : 'host',
                    seriesLimit: NUM_POINTS
                }
            });
            chart.setDimensions(null, 100, 100);

            var points = [];

            for (var i = 0; i < NUM_POINTS; i++) {
                points.push({ time: test_date, host: 'host' + i, value: i });
            }

            chart.consume(points);

            viewTestUtils.verifyNoRuntimeMessages(chart);

            chart.consume([
                { time: test_date, host: 'host' + NUM_POINTS + 1, value: NUM_POINTS + 1 }
            ]);

            viewTestUtils.verifyRuntimeMessage(chart, 'SERIES_LIMIT_REACHED', {
                seriesLimit: NUM_POINTS
            });
        });
    });
});


text:
<?php

declare(strict_types=1);

namespace spec\Sylius\Component\Promotion\Exception;

use PhpSpec\ObjectBehavior;
use Sylius\Component\Promotion\Generator\PromotionCouponGeneratorInstructionInterface;

final class FailedGenerationExceptionSpec extends ObjectBehavior
{
    function let(
        PromotionCouponGeneratorInstructionInterface $instruction,
        \InvalidArgumentException $previousException
    ): void {
        $instruction->getAmount()->willReturn(17);
        $instruction->getCodeLength()->willReturn(1);
        $this->beConstructedWith($instruction, 0, $previousException);
    }

    function it_is_an_exception(): void
    {
        $this->shouldHaveType(\InvalidArgumentException::class);
    }

    function it_has_a_proper_message(): void
    {
        $this
            ->getMessage()
            ->shouldReturn('Invalid coupon code length or coupons amount. It is not possible to generate 17 unique coupons with 1 code length')
        ;
    }

    function it_has_a_proper_previous_exception(\InvalidArgumentException $previousException): void
    {
        $this->getPrevious()->shouldReturn($previousException);
    }
}


text:
namespace AirlineSystem.Web.Areas.Flight.Controllers
{
    using System.Linq;
    using System.Web.Mvc;

    using AirlineSystem.Data;
    using AirlineSystem.Web.Areas.Flight.Models;
    using AirlineSystem.Web.Controllers;

    using AutoMapper.QueryableExtensions;

    public class SearchController : BaseController
    {
        public SearchController(IAirlineSystemData data) : base(data)
        {
        }

        // GET: Flight/Search
        public ActionResult Index()
        {
            return this.View();
        }

        [HttpGet]
        public ActionResult SearchForFlight()
        {
            var airports = this.Data.Airports.All().OrderBy(a => a.Name).ToList();

            var model = new FlightSearchViewModel();
            model.SelectableAirports = airports
                                               .Select(a => new SelectListItem
                                                      {
                                                          Value = a.Name.ToString(),
                                                          Text = a.Name,
                                                      })
                                               .ToList();

            return this.View(model);
        }

        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult SearchForFlight(FlightSearchViewModel inputModel)
        {
            if (inputModel != null && ModelState.IsValid)
            {
                var fromAirport = inputModel.FromAirport;
                var toAirport = inputModel.ToAirport;
                var fromDate = inputModel.FromDate;
                var toDate = inputModel.ToDate;
                var ticketsWanted = inputModel.TicketsWanted;

                var flights = this.Data.Flights.All()
                                  .Where(f => f.FromAirport.Name == fromAirport &&
                                              f.ToAirport.Name == toAirport &&
                                              f.DepartureTime.Year == fromDate.Year &&
                                              f.DepartureTime.Month == fromDate.Month &&
                                              f.DepartureTime.Day == fromDate.Day &&
                                              f.Seats - f.Tickets.Count >= ticketsWanted)
                                  .AsQueryable()
                                  .Project()
                                  .To<FlightViewModel>()
                                  .ToList();

                this.TempData["FlightSearchModel"] = inputModel;
                this.ViewBag.TicketsWanted = inputModel.TicketsWanted;
                this.ViewBag.IsTwoWay = inputModel.IsTwoWay;

                return this.PartialView("_FlightSearchResult", flights);
            }

            return this.View("SearchForFlight", inputModel);
        }
    }
}


text:
// TODO(bjornv): Make this a comprehensive test.

#include BOSS_WEBRTC_U_modules__audio_processing__aec__echo_cancellation_h //original-code:"modules/audio_processing/aec/echo_cancellation.h"

#include <stdlib.h>
#include <time.h>

#include BOSS_WEBRTC_U_modules__audio_processing__aec__aec_core_h //original-code:"modules/audio_processing/aec/aec_core.h"
#include BOSS_WEBRTC_U_rtc_base__checks_h //original-code:"rtc_base/checks.h"
#include "test/gtest.h"

namespace webrtc {

TEST(EchoCancellationTest, CreateAndFreeHasExpectedBehavior) {
  void* handle = WebRtcAec_Create();
  ASSERT_TRUE(handle);
  WebRtcAec_Free(nullptr);
  WebRtcAec_Free(handle);
}

TEST(EchoCancellationTest, ApplyAecCoreHandle) {
  void* handle = WebRtcAec_Create();
  ASSERT_TRUE(handle);
  EXPECT_TRUE(WebRtcAec_aec_core(NULL) == NULL);
  AecCore* aec_core = WebRtcAec_aec_core(handle);
  EXPECT_TRUE(aec_core != NULL);
  // A simple test to verify that we can set and get a value from the lower
  // level |aec_core| handle.
  int delay = 111;
  WebRtcAec_SetSystemDelay(aec_core, delay);
  EXPECT_EQ(delay, WebRtcAec_system_delay(aec_core));
  WebRtcAec_Free(handle);
}

}  // namespace webrtc