text:
package org.elasticsearch.xpack.deprecation;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

import org.apache.http.HttpHost;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.Response;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.test.rest.ESRestTestCase;

import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

import static org.elasticsearch.common.logging.DeprecatedMessage.KEY_FIELD_NAME;
import static org.elasticsearch.xpack.deprecation.DeprecationTestUtils.DATA_STREAM_NAME;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.startsWith;

/**
 * Tests that deprecation message on startup creates a deprecation data stream
 */
public class EarlyDeprecationIndexingIT extends ESRestTestCase {

    /**
     * In EarlyDeprecationTestPlugin#onNodeStarted we simulate a very early deprecation that can happen before the template is loaded
     * The indexing has to be delayed until templates are loaded.
     * This test confirms by checking the settings that a data stream is created (not an index with defaults)
     * and that an early deprecation warning is not lost
     */
    public void testEarlyDeprecationIsIndexedAfterTemplateIsLoaded() throws Exception {

        assertBusy(() -> {
            Response response = getIndexSettings();
            ObjectMapper mapper = new ObjectMapper();

            final JsonNode jsonNode = mapper.readTree(response.getEntity().getContent());
            assertThat(jsonNode.fieldNames().next(), startsWith(".ds-" + DATA_STREAM_NAME));

            final JsonNode settings = jsonNode.elements().next();
            final JsonNode index = settings.at("/settings/index");
            assertThat(index.at("/lifecycle/name").asText(), equalTo(".deprecation-indexing-ilm-policy"));
            assertThat(index.get("auto_expand_replicas").asText(), equalTo("0-1"));
            assertThat(index.get("hidden").asText(), equalTo("true"));
        }, 30, TimeUnit.SECONDS);

        assertBusy(() -> {
            List<Map<String, Object>> documents = DeprecationTestUtils.getIndexedDeprecations(client());
            logger.warn(documents);
            assertThat(
                documents,
                containsInAnyOrder(
                    allOf(
                        hasEntry(KEY_FIELD_NAME, "early_deprecation"),
                        hasEntry("message", "Early deprecation emitted after node is started up")
                    )
                )
            );
        }, 30, TimeUnit.SECONDS);
    }

    private Response getIndexSettings() throws Exception {
        try {
            Response response = client().performRequest(new Request("GET", "/" + DATA_STREAM_NAME + "/_settings"));
            assertOK(response);
            return response;
        } catch (Exception e) {
            throw new AssertionError(e);
        }
    }

    /**
     * Builds a REST client that will tolerate warnings in the response headers. The default
     * is to throw an exception.
     */
    @Override
    protected RestClient buildClient(Settings settings, HttpHost[] hosts) throws IOException {
        RestClientBuilder builder = RestClient.builder(hosts);
        configureClient(builder, settings);
        builder.setStrictDeprecationMode(false);
        return builder.build();
    }
}


text:
using System;
using System.Threading.Tasks;
using Amazon.Auth.AccessControlPolicy;
using Amazon.Auth.AccessControlPolicy.ActionIdentifiers;
using Amazon.SQS;
using Amazon.SQS.Model;

namespace JustSaying.AwsTools.MessageHandling
{
    public class SqsPolicy
    {
        private readonly string _policy;
        public SqsPolicy(string policy)
        {
            _policy = policy;
        }

        public static async Task SaveAsync(string sourceArn, string queueArn, string queueUrl, IAmazonSQS client)
        {
            var topicArnWildcard = CreateTopicArnWildcard(sourceArn);
            ActionIdentifier[] actions = { SQSActionIdentifiers.SendMessage };

            var sqsPolicy = new Policy()
                .WithStatements(new Statement(Statement.StatementEffect.Allow)
                    .WithPrincipals(Principal.AllUsers)
                    .WithResources(new Resource(queueArn))
                    .WithConditions(ConditionFactory.NewSourceArnCondition(topicArnWildcard))
                    .WithActionIdentifiers(actions));
            var setQueueAttributesRequest = new SetQueueAttributesRequest
            {
                QueueUrl = queueUrl,
                Attributes = { ["Policy"] = sqsPolicy.ToJson() }
            };

            await client.SetQueueAttributesAsync(setQueueAttributesRequest).ConfigureAwait(false);
        }

        public override string ToString() => _policy;

        private static string CreateTopicArnWildcard(string topicArn)
        {
            if (string.IsNullOrWhiteSpace(topicArn))
            {
                // todo should not get here?
                return "*";
            }

            var index = topicArn.LastIndexOf(":", StringComparison.OrdinalIgnoreCase);
            if (index > 0)
            {
                topicArn = topicArn.Substring(0, index + 1);
            }

            return topicArn + "*";
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.gbm import H2OGradientBoostingEstimator

def cupMediumGBM():

  train = h2o.import_file(path=pyunit_utils.locate("bigdata/laptop/usecases/cup98LRN_z.csv"))
  test = h2o.import_file(path=pyunit_utils.locate("bigdata/laptop/usecases/cup98VAL_z.csv"))

  train["TARGET_B"] = train["TARGET_B"].asfactor()

  # Train H2O GBM Model:
  train_cols = train.names
  for c in ['C1', "TARGET_D", "TARGET_B", "CONTROLN"]:
    train_cols.remove(c)

  model = H2OGradientBoostingEstimator(distribution="bernoulli", ntrees=5)
  model.train(x=train_cols,y="TARGET_B", training_frame=train)

if __name__ == "__main__":
  pyunit_utils.standalone_test(cupMediumGBM)
else:
  cupMediumGBM()


text:
=================
SSH based plugin
=================

.. currentmodule:: monitoring.nagios.plugin

The class :class:`NagiosPluginSSH` that inherits from :class:`NagiosPlugin` is
responsible to init a plugin that makes use of SSH to check something.

If you show the help with ``--help``, you will see extra arguments provided by
the class. It uses the same mechanics as we saw in :doc:`new_plugin` section. It
overrides :meth:`NagiosPlugin.define_plugin_arguments` to define new arguments
and :meth:`NagiosPlugin.verify_plugin_arguments` to do arguments checking.

Getting started
===============

Instanciate a new SSH plugin with::

 >>> import logging
 >>> from monitoring.nagios.plugin import NagiosPluginSSH

 >>> logger = logging.getLogger('plugin')

 >>> plugin = NagiosPluginSSH(version="1.0",
 >>>                          description="Do something using SSH.")

Default plugin arguments
========================

The class defines the following default set of arguments.

- ``-H``: The hostaddress of the server to connect on.
- ``-P``: Port to connect to (default to 22).
- ``-u, --username``: Login user. Default to current logged in user.
- ``-p, --password``: Login user password. Default is to use pub key of the
  current user.
- ``-t, --timeout``: Connection timeout in seconds (default to 10 secs).

.. currentmodule:: monitoring.nagios.probes.secureshell

Remote actions
==============

Use attribute ``ssh`` to make use of the SSH probe. Look at deeper details
within the API reference for :class:`ProbeSSH` class.

Get a command output
--------------------

Here is how you can execute a command::

 >>> cmd = plugin.ssh.execute("ls -l /")

This will return a :class:`CommandResult` instance with useful attributes like
:attr:`CommandResult.output` for lines on stdout, :attr:`CommandResult.errors`
for lines on stderr and :attr:`CommandResult.status` for status code of the
command.

Read output of the command and get a list with::

 >>> cmd.output
 ['total 160',
 'drwxr-xr-x   2 root root  4096 janv. 15 08:53 bin',
 'drwxr-xr-x   4 root root 12288 f\xc3\xa9vr. 25 17:41 boot',
 'drwxr-xr-x   2 root root  4096 d\xc3\xa9c.   4  2012 cdrom',
 'drwxr-xr-x  16 root root  4280 mars   5 08:38 dev',
 'drwxr-xr-x 170 root root 12288 mars   5 08:38 etc',
 'drwxr-xr-x   3 root root  4096 d\xc3\xa9c.   4  2012 home',
 '...']

As this is a list, you can easily iterate over each lines::

 >>> for line in cmd.output:
 >>>     # Do something with line...

The method :meth:`ProbeSSH.execute` will raise
:class:`ProbeSSH.SSHCommandTimeout` exception if timeout is reached (as
defined by the ``-t`` plugin argument).

You can also get the command status code instead::

 >>> if cmd.status == 0:
 >>>    print "Command executed successfully ;-)"

Get a list of files in a directory
----------------------------------

The SSH probe has suppport to easily find files within a directory that match a
pattern. It has support for recursion but disabled by default.

Search for ``*.txt`` files in ``/tmp``::

 >>> text_files = plugin.ssh.list_files(directory="/tmp", glob="*.txt")
 ['/tmp/c.txt',
 '/tmp/e.txt',
 '/tmp/d.txt',
 '/tmp/o.txt',
 '/tmp/t.txt',
 '/tmp/y.txt',
 '/tmp/b.txt',
 '/tmp/r.txt',
 '/tmp/a.txt']

Now with recursion up to 5 sub-directories::

 >>> text_files = plugin.ssh.list_files(directory="/tmp", glob="*.txt", depth=5)
 ['/tmp/c.txt',
 '/tmp/e.txt',
 '/tmp/d.txt',
 '/tmp/o.txt',
 '/tmp/tata/a.txt',
 '/tmp/t.txt',
 '/tmp/y.txt',
 '/tmp/toto/b/b.txt',
 '/tmp/toto/c/b.txt',
 '/tmp/toto/a/b.txt',
 '/tmp/b.txt',
 '/tmp/r.txt',
 '/tmp/a.txt']

Get file or directory last modified time
----------------------------------------

The SSH probe defines methods to obtain the last modified time of a file or
directory.

:meth:`ProbeSSH.get_file_lastmodified_minutes` will give you for how much
minutes the file was last modified.

:meth:`ProbeSSH.get_file_lastmodified_timestamp` will give you the last modified
time as a Unix Timestamp (UTC).

Example::

 >>> plugin.ssh.get_file_lastmodified_minutes("/etc/motd")
 16
 >>> plugin.ssh.get_file_lastmodified_timestamp("/etc/motd")
 1294765528


text:
package debop4k.core.java8.model;

import lombok.Getter;
import lombok.Setter;

import java.util.Collections;
import java.util.List;
import java.util.stream.Stream;

import static java.util.stream.Collectors.toList;

@Getter
@Setter
public class Album implements Performance {

  private String name;
  private List<Track> tracks;
  private List<Artist> musicians;

  public Album(String name, List<Track> tracks, List<Artist> musicians) {
    this.name = name;
    this.tracks = tracks;
    this.musicians = musicians;
  }

  public Stream<Track> getTracks() {
    return tracks.stream();
  }

  @Override
  public Stream<Artist> getMusicians() {
    return musicians.stream();
  }

  public List<Track> getTrackList() {
    return Collections.unmodifiableList(tracks);
  }

  public List<Artist> getMusicianList() {
    return Collections.unmodifiableList(musicians);
  }

  public Artist getMainMusician() {
    return musicians.get(0);
  }

  public Album copy() {
    List<Track> tracks = getTracks().map(Track::copy).collect(toList());
    List<Artist> musicians = getMusicians().map(Artist::copy).collect(toList());

    return new Album(name, tracks, musicians);
  }
}


text:
package io.jboot.utils;

import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author michael yang (fuhai999@gmail.com)
 * @Date: 2019/11/21
 */
public class NamedThreadFactory implements ThreadFactory {

    protected static final AtomicInteger POOL_COUNTER = new AtomicInteger(1);
    protected final AtomicInteger mThreadCounter;
    protected final String mPrefix;
    protected final boolean mDaemon;
    protected final ThreadGroup mGroup;

    public NamedThreadFactory() {
        this("pool-" + POOL_COUNTER.getAndIncrement(), false);
    }

    public NamedThreadFactory(String prefix) {
        this(prefix, false);
    }

    public NamedThreadFactory(String prefix, boolean daemon) {
        this.mThreadCounter = new AtomicInteger(1);
        this.mPrefix = prefix + "-thread-";
        this.mDaemon = daemon;
        SecurityManager s = System.getSecurityManager();
        this.mGroup = s == null ? Thread.currentThread().getThreadGroup() : s.getThreadGroup();
    }

    @Override
    public Thread newThread(Runnable runnable) {
        String name = this.mPrefix + this.mThreadCounter.getAndIncrement();
        Thread ret = new Thread(this.mGroup, runnable, name, 0L);
        ret.setDaemon(this.mDaemon);
        return ret;
    }

    public ThreadGroup getThreadGroup() {
        return this.mGroup;
    }
}


text:
using Cake.Common.Tests.Fixtures.Tools.TextTransform;
using Cake.Common.Tools.TextTransform;
using Cake.Core;
using NSubstitute;
using Xunit;

namespace Cake.Common.Tests.Unit.Tools.TextTransform
{
    public sealed class TextTransformAliasTests
    {
        public sealed class TheTransformTemplateMethod
        {
            [Fact]
            public void Should_Throw_If_Context_Is_Null()
            {
                // Given
                var fixture = new TextTransformFixture();

                // When
                var result = Record.Exception(() => TextTransformAliases.TransformTemplate(null, fixture.SourceFile));

                // Then
                Assert.IsArgumentNullException(result, "context");
            }

            [Fact]
            public void Should_Throw_If_Source_File_Is_Null()
            {
                // Given
                var context = Substitute.For<ICakeContext>();

                // When
                var result = Record.Exception(() => TextTransformAliases.TransformTemplate(context, null));

                // Then
                Assert.IsArgumentNullException(result, "sourceFile");
            }
        }
    }
}


text:
using System;

namespace FclEx
{
    public static class DateTimeExtensions
    {
        private static readonly DateTime _jan1St1970 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

        public const string ShortTimeFormat = "yyyyMMddHHmmss";
        public const string CommonTimeFormat = "yyyy-MM-dd HH:mm:ss";

        /// <summary>
        /// Unix时间戳
        /// 自1970年1月1日0时起的秒数
        /// </summary>
        /// <param name="d"></param>
        /// <returns></returns>
        public static long ToUnixTimeSeconds(this DateTime d)
        {
            return (long)(d.ToUniversalTime() - _jan1St1970).TotalSeconds;
        }

        public static long ToUnixTimeMilli(this DateTime d)
        {
            return (long)(d.ToUniversalTime() - _jan1St1970).TotalMilliseconds;
        }

        public static string ToShort(this DateTime @this) => @this.ToString(ShortTimeFormat);

        public static string ToCommon(this DateTime @this) => @this.ToString(CommonTimeFormat);

        public static DateTime AddWeek(this DateTime dateTime) => AddWeeks(dateTime, 1);

        public static DateTime AddWeeks(this DateTime dateTime, int numberOfWeeks)
        {
            return dateTime.AddDays(numberOfWeeks * 7);
        }

        public static DateTime StartOfWeek(this DateTime dt, int hour = 0, int minute = 0, int second = 0, DayOfWeek startOfWeek = DayOfWeek.Monday)
        {
            var diff = (7 + (dt.DayOfWeek - startOfWeek)) % 7;
            return Today(dt, hour, minute, second).AddDays(-1 * diff);
        }

        public static DateTime EndOfWeek(this DateTime dt, int hour = 0, int minute = 0, int second = 0, DayOfWeek startOfWeek = DayOfWeek.Monday)
        {
            return StartOfWeek(dt, hour, minute, second, startOfWeek).AddDays(6);
        }

        public static DateTime Today(this DateTime dt, int hour = 0, int minute = 0, int second = 0)
        {
            return new DateTime(dt.Year, dt.Month, dt.Day, hour, minute, second);
        }

        public static DateTime Tomorrow(this DateTime dt, int hour = 0, int minute = 0, int second = 0)
        {
            return Today(dt, hour, minute, second).AddDays(1);
        }

        public static DateTime Yesterday(this DateTime dt, int hour = 0, int minute = 0, int second = 0)
        {
            return Today(dt, hour, minute, second).AddDays(-1);
        }

        public static DateTime ThisYear(this DateTime dt, int month, int day, int hour = 0, int minute = 0, int second = 0)
        {
            return new DateTime(dt.Year, month, day, hour, minute, second);
        }

        public static DateTime ThisMonth(this DateTime dt, int day, int hour = 0, int minute = 0, int second = 0)
        {
            return new DateTime(dt.Year, dt.Month, day, hour, minute, second);
        }

        public static DateTime EndOfMonth(this DateTime dt, int hour = 0, int minute = 0, int second = 0)
        {
            return new DateTime(dt.Year, dt.Month, DateTime.DaysInMonth(dt.Year, dt.Month), hour, minute, second);
        }

        public static DateTime StartOfMonth(this DateTime dt, int hour = 0, int minute = 0, int second = 0)
        {
            return new DateTime(dt.Year, dt.Month, 1, hour, minute, second);
        }

        public static DateTime LastTickOfMonth(this DateTime dt, int hour = 0, int minute = 0, int second = 0)
        {
            var lastDay = dt.EndOfMonth();
            return lastDay.AddDays(1).AddTicks(-1);
        }

        public static DateTime GetMaxTimeOfDate(this DateTime dt)
        {
            return dt.Date.AddDays(1).AddTicks(-1);
        }

        public static DateTime? GetMaxTimeOfDate(this DateTime? dt)
        {
            return dt?.GetMaxTimeOfDate();
        }

        public static DateTime? GetDate(this DateTime? dt)
        {
            return dt?.Date;
        }

        public static string ToStringOrEmpty(this DateTime dt, string format = CommonTimeFormat)
        {
            return dt == default
                ? string.Empty
                : dt.ToString(format);
        }

        public static string ToStringOrEmpty(this DateTime? dt, string format = CommonTimeFormat)
        {
            return dt.HasValue
                ? ToStringOrEmpty(dt.Value, format)
                : string.Empty;
        }

        public static DateTime ToUtc(this DateTime time)
        {
            return time.Kind switch
            {
                DateTimeKind.Local => time.ToUniversalTime(),
                DateTimeKind.Unspecified => time.SpecifyKind(DateTimeKind.Utc),
                DateTimeKind.Utc => time,
                _ => throw new ArgumentOutOfRangeException()
            };
        }

        public static DateTime SpecifyKind(this DateTime time, DateTimeKind kind)
        {
            return DateTime.SpecifyKind(time, kind);
        }

        public static DateTime ToCnTime(this DateTime time)
        {
            return time.ToUtc().AddHours(8);
        }
    }
}


text:
package org.motechproject.mds.web.rest;

import org.junit.Test;
import org.motechproject.mds.query.QueryParams;
import org.motechproject.mds.util.Order;

import java.util.HashMap;
import java.util.Map;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;

public class ParamParserTest {

    @Test
    public void shouldBuildQueryParams() {
        Map<String, String> requestParams = new HashMap<>();
        requestParams.put("page", "14");
        requestParams.put("pageSize", "120");
        requestParams.put("sort", "someColumn");
        requestParams.put("order", "desc");

        QueryParams queryParams = ParamParser.buildQueryParams(requestParams);

        assertEquals(Integer.valueOf(14), queryParams.getPage());
        assertEquals(Integer.valueOf(120), queryParams.getPageSize());
        assertNotNull(queryParams.getOrder());
        assertEquals("someColumn", queryParams.getOrder().getField());
        assertEquals(Order.Direction.DESC, queryParams.getOrder().getDirection());

        // null order

        requestParams.remove("sort");
        requestParams.remove("order");

        queryParams = ParamParser.buildQueryParams(requestParams);

        assertNull(queryParams.getOrder());

        // default order direction

        requestParams.put("sort", "anotherColumn");

        queryParams = ParamParser.buildQueryParams(requestParams);

        assertNotNull(queryParams.getOrder());
        assertEquals("anotherColumn", queryParams.getOrder().getField());
        assertEquals(Order.Direction.ASC, queryParams.getOrder().getDirection());
    }

    @Test
    public void shouldGetLookupName() {
        Map<String, String> requestParams = new HashMap<>();
        assertNull(ParamParser.getLookupName(requestParams));

        requestParams.put("lookup", "findByName");
        assertEquals("findByName", ParamParser.getLookupName(requestParams));
    }

    @Test
    public void shouldGetIds() {
        Map<String, String> requestParams = new HashMap<>();
        assertNull(ParamParser.getId(requestParams));

        requestParams.put("id", "14");
        assertEquals(Long.valueOf(14), ParamParser.getId(requestParams));
    }
}


text:
{-# LANGUAGE ExistentialQuantification, OverloadedStrings, PatternGuards #-}
import Control.Concurrent (forkIO)
import Control.Concurrent.MVar (newMVar, putMVar, readMVar, takeMVar)
import Control.Monad (forever, forM_)
import Control.Monad.Trans (liftIO)
import Data.Monoid (mappend)

import Data.ByteString (ByteString)
import Data.ByteString.Lazy.Char8 ()
import Data.Text (Text)
import Data.Enumerator ((=$))
import qualified Data.Enumerator.List as EL
import qualified Data.Text.Lazy as TL

import Network.WebSockets.Protocol (Protocol (..))
import qualified Network.WebSockets as WS
import qualified Network.WebSockets.Protocol.Hybi00.Internal as WS
import qualified Network.WebSockets.Protocol.Hybi10.Internal as WS
import qualified Network.WebSockets.Protocol.Unsafe as WS.Unsafe

--------------------------------------------------------------------------------
-- Hybi00-compatible tests                                                    --
--------------------------------------------------------------------------------

echoText :: WS.TextProtocol p => WS.WebSockets p ()
echoText = forever $ do
    msg <- WS.receiveData
    liftIO $ putStrLn $ show (msg :: TL.Text)
    WS.sendTextData msg

closeMe :: WS.TextProtocol p => WS.WebSockets p ()
closeMe = do
    msg <- WS.receiveData
    case (msg :: TL.Text) of
        "Close me!" -> return ()
        _           -> error "closeme: unexpected input"

concurrentSend :: WS.TextProtocol p => WS.WebSockets p ()
concurrentSend = do
    sink <- WS.getSink
    liftIO $ do
        mvars <- mapM newMVar [1 :: Int .. 100]
        forM_ mvars $ \mvar -> forkIO $ do
            i <- readMVar mvar
            WS.sendSink sink $ WS.textData $
                "Herp-a-derp " `mappend` TL.pack (show i)
            _ <- takeMVar mvar
            return ()
        forM_ mvars $ flip putMVar 0

--------------------------------------------------------------------------------
-- Hybi10-compatible tests                                                    --
--------------------------------------------------------------------------------

ping :: WS.BinaryProtocol p => WS.WebSockets p ()
ping = do
    forM_ ["Hai", "Come again?", "Right!"] $ \msg -> do
        WS.send $ WS.ping msg
        fr <- WS.receive
        case fr of
            WS.ControlMessage (WS.Pong msg')
                | msg' == msg -> return ()
                | otherwise   -> error "wrong message from client"
            _ -> error "ping: client closed socket too soon"

    WS.send $ WS.textData ("OK" :: Text)

echo :: WS.Protocol p => WS.WebSockets p ()
echo = forever $ WS.receive >>= WS.send

--------------------------------------------------------------------------------
-- Running...                                                                 --
--------------------------------------------------------------------------------

-- | All tests
tests :: WS.BinaryProtocol p => [(ByteString, WS.WebSockets p ())]
tests =
    [ ("/echo-text",       echo)
    , ("/close-me",        closeMe)
    , ("/concurrent-send", concurrentSend)
    , ("/ping",            ping)
    , ("/echo",            echo)
    ]

data UnsafeProtocol = forall p. WS.Protocol p => UnsafeProtocol p

instance WS.Protocol UnsafeProtocol where
    version        (UnsafeProtocol p)   = version p
    headerVersions (UnsafeProtocol p)   = headerVersions p
    supported      (UnsafeProtocol p) h = supported p h
    encodeMessages (UnsafeProtocol p)   =
        (EL.map WS.Unsafe.castMessage =$) . encodeMessages p
    decodeMessages (UnsafeProtocol p)   =
        (decodeMessages p =$) . EL.map WS.Unsafe.castMessage
    finishRequest  (UnsafeProtocol p)   = finishRequest p
    implementations                     =
        [UnsafeProtocol WS.Hybi00_, UnsafeProtocol WS.Hybi10_]

instance WS.TextProtocol UnsafeProtocol
instance WS.BinaryProtocol UnsafeProtocol

-- | Application
application :: WS.Request -> WS.WebSockets UnsafeProtocol ()
application rq = do
    -- When a client succesfully connects, lookup the requested test and
    -- run it
    WS.acceptRequest rq
    version'' <- WS.getVersion
    liftIO $ putStrLn $ "==================================="
    liftIO $ putStrLn $ "Requested client version: " ++ show version'
    liftIO $ putStrLn $ "Selected version: " ++ version''
    let name = WS.requestPath rq
    liftIO $ putStrLn $ "Starting test " ++ show name
    let Just test = lookup name tests in test
    liftIO $ putStrLn $ "Test " ++ show name ++ " finished"
  where
    version' = lookup "Sec-WebSocket-Version" (WS.requestHeaders rq)

-- | Accepts clients, spawns a single handler for each one.
main :: IO ()
main = WS.runServer "0.0.0.0" 8000 application


text:
<?php
/**
 * Template used to display Tag Archive pages
 *
 * @package WordPress
 * @subpackage Twenty_Eleven
 * @since Twenty Eleven 1.0
 */

get_header(); ?>

			<?php if ( have_posts() ) : ?>

<?php
						printf( __( 'Tag Archives: %s', 'twentyeleven' ), '' . single_tag_title( '', false ) . '' );
					?>

					<?php
						$tag_description = tag_description();
						if ( ! empty( $tag_description ) ) {
							/**
							 * Filter the default Twenty Eleven tag description.
							 *
							 * @since Twenty Eleven 1.0
							 *
							 * @param string The default tag description.
							 */
							echo apply_filters( 'tag_archive_meta', '
' . $tag_description . '
' );
						}
					?>

				<?php twentyeleven_content_nav( 'nav-above' ); ?>

				<?php /* Start the Loop */ ?>
				<?php while ( have_posts() ) : the_post(); ?>

					<?php
						/*
						 * Include the Post-Format-specific template for the content.
						 * If you want to overload this in a child theme then include a file
						 * called content-___.php (where ___ is the Post Format name) and that
						 * will be used instead.
						 */
						get_template_part( 'content', get_post_format() );
					?>

				<?php endwhile; ?>

				<?php twentyeleven_content_nav( 'nav-below' ); ?>

			<?php else : ?>

<?php _e( 'Nothing Found', 'twentyeleven' ); ?>

<?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?>

						<?php get_search_form(); ?>

			<?php endif; ?>

<?php get_sidebar(); ?>
<?php get_footer(); ?>


text:
@interface FLTUserMessagingPlatformManagerTest : XCTestCase
@end

@interface FLTUserMessagingPlatformManager ()
@property UIViewController *rootController;
@end

@implementation FLTUserMessagingPlatformManagerTest {
  FLTUserMessagingPlatformManager *umpManager;
  NSObject<FlutterBinaryMessenger> *binaryMessenger;
  UMPConsentInformation *mockUmpConsentInformation;
  FlutterResult flutterResult;
  bool resultInvoked;
  id _Nullable returnedResult;
}

- (void)setUp {
  binaryMessenger = OCMProtocolMock(@protocol(FlutterBinaryMessenger));
  umpManager = [[FLTUserMessagingPlatformManager alloc]
      initWithBinaryMessenger:binaryMessenger];
  id umpInfoClassMock = OCMClassMock([UMPConsentInformation class]);
  OCMStub(ClassMethod([umpInfoClassMock sharedInstance]))
      .andReturn(umpInfoClassMock);
  mockUmpConsentInformation = umpInfoClassMock;

  resultInvoked = false;
  returnedResult = nil;
  flutterResult = ^(id _Nullable result) {
    self->resultInvoked = true;
    self->returnedResult = result;
  };
}

- (void)testReset {
  FlutterMethodCall *methodCall =
      [FlutterMethodCall methodCallWithMethodName:@"ConsentInformation#reset"
                                        arguments:@{}];

  [umpManager handleMethodCall:methodCall result:flutterResult];

  XCTAssertTrue(resultInvoked);
  XCTAssertEqual(returnedResult, nil);
  OCMVerify([mockUmpConsentInformation reset]);
}

- (void)testGetConsentStatus {
  FlutterMethodCall *methodCall = [FlutterMethodCall
      methodCallWithMethodName:@"ConsentInformation#getConsentStatus"
                     arguments:@{}];

  OCMStub([mockUmpConsentInformation consentStatus])
      .andReturn(UMPConsentStatusRequired);

  [umpManager handleMethodCall:methodCall result:flutterResult];

  XCTAssertTrue(resultInvoked);
  NSNumber *expected =
      [[NSNumber alloc] initWithInteger:UMPConsentStatusRequired];
  XCTAssertEqual(returnedResult, expected);
  OCMVerify([mockUmpConsentInformation consentStatus]);
}

- (void)testRequestConsentInfoUpdate_success {
  UMPRequestParameters *params = OCMClassMock([UMPRequestParameters class]);

  FlutterMethodCall *methodCall = [FlutterMethodCall
      methodCallWithMethodName:@"ConsentInformation#requestConsentInfoUpdate"
                     arguments:@{@"params" : params}];

  OCMStub([mockUmpConsentInformation
              requestConsentInfoUpdateWithParameters:[OCMArg isEqual:params]
                                   completionHandler:[OCMArg any]])
      .andDo(^(NSInvocation *invocation) {
        void (^completionHandler)(NSError *error);
        [invocation getArgument:&completionHandler atIndex:3];
        completionHandler(nil);
      });

  [umpManager handleMethodCall:methodCall result:flutterResult];

  XCTAssertTrue(resultInvoked);
  XCTAssertNil(returnedResult);
  OCMVerify([mockUmpConsentInformation
      requestConsentInfoUpdateWithParameters:[OCMArg any]
                           completionHandler:[OCMArg any]]);
}

- (void)testRequestConsentInfoUpdate_error {
  UMPRequestParameters *params = OCMClassMock([UMPRequestParameters class]);
  FlutterMethodCall *methodCall = [FlutterMethodCall
      methodCallWithMethodName:@"ConsentInformation#requestConsentInfoUpdate"
                     arguments:@{@"params" : params}];

  NSDictionary *userInfo = @{NSLocalizedDescriptionKey : @"description"};
  NSError *error = [NSError errorWithDomain:@"domain" code:1 userInfo:userInfo];
  OCMStub([mockUmpConsentInformation
              requestConsentInfoUpdateWithParameters:[OCMArg isEqual:params]
                                   completionHandler:[OCMArg any]])
      .andDo(^(NSInvocation *invocation) {
        void (^completionHandler)(NSError *error);
        [invocation getArgument:&completionHandler atIndex:3];
        completionHandler(error);
      });

  [umpManager handleMethodCall:methodCall result:flutterResult];

  XCTAssertTrue(resultInvoked);

  OCMVerify([mockUmpConsentInformation
      requestConsentInfoUpdateWithParameters:[OCMArg any]
                           completionHandler:[OCMArg any]]);
  FlutterError *resultError = (FlutterError *)returnedResult;
  XCTAssertEqualObjects(resultError.code, @"1");
  XCTAssertEqualObjects(resultError.details, @"domain");
  XCTAssertEqualObjects(resultError.message, @"description");
}

- (void)testLoadConsentForm_successAndDispose {
  FlutterMethodCall *methodCall = [FlutterMethodCall
      methodCallWithMethodName:@"UserMessagingPlatform#loadConsentForm"
                     arguments:@{}];

  id mockUmpConsentForm = OCMClassMock([UMPConsentForm class]);
  OCMStub([mockUmpConsentForm loadWithCompletionHandler:[OCMArg any]])
      .andDo(^(NSInvocation *invocation) {
        void (^completionHandler)(UMPConsentForm *form, NSError *loadError);
        [invocation getArgument:&completionHandler atIndex:2];
        completionHandler(mockUmpConsentForm, nil);
      });

  FLTUserMessagingPlatformManager *partialMock = OCMPartialMock(umpManager);
  FLTUserMessagingPlatformReaderWriter *mockReaderWriter =
      OCMClassMock([FLTUserMessagingPlatformReaderWriter class]);
  OCMStub([partialMock readerWriter]).andReturn(mockReaderWriter);

  [partialMock handleMethodCall:methodCall result:flutterResult];

  XCTAssertTrue(resultInvoked);
  XCTAssertEqual(returnedResult, mockUmpConsentForm);
  OCMVerify([mockUmpConsentForm loadWithCompletionHandler:[OCMArg any]]);
  OCMVerify([mockReaderWriter trackConsentForm:mockUmpConsentForm]);
}

- (void)testLoadConsentForm_error {
  FlutterMethodCall *methodCall = [FlutterMethodCall
      methodCallWithMethodName:@"UserMessagingPlatform#loadConsentForm"
                     arguments:@{}];

  NSDictionary *userInfo = @{NSLocalizedDescriptionKey : @"description"};
  NSError *error = [NSError errorWithDomain:@"domain" code:1 userInfo:userInfo];
  id mockUmpConsentForm = OCMClassMock([UMPConsentForm class]);
  OCMStub([mockUmpConsentForm loadWithCompletionHandler:[OCMArg any]])
      .andDo(^(NSInvocation *invocation) {
        void (^completionHandler)(UMPConsentForm *form, NSError *loadError);
        [invocation getArgument:&completionHandler atIndex:2];
        completionHandler(mockUmpConsentForm, error);
      });

  [umpManager handleMethodCall:methodCall result:flutterResult];

  XCTAssertTrue(resultInvoked);
  OCMVerify([mockUmpConsentForm loadWithCompletionHandler:[OCMArg any]]);
  FlutterError *resultError = (FlutterError *)returnedResult;
  XCTAssertEqualObjects(resultError.code, @"1");
  XCTAssertEqualObjects(resultError.details, @"domain");
  XCTAssertEqualObjects(resultError.message, @"description");
}

- (void)testIsConsentFormAvailable_available {
  FlutterMethodCall *methodCall = [FlutterMethodCall
      methodCallWithMethodName:@"ConsentInformation#isConsentFormAvailable"
                     arguments:@{}];

  OCMStub([mockUmpConsentInformation formStatus])
      .andReturn(UMPFormStatusAvailable);

  [umpManager handleMethodCall:methodCall result:flutterResult];

  XCTAssertTrue(resultInvoked);
  XCTAssertEqual(returnedResult, [[NSNumber alloc] initWithBool:YES]);
}

- (void)testIsConsentFormAvailable_notAvailable {
  FlutterMethodCall *methodCall = [FlutterMethodCall
      methodCallWithMethodName:@"ConsentInformation#isConsentFormAvailable"
                     arguments:@{}];

  OCMStub([mockUmpConsentInformation formStatus])
      .andReturn(UMPFormStatusUnavailable);

  [umpManager handleMethodCall:methodCall result:flutterResult];

  XCTAssertTrue(resultInvoked);
  XCTAssertEqual(returnedResult, [[NSNumber alloc] initWithBool:NO]);
}

- (void)testShowConsentForm_success {
  UIViewController *mockUIViewController = OCMClassMock(UIViewController.class);
  FLTUserMessagingPlatformManager *partialMock = OCMPartialMock(umpManager);
  OCMStub([partialMock rootController]).andReturn(mockUIViewController);

  UMPConsentForm *mockForm = OCMClassMock([UMPConsentForm class]);
  FlutterMethodCall *methodCall =
      [FlutterMethodCall methodCallWithMethodName:@"ConsentForm#show"
                                        arguments:@{@"consentForm" : mockForm}];

  OCMStub([mockForm presentFromViewController:[OCMArg any]
                            completionHandler:[OCMArg any]])
      .andDo(^(NSInvocation *invocation) {
        void (^completionHandler)(NSError *error);
        [invocation getArgument:&completionHandler atIndex:3];
        completionHandler(nil);
      });
  ;

  [partialMock handleMethodCall:methodCall result:flutterResult];

  XCTAssertTrue(resultInvoked);
  XCTAssertNil(returnedResult);
  OCMVerify([mockForm presentFromViewController:[OCMArg any]
                              completionHandler:[OCMArg any]]);
}

- (void)testShowConsentForm_error {
  UIViewController *mockUIViewController = OCMClassMock(UIViewController.class);
  FLTUserMessagingPlatformManager *partialMock = OCMPartialMock(umpManager);
  OCMStub([partialMock rootController]).andReturn(mockUIViewController);

  UMPConsentForm *mockForm = OCMClassMock([UMPConsentForm class]);
  FlutterMethodCall *methodCall =
      [FlutterMethodCall methodCallWithMethodName:@"ConsentForm#show"
                                        arguments:@{@"consentForm" : mockForm}];

  NSDictionary *userInfo = @{NSLocalizedDescriptionKey : @"description"};
  NSError *error = [NSError errorWithDomain:@"domain" code:1 userInfo:userInfo];
  OCMStub([mockForm presentFromViewController:[OCMArg any]
                            completionHandler:[OCMArg any]])
      .andDo(^(NSInvocation *invocation) {
        void (^completionHandler)(NSError *error);
        [invocation getArgument:&completionHandler atIndex:3];
        completionHandler(error);
      });
  ;

  [partialMock handleMethodCall:methodCall result:flutterResult];

  XCTAssertTrue(resultInvoked);
  OCMVerify([mockForm presentFromViewController:[OCMArg any]
                              completionHandler:[OCMArg any]]);
  FlutterError *resultError = (FlutterError *)returnedResult;
  XCTAssertEqualObjects(resultError.code, @"1");
  XCTAssertEqualObjects(resultError.details, @"domain");
  XCTAssertEqualObjects(resultError.message, @"description");
}

@end


text:
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */

/*
 Copyright (C) 2006 Joseph Wang

 This file is part of QuantLib, a free-software/open-source library
 for financial quantitative analysts and developers - http://quantlib.org/

 QuantLib is free software: you can redistribute it and/or modify it
 under the terms of the QuantLib license.  You should have received a
 copy of the license along with this program; if not, please email
 <quantlib-dev@lists.sf.net>. The license is also available online at
 <http://quantlib.org/license.shtml>.

 This program is distributed in the hope that it will be useful, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 FOR A PARTICULAR PURPOSE.  See the license for more details.
*/

#ifndef quantlib_test_time_series_hpp
#define quantlib_test_time_series_hpp

#include <boost/test/unit_test.hpp>

/* remember to document new and/or updated tests in the Doxygen
   comment block of the corresponding class */

class TimeSeriesTest {
  public:
    static void testConstruction();
    static void testIntervalPrice();
    static void testIterators();
    static boost::unit_test_framework::test_suite* suite();

};

#endif


text:
/*global describe, it, before */
/**
 * REST API Tests
 */
var request = require('supertest');
var app = require('../server');
var assert = require('assert');

before(function importSampleData(done) {
  this.timeout(50000);
  if (app.importing) {
    app.on('import done', done);
  } else {
    done();
  }
});

function json(verb, url) {
  return request(app)[verb](url)
    .set('Content-Type', 'application/json')
    .set('Accept', 'application/json')
    .expect('Content-Type', /json/);
}

describe('REST', function() {
  this.timeout(30000);

  /**
   * Expected Input Tests
   */

});


text:
Platipi is a social network for the socially challenged individuals amongst us on this vast planet.
Create an account, customize your profile, and select from a wide variety of traits in order to be matched
with your new found clique of godliness.

# People

David Chan,
Kendall Weistroffer,
Jeff Everett,
Franklin Harvey


text:
FROM node:0.10-onbuild
# replace this with your application's default port
EXPOSE 3000


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:isScrollContainer="false">

    <LinearLayout
        android:id="@+id/gadget_name_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="10dp"
        android:orientation="vertical">

        <TextView
            android:id="@+id/gadget_address"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="30sp" />

        <TextView
            android:id="@+id/gadget_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="25sp" />

        <RelativeLayout
            android:id="@+id/battery_level_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:background="@drawable/background">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="60dp"
                android:gravity="center_vertical"
                android:paddingLeft="10dp"
                android:text="Battery"
                android:textSize="25sp" />

            <TextView
                android:id="@+id/battery_level"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_centerVertical="true"
                android:layout_marginEnd="10dp"
                android:layout_marginStart="8dp"
                android:textSize="24sp" />

            <ProgressBar
                android:id="@+id/battery_bar"
                style="@style/Base.Widget.AppCompat.ProgressBar.Horizontal"
                android:layout_width="match_parent"
                android:layout_height="28dp"
                android:layout_alignParentStart="true"
                android:layout_centerVertical="true"
                android:layout_marginEnd="10dp"
                android:layout_marginStart="120dp"
                android:layout_toStartOf="@id/battery_level"
                android:clickable="false"
                android:max="100"
                android:paddingStart="0dp"
                android:progress="0"
                android:progressDrawable="@drawable/battery_level" />

        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/logging_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:background="@drawable/background">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="60dp"
                android:gravity="center_vertical"
                android:paddingLeft="10dp"
                android:text="Logging"
                android:textSize="25sp" />

            <Switch
                android:id="@+id/toggle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_centerVertical="true"
                android:layout_gravity="end"
                android:layout_marginEnd="10dp"
                android:checked="true"
                android:enabled="false"
                android:textOff="@string/toggle_off"
                android:textOn="@string/toggle_on"
                android:textSize="14sp"
                android:textStyle="bold"
                android:showText="true"
                android:thumb="@drawable/toggle_selector"
                android:track="@drawable/toggle_path"/>

        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/logging_interval_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:background="@drawable/background">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="60dp"
                android:gravity="center_vertical"
                android:paddingLeft="10dp"
                android:text="Logging Interval"
                android:textSize="25sp" />

            <Button
                android:id="@+id/logging_interval"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_centerVertical="true"
                android:layout_gravity="end"
                android:layout_marginEnd="10dp"
                android:layout_marginStart="8dp"
                android:background="@color/sensirion_grey_light"
                android:textColor="@color/button_states"
                android:textSize="20sp"
                android:visibility="visible"
                style="?android:attr/borderlessButtonStyle"/>

        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/download_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:background="@drawable/background">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="60dp"
                android:gravity="center_vertical"
                android:paddingLeft="10dp"
                android:text="Logged Data"
                android:textSize="25sp" />

            <ProgressBar
                android:id="@+id/progress_bar"
                style="@style/Base.Widget.AppCompat.ProgressBar.Horizontal"
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:layout_alignParentStart="true"
                android:layout_centerVertical="true"
                android:layout_marginEnd="10dp"
                android:clickable="false"
                android:max="100"
                android:paddingStart="10dp"
                android:progress="100"
                android:progressDrawable="@drawable/progress" />

            <TextView
                android:id="@+id/progress"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_centerVertical="true"
                android:layout_marginEnd="8dp"
                android:textColor="@color/button_states"
                android:textSize="25sp" />

        </RelativeLayout>

    </LinearLayout>

    <Button
        android:id="@+id/manage_device_button_disconnect"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_gravity="center"
        android:background="@color/red"
        android:onClick="onDisconnectClick"
        android:text="Disconnect"
        android:textColor="@android:color/white"
        android:textSize="14sp" />

</RelativeLayout>


text:
<!doctype html>

        <meta charset="utf-8">
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Local storage</title>

            With localStorage you can save up to 5mb of data.

            You can ONLY save string data in localStorage

            localStorage is domain specific.


text:
/**
 * Replacement implementations of getline and getdelim in the event
 * that we are on OS X.
 *
 * Author: Paul McCarthy <pauld.mccarthy@gmail.com>
 */

#ifndef __GETLINE_H__
#define __GETLINE_H__

#include <stdio.h>
#include <unistd.h>

ssize_t cnet_getline(char **lineptr, size_t *n, FILE *stream);
ssize_t cnet_getdelim(char **lineptr, size_t *n, int delim, FILE *stream);

#endif /* __GETLINE_H__ */


text:
package mocks

import (
	reflect "reflect"

	do "github.com/digitalocean/doctl/do"
	godo "github.com/digitalocean/godo"
	gomock "github.com/golang/mock/gomock"
)

// MockMonitoringService is a mock of MonitoringService interface.
type MockMonitoringService struct {
	ctrl     *gomock.Controller
	recorder *MockMonitoringServiceMockRecorder
}

// MockMonitoringServiceMockRecorder is the mock recorder for MockMonitoringService.
type MockMonitoringServiceMockRecorder struct {
	mock *MockMonitoringService
}

// NewMockMonitoringService creates a new mock instance.
func NewMockMonitoringService(ctrl *gomock.Controller) *MockMonitoringService {
	mock := &MockMonitoringService{ctrl: ctrl}
	mock.recorder = &MockMonitoringServiceMockRecorder{mock}
	return mock
}

// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockMonitoringService) EXPECT() *MockMonitoringServiceMockRecorder {
	return m.recorder
}

// CreateAlertPolicy mocks base method.
func (m *MockMonitoringService) CreateAlertPolicy(request *godo.AlertPolicyCreateRequest) (*do.AlertPolicy, error) {
	m.ctrl.T.Helper()
	ret := m.ctrl.Call(m, "CreateAlertPolicy", request)
	ret0, _ := ret[0].(*do.AlertPolicy)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}

// CreateAlertPolicy indicates an expected call of CreateAlertPolicy.
func (mr *MockMonitoringServiceMockRecorder) CreateAlertPolicy(request interface{}) *gomock.Call {
	mr.mock.ctrl.T.Helper()
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateAlertPolicy", reflect.TypeOf((*MockMonitoringService)(nil).CreateAlertPolicy), request)
}

// DeleteAlertPolicy mocks base method.
func (m *MockMonitoringService) DeleteAlertPolicy(arg0 string) error {
	m.ctrl.T.Helper()
	ret := m.ctrl.Call(m, "DeleteAlertPolicy", arg0)
	ret0, _ := ret[0].(error)
	return ret0
}

// DeleteAlertPolicy indicates an expected call of DeleteAlertPolicy.
func (mr *MockMonitoringServiceMockRecorder) DeleteAlertPolicy(arg0 interface{}) *gomock.Call {
	mr.mock.ctrl.T.Helper()
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAlertPolicy", reflect.TypeOf((*MockMonitoringService)(nil).DeleteAlertPolicy), arg0)
}

// GetAlertPolicy mocks base method.
func (m *MockMonitoringService) GetAlertPolicy(arg0 string) (*do.AlertPolicy, error) {
	m.ctrl.T.Helper()
	ret := m.ctrl.Call(m, "GetAlertPolicy", arg0)
	ret0, _ := ret[0].(*do.AlertPolicy)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}

// GetAlertPolicy indicates an expected call of GetAlertPolicy.
func (mr *MockMonitoringServiceMockRecorder) GetAlertPolicy(arg0 interface{}) *gomock.Call {
	mr.mock.ctrl.T.Helper()
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAlertPolicy", reflect.TypeOf((*MockMonitoringService)(nil).GetAlertPolicy), arg0)
}

// ListAlertPolicies mocks base method.
func (m *MockMonitoringService) ListAlertPolicies() (do.AlertPolicies, error) {
	m.ctrl.T.Helper()
	ret := m.ctrl.Call(m, "ListAlertPolicies")
	ret0, _ := ret[0].(do.AlertPolicies)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}

// ListAlertPolicies indicates an expected call of ListAlertPolicies.
func (mr *MockMonitoringServiceMockRecorder) ListAlertPolicies() *gomock.Call {
	mr.mock.ctrl.T.Helper()
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAlertPolicies", reflect.TypeOf((*MockMonitoringService)(nil).ListAlertPolicies))
}

// UpdateAlertPolicy mocks base method.
func (m *MockMonitoringService) UpdateAlertPolicy(uuid string, request *godo.AlertPolicyUpdateRequest) (*do.AlertPolicy, error) {
	m.ctrl.T.Helper()
	ret := m.ctrl.Call(m, "UpdateAlertPolicy", uuid, request)
	ret0, _ := ret[0].(*do.AlertPolicy)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}

// UpdateAlertPolicy indicates an expected call of UpdateAlertPolicy.
func (mr *MockMonitoringServiceMockRecorder) UpdateAlertPolicy(uuid, request interface{}) *gomock.Call {
	mr.mock.ctrl.T.Helper()
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateAlertPolicy", reflect.TypeOf((*MockMonitoringService)(nil).UpdateAlertPolicy), uuid, request)
}


text:
import { browser, by, element } from 'protractor';

describe('Adjudicator', () => {

  beforeEach(() => {
    browser.get('/');
  });

  it('should have a title', () => {
    let subject = browser.getTitle();
    let result  = 'Angular2 Webpack Starter by @gdi2290 from @AngularClass';
    expect(subject).toEqual(result);
  });

  it('should have header', () => {
    let subject = element(by.css('h1')).isPresent();
    let result  = true;
    expect(subject).toEqual(result);
  });

  it('should have <home>', () => {
    let subject = element(by.css('app home')).isPresent();
    let result  = true;
    expect(subject).toEqual(result);
  });

  it('should have buttons', () => {
    let subject = element(by.css('button')).getText();
    let result  = 'Submit Value';
    expect(subject).toEqual(result);
  });

});


text:
// -----------------------------------------------------------------------
// <copyright file="Util.cs">
//https://github.com/evanwon/WPFCustomMessageBox
// </copyright>
// -----------------------------------------------------------------------

namespace WPFCustomMessageBox
{
    using System.Drawing;
    using System.Windows;
    using System.Windows.Interop;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;

    internal static class Util
    {
        internal static ImageSource ToImageSource(this Icon icon)
        {
            ImageSource imageSource = Imaging.CreateBitmapSourceFromHIcon(
                icon.Handle,
                Int32Rect.Empty,
                BitmapSizeOptions.FromEmptyOptions());

            return imageSource;
        }

        /// <summary>
        /// Keyboard Accellerators are used in Windows to allow easy shortcuts to controls like Buttons and
        /// MenuItems. These allow users to press the Alt key, and a shortcut key will be highlighted on the
        /// control. If the user presses that key, that control will be activated.
        /// This method checks a string if it contains a keyboard accellerator. If it doesn't, it adds one to the
        /// beginning of the string. If there are two strings with the same accellerator, Windows handles it.
        /// The keyboard accellerator character for WPF is underscore (_). It will not be visible.
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        internal static string TryAddKeyboardAccellerator(this string input)
        {
            const string accellerator = "_";            // This is the default WPF accellerator symbol - used to be & in WinForms

            // If it already contains an accellerator, do nothing
            if (input.Contains(accellerator)) return input;

            return accellerator + input;
        }
    }
}


text:
#include "src/core/channel/client_uchannel.h"

#include <string.h>

#include "src/core/census/grpc_filter.h"
#include "src/core/channel/channel_args.h"
#include "src/core/channel/client_channel.h"
#include "src/core/channel/compress_filter.h"
#include "src/core/channel/subchannel_call_holder.h"
#include "src/core/iomgr/iomgr.h"
#include "src/core/support/string.h"
#include "src/core/surface/channel.h"
#include "src/core/transport/connectivity_state.h"

#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/useful.h>

/** Microchannel (uchannel) implementation: a lightweight channel without any
 * load-balancing mechanisms meant for communication from within the core. */

typedef struct client_uchannel_channel_data {
  /** master channel - the grpc_channel instance that ultimately owns
      this channel_data via its channel stack.
      We occasionally use this to bump the refcount on the master channel
      to keep ourselves alive through an asynchronous operation. */
  grpc_channel_stack *owning_stack;

  /** connectivity state being tracked */
  grpc_connectivity_state_tracker state_tracker;

  /** the subchannel wrapped by the microchannel */
  grpc_connected_subchannel *connected_subchannel;

  /** the callback used to stay subscribed to subchannel connectivity
   * notifications */
  grpc_closure connectivity_cb;

  /** the current connectivity state of the wrapped subchannel */
  grpc_connectivity_state subchannel_connectivity;

  gpr_mu mu_state;
} channel_data;

typedef grpc_subchannel_call_holder call_data;

static void monitor_subchannel(grpc_exec_ctx *exec_ctx, void *arg,
                               bool iomgr_success) {
  channel_data *chand = arg;
  grpc_connectivity_state_set(exec_ctx, &chand->state_tracker,
                              chand->subchannel_connectivity,
                              "uchannel_monitor_subchannel");
  grpc_connected_subchannel_notify_on_state_change(
      exec_ctx, chand->connected_subchannel, NULL,
      &chand->subchannel_connectivity, &chand->connectivity_cb);
}

static char *cuc_get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) {
  return grpc_subchannel_call_holder_get_peer(exec_ctx, elem->call_data);
}

static void cuc_start_transport_stream_op(grpc_exec_ctx *exec_ctx,
                                          grpc_call_element *elem,
                                          grpc_transport_stream_op *op) {
  GRPC_CALL_LOG_OP(GPR_INFO, elem, op);
  grpc_subchannel_call_holder_perform_op(exec_ctx, elem->call_data, op);
}

static void cuc_start_transport_op(grpc_exec_ctx *exec_ctx,
                                   grpc_channel_element *elem,
                                   grpc_transport_op *op) {
  channel_data *chand = elem->channel_data;

  grpc_exec_ctx_enqueue(exec_ctx, op->on_consumed, true, NULL);

  GPR_ASSERT(op->set_accept_stream == NULL);
  GPR_ASSERT(op->bind_pollset == NULL);

  if (op->on_connectivity_state_change != NULL) {
    grpc_connectivity_state_notify_on_state_change(
        exec_ctx, &chand->state_tracker, op->connectivity_state,
        op->on_connectivity_state_change);
    op->on_connectivity_state_change = NULL;
    op->connectivity_state = NULL;
  }

  if (op->disconnect) {
    grpc_connectivity_state_set(exec_ctx, &chand->state_tracker,
                                GRPC_CHANNEL_FATAL_FAILURE, "disconnect");
  }
}

static int cuc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *arg,
                               grpc_metadata_batch *initial_metadata,
                               grpc_connected_subchannel **connected_subchannel,
                               grpc_closure *on_ready) {
  channel_data *chand = arg;
  GPR_ASSERT(initial_metadata != NULL);
  *connected_subchannel = chand->connected_subchannel;
  return 1;
}

/* Constructor for call_data */
static void cuc_init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
                               grpc_call_element_args *args) {
  grpc_subchannel_call_holder_init(elem->call_data, cuc_pick_subchannel,
                                   elem->channel_data, args->call_stack);
}

/* Destructor for call_data */
static void cuc_destroy_call_elem(grpc_exec_ctx *exec_ctx,
                                  grpc_call_element *elem) {
  grpc_subchannel_call_holder_destroy(exec_ctx, elem->call_data);
}

/* Constructor for channel_data */
static void cuc_init_channel_elem(grpc_exec_ctx *exec_ctx,
                                  grpc_channel_element *elem,
                                  grpc_channel_element_args *args) {
  channel_data *chand = elem->channel_data;
  memset(chand, 0, sizeof(*chand));
  grpc_closure_init(&chand->connectivity_cb, monitor_subchannel, chand);
  GPR_ASSERT(args->is_last);
  GPR_ASSERT(elem->filter == &grpc_client_uchannel_filter);
  chand->owning_stack = args->channel_stack;
  grpc_connectivity_state_init(&chand->state_tracker, GRPC_CHANNEL_IDLE,
                               "client_uchannel");
  gpr_mu_init(&chand->mu_state);
}

/* Destructor for channel_data */
static void cuc_destroy_channel_elem(grpc_exec_ctx *exec_ctx,
                                     grpc_channel_element *elem) {
  channel_data *chand = elem->channel_data;
  /* cancel subscription */
  grpc_connected_subchannel_notify_on_state_change(
      exec_ctx, chand->connected_subchannel, NULL, NULL,
      &chand->connectivity_cb);
  grpc_connectivity_state_destroy(exec_ctx, &chand->state_tracker);
  gpr_mu_destroy(&chand->mu_state);
  GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, chand->connected_subchannel,
                                  "uchannel");
}

static void cuc_set_pollset(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
                            grpc_pollset *pollset) {
  call_data *calld = elem->call_data;
  calld->pollset = pollset;
}

const grpc_channel_filter grpc_client_uchannel_filter = {
    cuc_start_transport_stream_op, cuc_start_transport_op, sizeof(call_data),
    cuc_init_call_elem, cuc_set_pollset, cuc_destroy_call_elem,
    sizeof(channel_data), cuc_init_channel_elem, cuc_destroy_channel_elem,
    cuc_get_peer, "client-uchannel",
};

grpc_connectivity_state grpc_client_uchannel_check_connectivity_state(
    grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, int try_to_connect) {
  channel_data *chand = elem->channel_data;
  grpc_connectivity_state out;
  gpr_mu_lock(&chand->mu_state);
  out = grpc_connectivity_state_check(&chand->state_tracker);
  gpr_mu_unlock(&chand->mu_state);
  return out;
}

void grpc_client_uchannel_watch_connectivity_state(
    grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, grpc_pollset *pollset,
    grpc_connectivity_state *state, grpc_closure *on_complete) {
  channel_data *chand = elem->channel_data;
  gpr_mu_lock(&chand->mu_state);
  grpc_connectivity_state_notify_on_state_change(
      exec_ctx, &chand->state_tracker, state, on_complete);
  gpr_mu_unlock(&chand->mu_state);
}

grpc_channel *grpc_client_uchannel_create(grpc_subchannel *subchannel,
                                          grpc_channel_args *args) {
  grpc_channel *channel = NULL;
#define MAX_FILTERS 3
  const grpc_channel_filter *filters[MAX_FILTERS];
  grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
  size_t n = 0;

  if (grpc_channel_args_is_census_enabled(args)) {
    filters[n++] = &grpc_client_census_filter;
  }
  filters[n++] = &grpc_compress_filter;
  filters[n++] = &grpc_client_uchannel_filter;
  GPR_ASSERT(n <= MAX_FILTERS);

  channel =
      grpc_channel_create_from_filters(&exec_ctx, NULL, filters, n, args, 1);

  return channel;
}

void grpc_client_uchannel_set_connected_subchannel(
    grpc_channel *uchannel, grpc_connected_subchannel *connected_subchannel) {
  grpc_channel_element *elem =
      grpc_channel_stack_last_element(grpc_channel_get_channel_stack(uchannel));
  channel_data *chand = elem->channel_data;
  GPR_ASSERT(elem->filter == &grpc_client_uchannel_filter);
  gpr_mu_lock(&chand->mu_state);
  chand->connected_subchannel = connected_subchannel;
  GRPC_CONNECTED_SUBCHANNEL_REF(connected_subchannel, "uchannel");
  gpr_mu_unlock(&chand->mu_state);
}


text:
package mse

//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

// ApplicationList is a nested struct in mse response
type ApplicationList struct {
	AppId           string      `json:"AppId" xml:"AppId"`
	LicenseKey      string      `json:"LicenseKey" xml:"LicenseKey"`
	RegionId        string      `json:"RegionId" xml:"RegionId"`
	Status          int64       `json:"Status" xml:"Status"`
	UserId          string      `json:"UserId" xml:"UserId"`
	Language        string      `json:"Language" xml:"Language"`
	RouteStatus     int64       `json:"RouteStatus" xml:"RouteStatus"`
	AppName         string      `json:"AppName" xml:"AppName"`
	InstancesNumber int         `json:"InstancesNumber" xml:"InstancesNumber"`
	Source          string      `json:"Source" xml:"Source"`
	ExtraInfo       string      `json:"ExtraInfo" xml:"ExtraInfo"`
	RouteRules      []RouteRule `json:"RouteRules" xml:"RouteRules"`
}


text:
using System;

public abstract class Provider : IProvider
{
    private const double InitialDurability = 1000d;
    private int id;
    private double durability;
    private double energyOutput;

    protected Provider(int id, double durabilityModifier, double energyOutput)
    {
        this.ID = id;
        this.Durability = InitialDurability+durabilityModifier;
        this.EnergyOutput = energyOutput;
    }

    public int ID {
        get { return this.id; }
        private set { this.id = value; }
    }
    public double Durability {
        get { return this.durability; }
        protected set { this.durability = value; }
    }
    public double EnergyOutput {
        get { return this.energyOutput; }
        protected set { this.energyOutput = value; }
    }

    public double Produce()
    {
        return this.EnergyOutput;
    }

    public void Broke()
    {
        this.Durability -= 100d;
        if (this.Durability < 0d)
        {
           throw new ArgumentException();
        }

    }

    public void Repair(double val)
    {
        this.Durability += val;
    }
}


text:
package build

import (
	"context"
	"reflect"
	"sync"

	"github.com/google/gapid/core/data/id"
	"github.com/google/gapid/core/event"
	"github.com/google/gapid/core/os/device"
	"github.com/google/gapid/test/robot/record"
	"github.com/google/gapid/test/robot/search"
	"github.com/google/gapid/test/robot/search/eval"
)

var packageClass = reflect.TypeOf(&Package{})

type packages struct {
	mu       sync.Mutex
	ledger   record.Ledger
	entries  []*Package
	byID     map[string]*Package
	byName   map[string]*Package
	onChange event.Broadcast
}

func (p *packages) init(ctx context.Context, library record.Library) error {
	ledger, err := library.Open(ctx, "packages", &Package{})
	if err != nil {
		return err
	}
	p.ledger = ledger
	p.byID = map[string]*Package{}
	apply := event.AsHandler(ctx, p.apply)
	if err := ledger.Read(ctx, apply); err != nil {
		return err
	}
	ledger.Watch(ctx, apply)
	return nil
}

// apply is called with items coming out of the ledger
// it should be called with the mutation lock already held.
func (p *packages) apply(ctx context.Context, pkg *Package) error {
	old := p.byID[pkg.Id]
	if old == nil {
		p.entries = append(p.entries, pkg)
		p.byID[pkg.Id] = pkg
		p.onChange.Send(ctx, pkg)
		return nil
	}
	if pkg.Parent != "" {
		old.Parent = pkg.Parent
	}
	if pkg.Information != nil {
		// description is the only thing we allow to be edited
		if pkg.Information.Description != "" {
			old.Information.Description = pkg.Information.Description
		}
	}
	if len(pkg.Artifact) > 0 {
		old.Artifact = append(old.Artifact, pkg.Artifact...)
	}
	for _, t := range pkg.Tool {
		old.mergeTool(ctx, t)
	}
	p.onChange.Send(ctx, pkg)
	return nil
}

func (p *packages) search(ctx context.Context, query *search.Query, handler PackageHandler) error {
	filter := eval.Filter(ctx, query, packageClass, event.AsHandler(ctx, handler))
	initial := event.AsProducer(ctx, p.entries)
	if query.Monitor {
		return event.Monitor(ctx, &p.mu, p.onChange.Listen, initial, filter)
	}
	return event.Feed(ctx, filter, initial)
}

func (p *packages) update(ctx context.Context, pkg *Package) error {
	p.mu.Lock()
	defer p.mu.Unlock()
	return p.ledger.Add(ctx, pkg)
}

func (p *packages) addArtifact(ctx context.Context, a *Artifact, info *Information) (*Package, bool, error) {
	p.mu.Lock()
	defer p.mu.Unlock()

	old := p.findArtifactPackage(ctx, a, info)
	pkg := &Package{
		Information: info,
		Artifact:    []string{a.Id},
		Tool:        a.Tool,
	}
	merged := false
	if old != nil {
		pkg.Id = old.Id
		merged = true
	} else {
		pkg.Id = id.Unique().String()
	}
	if err := p.ledger.Add(ctx, pkg); err != nil {
		return nil, false, err
	}
	return p.byID[pkg.Id], merged, nil
}

func (p *packages) findArtifactPackage(ctx context.Context, a *Artifact, info *Information) *Package {
	// Search for a set to merge into
	if info.Tag != "" {
		// if we have a tag, that's the only thing that matters
		for _, pkg := range p.entries {
			if pkg.Information.Tag == info.Tag {
				return pkg
			}
		}
	}
	// if we don't have a tag, local builds never merge
	if info.Type == Local {
		return nil
	}
	if info.Cl != "" {
		// non local builds with a matching cl can be merged
		for _, pkg := range p.entries {
			if pkg.Information.Cl == info.Cl {
				return pkg
			}
		}
	}
	// No match, cannot merge
	return nil
}

func (pkg *Package) mergeTool(ctx context.Context, tool *ToolSet) {
	for _, t := range pkg.Tool {
		if t.Abi.SameAs(tool.Abi) {
			// merge into existing tool
			if tool.Interceptor != "" {
				t.Interceptor = tool.Interceptor
			}
			if tool.Gapii != "" {
				t.Gapii = tool.Gapii
			}
			if tool.Gapir != "" {
				t.Gapir = tool.Gapir
			}
			if tool.Gapis != "" {
				t.Gapis = tool.Gapis
			}
			if tool.Gapit != "" {
				t.Gapit = tool.Gapit
			}
			return
		}
	}
	// no matching tool, so just append it
	pkg.Tool = append(pkg.Tool, tool)
}

// GetTools will return the toolset that match the abi, if there is one.
func (p *Package) GetTools(abi *device.ABI) *ToolSet {
	for _, t := range p.Tool {
		if t.Abi.SameAs(abi) {
			return t
		}
	}
	return nil
}


text:
echo "Deleting the build/ directory ..."
rm -rf build
pub build
surge -d which-film.info -p build/web


text:
FactoryBot.define do
  factory :meal_import, class: "Meals::Import" do
    transient do
      csv { "" }
    end

    community { Defaults.community }
    user

    after(:build) do |import, evaluator|
      import.file.attach(io: StringIO.new(evaluator.csv), filename: "input.csv") unless evaluator.csv.nil?
    end
  end
end


text:
var nopt = require('nopt'),
    Report = require('../report'),
    path = require('path'),
    fs = require('fs'),
    Collector = require('../collector'),
    inputError = require('../util/input-error'),
    formatOption = require('../util/help-formatter').formatOption,
    filesFor = require('../util/file-matcher').filesFor,
    util = require('util'),


text:
import _ from 'lodash';
import $ from 'jquery';
import d3 from 'd3';
import MapsConfigProvider from './lib/maps_config';
import TileMapChartProvider from './visualizations/tile_map';
import EventsProvider from 'ui/events';
import MapsDataProvider from './lib/data';
import LayoutProvider from './lib/layout';
import './styles/_tilemap.less';

export default function MapsFactory(Private) {
  const Events = Private(EventsProvider);
  const MapsConfig = Private(MapsConfigProvider);
  const TileMapChart = Private(TileMapChartProvider);
  const Data = Private(MapsDataProvider);
  const Layout = Private(LayoutProvider);

  class Maps extends Events {
    constructor($el, vis, mapsConfigArgs) {
      super(arguments);
      this.el = $el.get ? $el.get(0) : $el;
      this.vis = vis;
      this.mapsConfigArgs = mapsConfigArgs;

      // memoize so that the same function is returned every time,
      // allowing us to remove/re-add the same function
      this.getProxyHandler = _.memoize(function (event) {
        const self = this;
        return function (e) {
          self.emit(event, e);
        };
      });

      this.enable = this.chartEventProxyToggle('on');
      this.disable = this.chartEventProxyToggle('off');
    }

    chartEventProxyToggle(method) {
      return function (event, chart) {
        const proxyHandler = this.getProxyHandler(event);

        _.each(chart ? [chart] : this.charts, function (chart) {
          chart.events[method](event, proxyHandler);
        });
      };
    }

    on(event, listener) {
      const first = this.listenerCount(event) === 0;
      const ret = Events.prototype.on.call(this, event, listener);
      const added = this.listenerCount(event) > 0;

      // if this is the first listener added for the event
      // enable the event in the handler
      if (first && added && this.handler) this.handler.enable(event);

      return ret;
    }

    off(event, listener) {
      const last = this.listenerCount(event) === 1;
      const ret = Events.prototype.off.call(this, event, listener);
      const removed = this.listenerCount(event) === 0;

      // Once all listeners are removed, disable the events in the handler
      if (last && removed && this.handler) this.handler.disable(event);
      return ret;
    }

    render(data, uiState) {
      if (!data) {
        throw new Error('No valid data!');
      }

      this.uiState = uiState;
      this.data = new Data(data, this.uiState);
      this.visConfig = new MapsConfig(this.mapsConfigArgs, this.data, this.uiState);
      this.layout = new Layout(this.el, this.visConfig, this.data);
      this.draw();
    }

    destroy() {
      this.charts.forEach(chart => chart.destroy());
      d3.select(this.el).selectAll('*').remove();
    }

    draw() {
      // Destroy the charts before they get removed from the DOM on the new
      // layout render.
      if(this.charts !== undefined) {
        this.charts.forEach(chart => chart.destroy());
      }

      this.layout.render();
      const self = this;
      this.charts = [];

      let loadedCount = 0;
      const chartSelection = d3.select(this.el).selectAll('.chart');
      chartSelection.each(function (chartData) {
        const chart = new TileMapChart(self, this, chartData);

        self.activeEvents().forEach(function (event) {
          self.enable(event, chart);
        });

        self.charts.push(chart);
        chart.render();

        chart.events.on('rendered', function () {
          loadedCount++;
          if (loadedCount === chartSelection.length) {
            $(self.el).trigger('renderComplete');
          }
        });
      });
    }

  }

  return Maps;
}


text:
import adapterManager from 'src/adapterManager.js';
import analyticsAdapter, { command as analyticsCommand, COMMAND } from 'modules/adlooxAnalyticsAdapter.js';
import { AUCTION_COMPLETED } from 'src/auction.js';
import { expect } from 'chai';
import events from 'src/events.js';
import { EVENTS } from 'src/constants.json';
import * as utils from 'src/utils.js';
import { loadExternalScriptStub } from 'test/mocks/adloaderStub.js';

const analyticsAdapterName = 'adloox';

describe('Adloox Analytics Adapter', function () {
  let sandbox;

  const esplode = 'esplode';

  const bid = {
    bidder: 'dummy',
    adUnitCode: 'ad-slot-1',
    mediaType: 'display'
  };

  const auctionDetails = {
    auctionStatus: AUCTION_COMPLETED,
    bidsReceived: [
      bid
    ]
  };

  const analyticsOptions = {
    js: 'https://j.adlooxtracking.com/ads/js/tfav_adl_%%clientid%%.js',
    client: 'adlooxtest',
    clientid: 127,
    platformid: 0,
    tagid: 0,
    params: {
      dummy1: '%%client%%',
      dummy2: '%%pbAdSlot%%',
      dummy3: function(bid) { throw new Error(esplode) }
    }
  };

  adapterManager.registerAnalyticsAdapter({
    code: analyticsAdapterName,
    adapter: analyticsAdapter
  });
  describe('enableAnalytics', function () {
    describe('invalid options', function () {
      it('should require options', function (done) {
        adapterManager.enableAnalytics({
          provider: analyticsAdapterName
        });
        expect(analyticsAdapter.context).is.null;

        done();
      });

      it('should reject non-string options.js', function (done) {
        const analyticsOptionsLocal = utils.deepClone(analyticsOptions);
        analyticsOptionsLocal.js = function () { };

        adapterManager.enableAnalytics({
          provider: analyticsAdapterName,
          options: analyticsOptionsLocal
        });
        expect(analyticsAdapter.context).is.null;

        done();
      });

      it('should reject non-function options.toselector', function (done) {
        const analyticsOptionsLocal = utils.deepClone(analyticsOptions);
        analyticsOptionsLocal.toselector = esplode;

        adapterManager.enableAnalytics({
          provider: analyticsAdapterName,
          options: analyticsOptionsLocal
        });
        expect(analyticsAdapter.context).is.null;

        done();
      });

      [ 'client', 'clientid', 'platformid', 'tagid' ].forEach(function (o) {
        it('should require options.' + o, function (done) {
          const analyticsOptionsLocal = utils.deepClone(analyticsOptions);
          delete analyticsOptionsLocal[o];

          adapterManager.enableAnalytics({
            provider: analyticsAdapterName,
            options: analyticsOptionsLocal
          });
          expect(analyticsAdapter.context).is.null;

          done();
        });
      });

      it('should reject non-object options.params', function (done) {
        const analyticsOptionsLocal = utils.deepClone(analyticsOptions);
        analyticsOptionsLocal.params = esplode;

        adapterManager.enableAnalytics({
          provider: analyticsAdapterName,
          options: analyticsOptionsLocal
        });
        expect(analyticsAdapter.context).is.null;

        done();
      });
    });
  });

  describe('process', function () {
    beforeEach(function() {
      sandbox = sinon.sandbox.create();

      sandbox.stub(events, 'getEvents').returns([]);

      adapterManager.enableAnalytics({
        provider: analyticsAdapterName,
        options: utils.deepClone(analyticsOptions)
      });

      expect(analyticsAdapter.context).is.not.null;
    });

    afterEach(function () {
      analyticsAdapter.disableAnalytics();
      expect(analyticsAdapter.context).is.null;

      sandbox.restore();
      sandbox = undefined;
    });

    describe('event', function () {
      it('should preload the script on AUCTION_END only once', function (done) {
        const insertElementStub = sandbox.stub(utils, 'insertElement');

        const uri = utils.parseUrl(analyticsAdapter.url(analyticsOptions.js));
        const isLinkPreloadAsScript = function(arg) {
          const href_uri = utils.parseUrl(arg.href);	// IE11 requires normalisation (hostname always includes port)
          return arg.tagName === 'LINK' && arg.getAttribute('rel') === 'preload' && arg.getAttribute('as') === 'script' && href_uri.href === uri.href;
        };

        events.emit(EVENTS.AUCTION_END, auctionDetails);
        expect(insertElementStub.calledWith(sinon.match(isLinkPreloadAsScript))).to.true;

        events.emit(EVENTS.AUCTION_END, auctionDetails);
        expect(insertElementStub.callCount).to.equal(1);

        done();
      });

      it('should inject verification JS on BID_WON', function (done) {
        const url = analyticsAdapter.url(`${analyticsOptions.js}#`);

        const parent = document.createElement('div');

        const slot = document.createElement('div');
        slot.id = bid.adUnitCode;
        parent.appendChild(slot);

        const dummy = document.createElement('div');
        parent.appendChild(dummy);

        const querySelectorStub = sandbox.stub(document, 'querySelector');
        querySelectorStub.withArgs(`#${bid.adUnitCode}`).returns(slot);

        events.emit(EVENTS.BID_WON, bid);

        const [urlInserted, moduleCode] = loadExternalScriptStub.getCall(0).args;

        expect(urlInserted.substr(0, url.length)).to.equal(url);
        expect(moduleCode).to.equal(analyticsAdapterName);
        expect(/[#&]creatype=2(&|$)/.test(urlInserted)).is.true; // prebid 'display' -> adloox '2'
        expect(new RegExp('[#&]dummy3=' + encodeURIComponent('ERROR: ' + esplode) + '(&|$)').test(urlInserted)).is.true;

        done();
      });
    });

    describe('command', function () {
      it('should return config', function (done) {
        const expected = utils.deepClone(analyticsOptions);
        delete expected.js;
        delete expected.toselector;
        delete expected.params;

        analyticsCommand(COMMAND.CONFIG, null, function (response) {
          expect(utils.deepEqual(response, expected)).is.true;

          done();
        });
      });

      it('should return expanded URL', function (done) {
        const data = {
          url: 'https://example.com?',
          args: [
            [ 'client', '%%client%%' ]
          ],
          bid: bid,
          ids: true
        };
        const expected = `${data.url}${data.args[0][0]}=${analyticsOptions.client}`;

        analyticsCommand(COMMAND.URL, data, function (response) {
          expect(response.substr(0, expected.length)).is.equal(expected);

          done();
        });
      });

      it('should inject tracking event', function (done) {
        const data = {
          eventType: EVENTS.BID_WON,
          args: bid
        };

        analyticsCommand(COMMAND.TRACK, data, function (response) {
          expect(response).is.undefined;

          done();
        });
      });
    });
  });
});


text:
package org.openstack.atlas.common.ip.exception;

public class IPBlocksOverLapException extends IPStringException {

    public IPBlocksOverLapException() {
    }

    public IPBlocksOverLapException(String msg) {
        super(msg);
    }
}


text:
package com.intellij.openapi.fileEditor.impl.text;

import com.intellij.codeHighlighting.BackgroundEditorHighlighter;
import com.intellij.ide.structureView.StructureViewBuilder;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.editor.highlighter.EditorHighlighter;
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory;
import com.intellij.openapi.fileEditor.*;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.pom.Navigatable;
import consulo.disposer.Disposer;
import consulo.fileEditor.impl.text.TextEditorComponentContainerFactory;
import consulo.ui.Component;
import consulo.ui.annotation.RequiredUIAccess;
import consulo.util.dataholder.UserDataHolderBase;
import kava.beans.PropertyChangeListener;
import kava.beans.PropertyChangeSupport;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.swing.*;

/**
 * @author Vladimir Kondratyev
 */
public class TextEditorImpl extends UserDataHolderBase implements TextEditor {
  public final Project myProject;

  private final PropertyChangeSupport myChangeSupport;
  @Nonnull
  private final TextEditorComponent myComponent;

  @Nonnull
  public final VirtualFile myFile;

  private final AsyncEditorLoader myAsyncLoader;

  protected final TextEditorComponentContainerFactory myTextEditorComponentContainerFactory;

  @RequiredUIAccess
  public TextEditorImpl(@Nonnull final Project project, @Nonnull final VirtualFile file, final TextEditorProviderImpl provider) {
    myProject = project;
    myFile = file;
    myChangeSupport = new PropertyChangeSupport(this);
    myTextEditorComponentContainerFactory = provider.myTextEditorComponentContainerFactory;
    myComponent = createEditorComponent(project, file);
    Disposer.register(this, myComponent);

    myAsyncLoader = new AsyncEditorLoader(this, myComponent, provider);
    myAsyncLoader.start();
  }

  @Nonnull
  public Runnable loadEditorInBackground() {
    EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
    EditorHighlighter highlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter(myFile, scheme, myProject);
    EditorEx editor = (EditorEx)getEditor();
    highlighter.setText(editor.getDocument().getImmutableCharSequence());
    return () -> editor.setHighlighter(highlighter);
  }

  @Nonnull
  protected TextEditorComponent createEditorComponent(final Project project, final VirtualFile file) {
    return new TextEditorComponent(project, file, this, myTextEditorComponentContainerFactory);
  }

  @Override
  public void dispose() {
  }

  @Override
  @Nonnull
  public JComponent getComponent() {
    return myComponent.getComponentContainer().getComponent();
  }

  @Nullable
  @Override
  public Component getUIComponent() {
    return myComponent.getComponentContainer().getUIComponent();
  }

  @Nullable
  @Override
  public Component getPreferredFocusedUIComponent() {
    return getUIComponent();
  }

  @Override
  @Nonnull
  public JComponent getPreferredFocusedComponent() {
    return getActiveEditor().getContentComponent();
  }

  @Override
  @Nonnull
  public Editor getEditor() {
    return getActiveEditor();
  }

  /**
   * @see DesktopTextEditorComponent#getEditor()
   */
  @Nonnull
  private Editor getActiveEditor() {
    return myComponent.getEditor();
  }

  @Override
  @Nonnull
  public String getName() {
    return "Text";
  }

  @Override
  @Nonnull
  public FileEditorState getState(@Nonnull FileEditorStateLevel level) {
    return myAsyncLoader.getEditorState(level);
  }

  @Override
  public void setState(@Nonnull final FileEditorState state) {
    myAsyncLoader.setEditorState((TextEditorState)state, true);
  }

  @Override
  public boolean isModified() {
    return myComponent.isModified();
  }

  @Override
  public boolean isValid() {
    return myComponent.isEditorValid();
  }

  @Override
  public void selectNotify() {
    myComponent.selectNotify();
  }

  @Override
  public void deselectNotify() {
  }

  public void updateModifiedProperty() {
    myComponent.updateModifiedProperty();
  }

  public void firePropertyChange(final String propertyName, final Object oldValue, final Object newValue) {
    myChangeSupport.firePropertyChange(propertyName, oldValue, newValue);
  }

  @Override
  public void addPropertyChangeListener(@Nonnull final PropertyChangeListener listener) {
    myChangeSupport.addPropertyChangeListener(listener);
  }

  @Override
  public void removePropertyChangeListener(@Nonnull final PropertyChangeListener listener) {
    myChangeSupport.removePropertyChangeListener(listener);
  }

  @Override
  public BackgroundEditorHighlighter getBackgroundHighlighter() {
    return null;
  }

  @Override
  public FileEditorLocation getCurrentLocation() {
    return new TextEditorLocation(getEditor().getCaretModel().getLogicalPosition(), this);
  }

  @Override
  public StructureViewBuilder getStructureViewBuilder() {
    Document document = myComponent.getEditor().getDocument();
    VirtualFile file = FileDocumentManager.getInstance().getFile(document);
    if (file == null || !file.isValid()) return null;
    return StructureViewBuilder.PROVIDER.getStructureViewBuilder(file.getFileType(), file, myProject);
  }

  @Nullable
  @Override
  public VirtualFile getFile() {
    return FileDocumentManager.getInstance().getFile(myComponent.getEditor().getDocument());
  }

  @Override
  public boolean canNavigateTo(@Nonnull final Navigatable navigatable) {
    return navigatable instanceof OpenFileDescriptor && (((OpenFileDescriptor)navigatable).getLine() != -1 || ((OpenFileDescriptor)navigatable).getOffset() >= 0);
  }

  @Override
  public void navigateTo(@Nonnull final Navigatable navigatable) {
    ((OpenFileDescriptor)navigatable).navigateIn(getEditor());
  }

  @Override
  public String toString() {
    return "Editor: " + myComponent.getFile();
  }
}


text:
package net.bytebuddy.implementation.bind.annotation;

import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.description.type.TypeList;
import net.bytebuddy.implementation.Implementation;
import net.bytebuddy.implementation.bind.MethodDelegationBinder;
import net.bytebuddy.implementation.bytecode.assign.Assigner;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.*;

public class MorphBinderTest extends AbstractAnnotationBinderTest<Morph> {

    @Mock
    private MethodDescription morphMethod;

    @Mock
    private MethodDescription.SignatureToken morphToken;

    @Mock
    private TypeDescription morphType, defaultType;

    @Mock
    private TypeDescription.Generic genericMorphType;

    @Mock
    private MethodDescription.SignatureToken sourceToken;

    @Mock
    private Implementation.SpecialMethodInvocation specialMethodInvocation;

    public MorphBinderTest() {
        super(Morph.class);
    }

    @Override
    protected TargetMethodAnnotationDrivenBinder.ParameterBinder<Morph> getSimpleBinder() {
        return new Morph.Binder(morphMethod);
    }

    @Override
    @Before
    public void setUp() throws Exception {
        super.setUp();
        when(genericMorphType.asErasure()).thenReturn(morphType);
        when(defaultType.asErasure()).thenReturn(defaultType);
        when(source.asSignatureToken()).thenReturn(sourceToken);
    }

    @Test(expected = IllegalStateException.class)
    public void testIllegalType() throws Exception {
        when(target.getType()).thenReturn(genericMorphType);
        when(morphMethod.getDeclaringType()).thenReturn(mock(TypeDescription.class));
        new Morph.Binder(morphMethod).bind(annotationDescription, source, target, implementationTarget, assigner, Assigner.Typing.STATIC);
    }

    @Test
    public void testSuperMethodCallInvalid() throws Exception {
        when(target.getType()).thenReturn(genericMorphType);
        when(morphMethod.getDeclaringType()).thenReturn(morphType);
        doReturn(void.class).when(annotation).defaultTarget();
        when(implementationTarget.invokeSuper(sourceToken)).thenReturn(specialMethodInvocation);
        MethodDelegationBinder.ParameterBinding<?> parameterBinding = new Morph.Binder(morphMethod)
                .bind(annotationDescription, source, target, implementationTarget, assigner, Assigner.Typing.STATIC);
        assertThat(parameterBinding.isValid(), is(false));
        verify(specialMethodInvocation).isValid();
    }

    @Test
    public void testSuperMethodCallValid() throws Exception {
        when(target.getType()).thenReturn(genericMorphType);
        when(morphMethod.getDeclaringType()).thenReturn(morphType);
        doReturn(void.class).when(annotation).defaultTarget();
        when(implementationTarget.invokeSuper(sourceToken)).thenReturn(specialMethodInvocation);
        when(specialMethodInvocation.isValid()).thenReturn(true);
        MethodDelegationBinder.ParameterBinding<?> parameterBinding = new Morph.Binder(morphMethod)
                .bind(annotationDescription, source, target, implementationTarget, assigner, Assigner.Typing.STATIC);
        assertThat(parameterBinding.isValid(), is(true));
        verify(specialMethodInvocation).isValid();
    }

    @Test
    public void testDefaultMethodCallImplicitInvalid() throws Exception {
        when(source.asSignatureToken()).thenReturn(morphToken);
        when(target.getType()).thenReturn(genericMorphType);
        when(morphMethod.getDeclaringType()).thenReturn(morphType);
        when(annotation.defaultMethod()).thenReturn(true);
        doReturn(void.class).when(annotation).defaultTarget();
        when(implementationTarget.invokeDefault(morphToken)).thenReturn(specialMethodInvocation);
        MethodDelegationBinder.ParameterBinding<?> parameterBinding = new Morph.Binder(morphMethod)
                .bind(annotationDescription, source, target, implementationTarget, assigner, Assigner.Typing.STATIC);
        assertThat(parameterBinding.isValid(), is(false));
        verify(specialMethodInvocation).isValid();
    }

    @Test
    public void testDefaultMethodCallImplicitValid() throws Exception {
        when(source.asSignatureToken()).thenReturn(morphToken);
        when(target.getType()).thenReturn(genericMorphType);
        when(morphMethod.getDeclaringType()).thenReturn(morphType);
        when(annotation.defaultMethod()).thenReturn(true);
        doReturn(void.class).when(annotation).defaultTarget();
        when(implementationTarget.invokeDefault(morphToken)).thenReturn(specialMethodInvocation);
        when(specialMethodInvocation.isValid()).thenReturn(true);
        MethodDelegationBinder.ParameterBinding<?> parameterBinding = new Morph.Binder(morphMethod)
                .bind(annotationDescription, source, target, implementationTarget, assigner, Assigner.Typing.STATIC);
        assertThat(parameterBinding.isValid(), is(true));
        verify(specialMethodInvocation).isValid();
    }

    @Test
    public void testDefaultMethodCallExplicitInvalid() throws Exception {
        when(source.asSignatureToken()).thenReturn(morphToken);
        when(instrumentedType.getInterfaces()).thenReturn(new TypeList.Generic.ForLoadedTypes(Foo.class));
        when(target.getType()).thenReturn(genericMorphType);
        when(morphMethod.getDeclaringType()).thenReturn(morphType);
        when(annotation.defaultMethod()).thenReturn(true);
        doReturn(Foo.class).when(annotation).defaultTarget();
        when(implementationTarget.invokeDefault(morphToken, TypeDescription.ForLoadedType.of(Foo.class)))
                .thenReturn(specialMethodInvocation);
        MethodDelegationBinder.ParameterBinding<?> parameterBinding = new Morph.Binder(morphMethod)
                .bind(annotationDescription, source, target, implementationTarget, assigner, Assigner.Typing.STATIC);
        assertThat(parameterBinding.isValid(), is(false));
        verify(specialMethodInvocation).isValid();
    }

    @Test
    public void testDefaultMethodCallExplicitValid() throws Exception {
        when(source.asSignatureToken()).thenReturn(morphToken);
        when(instrumentedType.getInterfaces()).thenReturn(new TypeList.Generic.ForLoadedTypes(Foo.class));
        when(target.getType()).thenReturn(genericMorphType);
        when(morphMethod.getDeclaringType()).thenReturn(morphType);
        when(annotation.defaultMethod()).thenReturn(true);
        doReturn(Foo.class).when(annotation).defaultTarget();
        when(implementationTarget.invokeDefault(morphToken, TypeDescription.ForLoadedType.of(Foo.class)))
                .thenReturn(specialMethodInvocation);
        when(specialMethodInvocation.isValid()).thenReturn(true);
        MethodDelegationBinder.ParameterBinding<?> parameterBinding = new Morph.Binder(morphMethod)
                .bind(annotationDescription, source, target, implementationTarget, assigner, Assigner.Typing.STATIC);
        assertThat(parameterBinding.isValid(), is(true));
        verify(specialMethodInvocation).isValid();
    }

    private interface Foo {
        /* empty */
    }
}


text:
import { IRoute } from '../../core/interfaces/IFeature';
export declare const routes: IRoute[];


text:
package filodb.memory.format

import scala.io

import vectors._

class RealTimeseriesEncodingTest extends NativeVectorTest {
  val samples = io.Source.fromURL(getClass.getResource("/timeseries_samples.txt"))
                  .getLines.map(_.split(' '))
                  .map(ArrayStringRowReader).toSeq
  val timestampAppender = LongBinaryVector.appendingVectorNoNA(memFactory, samples.length)
  val valuesAppender = DoubleVector.appendingVectorNoNA(memFactory, samples.length)
  samples.foreach { reader =>
    timestampAppender.addData(reader.getLong(0))
    valuesAppender.addData(reader.getDouble(1))
  }

  // should compress into ~2 bytes per sample, give a little bit of slack
  val TargetBytesPerSample = 3.2

  it("should encode real timeseries efficiently") {
    timestampAppender.length shouldEqual samples.length
    valuesAppender.length shouldEqual samples.length

    val timestampPtr = timestampAppender.optimize(memFactory)
    val valuesPtr = valuesAppender.optimize(memFactory)

    // Both the timestamp and values are strictly increasing (though not exactly equally).
    // Both should be encoded into DeltaDelta vectors into less integer bits to save space

    val targetNumBytes = samples.length * TargetBytesPerSample
    println(s"${samples.length} samples, target encoded size = $targetNumBytes bytes")

    val timestampBytes = BinaryVector.totalBytes(timestampPtr)
    val valuesBytes    = BinaryVector.totalBytes(valuesPtr)

    println(s"timestamp bytes = $timestampBytes, values bytes = $valuesBytes")
    println(s"ts reader = ${LongBinaryVector(timestampPtr)}  values reader = ${DoubleVector(valuesPtr)}")

    (timestampBytes + valuesBytes).toDouble should be < (targetNumBytes)
  }
}


text:
    <button class="slot <% if (upgradeSlot.equipped) { %>equipped<% } else { %>unequipped<% } %>"
        open-card-preview="<%= upgradeSlot.upgrade.id %>"
        <% if (upgradeSlot.equipped) { %>
            preview-button="unequip"
        <% } else { %>
            preview-button="equip"
        <% } %>
        >
        <%= iconString %>
        <%= (upgradeSlot.upgrade.dualCardName || upgradeSlot.upgrade.name) %>
        zoom_in
    </button>


text:
package data.filters.automatas;

public class AlphabiteRecognizer implements IAutomata
{
    private IAlphabite alphabite;
    private int state;

    public AlphabiteRecognizer(IAlphabite alphabite)
    {
        this.alphabite = alphabite;
        moveToStart();
    }

    @Override
    public boolean isAcceptState()
    {
        return state == 1;
    }

    @Override
    public void move(char symbol)
    {
        state = alphabite.contains(symbol) ? 1 : 0;
    }

    @Override
    public void moveToStart()
    {
        state = 0;
    }
}


text:
package gcworker

import (
	"testing"
	"time"

	"github.com/pingcap/tidb/testkit/testmain"
	"github.com/pingcap/tidb/testkit/testsetup"
	"github.com/tikv/client-go/v2/tikv"
	"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
	testsetup.SetupForCommonTest()
	tikv.EnableFailpoints()
	opts := []goleak.Option{
		goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"),
		goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"),
		goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"),
		goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"),
	}
	callback := func(i int) int {
		// wait for MVCCLevelDB to close, MVCCLevelDB will be closed in one second
		time.Sleep(time.Second)
		return i
	}
	goleak.VerifyTestMain(testmain.WrapTestingM(m, callback), opts...)
}