text:
<?php

use backend\custom\grid\BGridView;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\searches\AuthAssignmentSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '权限用户';
$this->params['breadcrumbs'][] = $this->title;
?>

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

数据展示

            <?= BGridView::widget([
                'dataProvider' => $dataProvider,
                //        'filterModel' => $searchModel,
                'columns' => [
                    //        ['class' => 'yii\grid\SerialColumn'],
                    [
                        'label' => '真实姓名',
                        'value' => function ($model) {
                            return $model->userProfile->realname;
                        }
                    ],
                    'username',
                    'email:email',
                    'mobile',
                    [
                        'class' => 'backend\custom\grid\BActionColumn',
                        'template' => '{view}{route}',
                        'buttons' => [
                            'route' => function(){

                            }
                        ]
                    ],
                ],
            ]); ?>


text:
package com.google.cloud.dataflow.sdk.util.common.worker;

import java.io.IOException;
import java.util.List;

import javax.annotation.Nullable;

/**
 * ShuffleBatchReader provides an interface for reading a batch of
 * key/value entries from a shuffle dataset.
 */
public interface ShuffleBatchReader {
  /** The result returned by #read. */
  public static class Batch {
    public final List<ShuffleEntry> entries;
    @Nullable public final ShufflePosition nextStartPosition;

    public Batch(List<ShuffleEntry> entries,
                 @Nullable ShufflePosition nextStartPosition) {
      this.entries = entries;
      this.nextStartPosition = nextStartPosition;
    }
  }

  /**
   * Reads a batch of data from a shuffle dataset.
   *
   * @param startPosition encodes the initial key from where to read.
   * This parameter may be null, indicating that the read should start
   * with the first key in the dataset.
   *
   * @param endPosition encodes the key "just past" the end of the
   * range to be read; keys up to endPosition will be returned, but
   * keys equal to or greater than endPosition will not.  This
   * parameter may be null, indicating that the read should end just
   * past the last key in the dataset (that is, the last key in the
   * dataset will be included in the read, as long as that key is
   * greater than or equal to startPosition).
   *
   * @return the first {@link Batch} of entries
   */
  public Batch read(@Nullable ShufflePosition startPosition,
                    @Nullable ShufflePosition endPosition)
      throws IOException;
}

redpajama_set_name: RedPajamaGithub


text:
import React from 'react'
import { Iconfont } from 'components'
import { Table, Row, Col, Icon } from 'antd'
import styles from './index.less'
import './emoji.js'

const colorfulIcons = ['boluo', 'baixiangguo', 'chengzi', 'boluomei', 'caomei', 'dayouzi', 'chelizi', 'fanqie', 'hamigua', 'ganlan',
  'juzi', 'heimei', 'huolongguo', 'hongmei', 'lizi', 'lanmei', 'mangguo', 'mihoutao', 'longyan', 'mugua', 'lizi1', 'ningmeng']

const flatIcons = ['home', 'user', 'timelimit', 'shopcart', 'message', 'remind', 'service', 'shop', 'sweep', 'express',
  'payment', 'search', 'feedback', 'pencil', 'setting', 'refund', 'delete', 'star', 'heart', 'share', 'location', 'console']

const localSVGIcons = ['vomiting', 'smirking', 'surprised', 'unamused', 'zombie', 'tired', 'tongue', 'wink']

const localRequireSVGIcons = [
  require('../../../../svg/cute/congratulations.svg'),
  require('../../../../svg/cute/cry.svg'),
  require('../../../../svg/cute/kiss.svg'),
  require('../../../../svg/cute/leisurely.svg'),
  require('../../../../svg/cute/notice.svg'),
  require('../../../../svg/cute/proud.svg'),
  require('../../../../svg/cute/shy.svg'),
  require('../../../../svg/cute/sweat.svg'),
  require('../../../../svg/cute/think.svg'),
]

const IcoPage = () =>

  <Icon type="star-oo" />

Colorful Icon

    {colorfulIcons.map(item =>

      <Iconfont className={styles.icon} colorful type={item} />
      {item}

)}

Flat Icon

    {flatIcons.map(item =>

      <Iconfont className={styles.icon} type={item} />
      {item}

)}

Local SVG

    {localSVGIcons.map(item =>

      <Iconfont className={styles.icon} colorful type={item} />
      {item}

)}

Local Require SVG

    {localRequireSVGIcons.map(item =>

      <Iconfont className={styles.icon} colorful type={item} />
      {item}

)}

API

  <Row>
    <Col lg={18} md={24}>

 key}
        pagination={false}
        bordered
        scroll={{ x: 800 }}
        columns={[
          {
            title: 'Property',
            dataIndex: 'props',
          },
          {
            title: 'Description',
            dataIndex: 'desciption',
          },
          {
            title: 'Type',
            dataIndex: 'type',
          },
          {
            title: 'Default',
            dataIndex: 'default',
          },
        ]}
        dataSource={[
          {
            props: 'type',
            desciption: 'icon type',
            type: 'String',
            default: '-',
          },
          {
            props: 'colorful',
            desciption: "to set the SVG has 'symbol element'",
            type: 'Bool',
            default: 'false',
          }]}
      />
    </Col>
  </Row>

Thanks

      何阿酥 colorful fruit icon
       http://www.iconfont.cn/collections/detail?cid=4014

      ColinXu colorful 'tsundere' emoji icon
       http://www.iconfont.cn/collections/detail?cid=4116

      咕噜小莫莫 colorful 'face cute' emoji icon
       http://www.iconfont.cn/collections/detail?cid=4268

export default IcoPage


text:
package org.apache.hadoop.yarn.server.router.webapp;

import java.io.IOException;
import java.security.PrivilegedExceptionAction;
import java.util.Map;

import javax.ws.rs.core.Response;

import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ActivitiesInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppActivitiesInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppAttemptsInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppPriority;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppQueue;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppState;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppTimeoutInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppTimeoutsInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ApplicationStatisticsInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppsInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterMetricsInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.LabelsToNodesInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeLabelsInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeToLabelsInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodesInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.SchedulerTypeInfo;
import org.apache.hadoop.yarn.server.router.webapp.RouterWebServices.RequestInterceptorChainWrapper;
import org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfo;
import org.apache.hadoop.yarn.server.webapp.dao.ContainerInfo;
import org.apache.hadoop.yarn.server.webapp.dao.ContainersInfo;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Test class to validate the WebService interceptor model inside the Router.
 */
public class TestRouterWebServices extends BaseRouterWebServicesTest {

  private static final Logger LOG =
      LoggerFactory.getLogger(TestRouterWebServices.class);

  private String user = "test1";

  /**
   * Test that all requests get forwarded to the last interceptor in the chain
   * get back the responses.
   */
  @Test
  public void testRouterWebServicesE2E() throws Exception {

    ClusterInfo clusterInfo = get(user);
    Assert.assertNotNull(clusterInfo);

    ClusterInfo clusterInfo2 = getClusterInfo(user);
    Assert.assertNotNull(clusterInfo2);

    ClusterMetricsInfo clusterMetricsInfo = getClusterMetricsInfo(user);
    Assert.assertNotNull(clusterMetricsInfo);

    SchedulerTypeInfo schedulerTypeInfo = getSchedulerInfo(user);
    Assert.assertNotNull(schedulerTypeInfo);

    String dumpResult = dumpSchedulerLogs(user);
    Assert.assertNotNull(dumpResult);

    NodesInfo nodesInfo = getNodes(user);
    Assert.assertNotNull(nodesInfo);

    NodeInfo nodeInfo = getNode(user);
    Assert.assertNotNull(nodeInfo);

    AppsInfo appsInfo = getApps(user);
    Assert.assertNotNull(appsInfo);

    ActivitiesInfo activitiesInfo = getActivities(user);
    Assert.assertNotNull(activitiesInfo);

    AppActivitiesInfo appActiviesInfo = getAppActivities(user);
    Assert.assertNotNull(appActiviesInfo);

    ApplicationStatisticsInfo applicationStatisticsInfo =
        getAppStatistics(user);
    Assert.assertNotNull(applicationStatisticsInfo);

    AppInfo appInfo = getApp(user);
    Assert.assertNotNull(appInfo);

    AppState appState = getAppState(user);
    Assert.assertNotNull(appState);

    Response response = updateAppState(user);
    Assert.assertNotNull(response);

    NodeToLabelsInfo nodeToLabelsInfo = getNodeToLabels(user);
    Assert.assertNotNull(nodeToLabelsInfo);

    LabelsToNodesInfo labelsToNodesInfo = getLabelsToNodes(user);
    Assert.assertNotNull(labelsToNodesInfo);

    Response response2 = replaceLabelsOnNodes(user);
    Assert.assertNotNull(response2);

    Response response3 = replaceLabelsOnNode(user);
    Assert.assertNotNull(response3);

    NodeLabelsInfo nodeLabelsInfo = getClusterNodeLabels(user);
    Assert.assertNotNull(nodeLabelsInfo);

    Response response4 = addToClusterNodeLabels(user);
    Assert.assertNotNull(response4);

    Response response5 = removeFromCluserNodeLabels(user);
    Assert.assertNotNull(response5);

    NodeLabelsInfo nodeLabelsInfo2 = getLabelsOnNode(user);
    Assert.assertNotNull(nodeLabelsInfo2);

    AppPriority appPriority = getAppPriority(user);
    Assert.assertNotNull(appPriority);

    Response response6 = updateApplicationPriority(user);
    Assert.assertNotNull(response6);

    AppQueue appQueue = getAppQueue(user);
    Assert.assertNotNull(appQueue);

    Response response7 = updateAppQueue(user);
    Assert.assertNotNull(response7);

    Response response8 = createNewApplication(user);
    Assert.assertNotNull(response8);

    Response response9 = submitApplication(user);
    Assert.assertNotNull(response9);

    Response response10 = postDelegationToken(user);
    Assert.assertNotNull(response10);

    Response response11 = postDelegationTokenExpiration(user);
    Assert.assertNotNull(response11);

    Response response12 = cancelDelegationToken(user);
    Assert.assertNotNull(response12);

    Response response13 = createNewReservation(user);
    Assert.assertNotNull(response13);

    Response response14 = submitReservation(user);
    Assert.assertNotNull(response14);

    Response response15 = updateReservation(user);
    Assert.assertNotNull(response15);

    Response response16 = deleteReservation(user);
    Assert.assertNotNull(response16);

    Response response17 = listReservation(user);
    Assert.assertNotNull(response17);

    AppTimeoutInfo appTimeoutInfo = getAppTimeout(user);
    Assert.assertNotNull(appTimeoutInfo);

    AppTimeoutsInfo appTimeoutsInfo = getAppTimeouts(user);
    Assert.assertNotNull(appTimeoutsInfo);

    Response response18 = updateApplicationTimeout(user);
    Assert.assertNotNull(response18);

    AppAttemptsInfo appAttemptsInfo = getAppAttempts(user);
    Assert.assertNotNull(appAttemptsInfo);

    AppAttemptInfo appAttemptInfo = getAppAttempt(user);
    Assert.assertNotNull(appAttemptInfo);

    ContainersInfo containersInfo = getContainers(user);
    Assert.assertNotNull(containersInfo);

    ContainerInfo containerInfo = getContainer(user);
    Assert.assertNotNull(containerInfo);
  }

  /**
   * Tests if the pipeline is created properly.
   */
  @Test
  public void testRequestInterceptorChainCreation() throws Exception {
    RESTRequestInterceptor root =
        super.getRouterWebServices().createRequestInterceptorChain();
    int index = 0;
    while (root != null) {
      // The current pipeline is:
      // PassThroughRESTRequestInterceptor - index = 0
      // PassThroughRESTRequestInterceptor - index = 1
      // PassThroughRESTRequestInterceptor - index = 2
      // MockRESTRequestInterceptor - index = 3
      switch (index) {
      case 0: // Fall to the next case
      case 1: // Fall to the next case
      case 2:
        // If index is equal to 0,1 or 2 we fall in this check
        Assert.assertEquals(PassThroughRESTRequestInterceptor.class.getName(),
            root.getClass().getName());
        break;
      case 3:
        Assert.assertEquals(MockRESTRequestInterceptor.class.getName(),
            root.getClass().getName());
        break;
      default:
        Assert.fail();
      }
      root = root.getNextInterceptor();
      index++;
    }
    Assert.assertEquals("The number of interceptors in chain does not match", 4,
        index);
  }

  /**
   * Test if the different chains for users are generated, and LRU cache is
   * working as expected.
   */
  @Test
  public void testUsersChainMapWithLRUCache()
      throws YarnException, IOException, InterruptedException {
    getInterceptorChain("test1");
    getInterceptorChain("test2");
    getInterceptorChain("test3");
    getInterceptorChain("test4");
    getInterceptorChain("test5");
    getInterceptorChain("test6");
    getInterceptorChain("test7");
    getInterceptorChain("test8");

    Map<String, RequestInterceptorChainWrapper> pipelines =
        getRouterWebServices().getPipelines();
    Assert.assertEquals(8, pipelines.size());

    getInterceptorChain("test9");
    getInterceptorChain("test10");
    getInterceptorChain("test1");
    getInterceptorChain("test11");

    // The cache max size is defined in TEST_MAX_CACHE_SIZE
    Assert.assertEquals(10, pipelines.size());

    RequestInterceptorChainWrapper chain = pipelines.get("test1");
    Assert.assertNotNull("test1 should not be evicted", chain);

    chain = pipelines.get("test2");
    Assert.assertNull("test2 should have been evicted", chain);
  }

  /**
   * This test validates if the RESTRequestInterceptor chain for the user
   * can build and init correctly when a multi-client process begins to
   * request RouterWebServices for the same user simultaneously.
   */
  @Test
  public void testWebPipelineConcurrent() throws InterruptedException {
    final String user = "test1";

    /*
     * ClientTestThread is a thread to simulate a client request to get a
     * RESTRequestInterceptor for the user.
     */
    class ClientTestThread extends Thread {
      private RESTRequestInterceptor interceptor;
      @Override public void run() {
        try {
          interceptor = pipeline();
        } catch (IOException | InterruptedException e) {
          e.printStackTrace();
        }
      }
      private RESTRequestInterceptor pipeline()
          throws IOException, InterruptedException {
        return UserGroupInformation.createRemoteUser(user).doAs(
            new PrivilegedExceptionAction<RESTRequestInterceptor>() {
              @Override
              public RESTRequestInterceptor run() throws Exception {
                RequestInterceptorChainWrapper wrapper =
                    getInterceptorChain(user);
                RESTRequestInterceptor interceptor =
                    wrapper.getRootInterceptor();
                Assert.assertNotNull(interceptor);
                LOG.info("init web interceptor success for user" + user);
                return interceptor;
              }
            });
      }
    }

    /*
     * We start the first thread. It should not finish initing a chainWrapper
     * before the other thread starts. In this way, the second thread can
     * init at the same time of the first one. In the end, we validate that
     * the 2 threads get the same chainWrapper without going into error.
     */
    ClientTestThread client1 = new ClientTestThread();
    ClientTestThread client2 = new ClientTestThread();
    client1.start();
    client2.start();
    client1.join();
    client2.join();

    Assert.assertNotNull(client1.interceptor);
    Assert.assertNotNull(client2.interceptor);
    Assert.assertTrue(client1.interceptor == client2.interceptor);
  }

}


text:
package org.apache.geode.internal.cache;

import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import org.apache.geode.cache.execute.FunctionService;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.AvailablePortHelper;
import org.apache.geode.management.internal.configuration.functions.GetClusterConfigurationFunction;
import org.apache.geode.test.dunit.rules.ClusterStartupRule;
import org.apache.geode.test.dunit.rules.MemberVM;
import org.apache.geode.test.version.TestVersion;
import org.apache.geode.test.version.VersionManager;

@RunWith(Parameterized.class)
public class GetClusterConfigurationFunctionCompatibilityTest {

  private final String oldVersion;

  @Parameterized.Parameters(name = "Version: {0}")
  public static Collection<String> data() {
    final TestVersion OLDEST_VERSION_SUPPORTING_GET_CLUSTER_CONFIGURATION_FUNCTION =
        TestVersion.valueOf("1.12.0");
    List<String> result = VersionManager.getInstance().getVersionsWithoutCurrent();
    result.removeIf(s -> TestVersion.valueOf(s)
        .lessThan(OLDEST_VERSION_SUPPORTING_GET_CLUSTER_CONFIGURATION_FUNCTION));
    return result;
  }

  public GetClusterConfigurationFunctionCompatibilityTest(String oldVersion) {
    this.oldVersion = oldVersion;
  }

  @Rule
  public ClusterStartupRule clusterStartupRule = new ClusterStartupRule();

  /*
   * The goal of the test is that GetClusterConfigurationFunction can be
   * deserialized in the old versions members
   * Changes to the class can cause the serialVersionUUID to change which
   * can cause the serialization to fail in old members.
   */
  @Test
  public void newLocatorCanGetClusterConfigurationFromOldLocator() {
    // Start locators in old version
    MemberVM locator1 = clusterStartupRule.startLocatorVM(0, oldVersion);
    int locator1Port = locator1.getPort();
    MemberVM locator2 =
        clusterStartupRule.startLocatorVM(1, AvailablePortHelper.getRandomAvailableTCPPort(),
            oldVersion, l -> l.withConnectionToLocator(locator1Port));
    // Roll one locator to the new version
    locator2.stop(false);
    locator2 = clusterStartupRule.startLocatorVM(1, l -> l.withConnectionToLocator(locator1Port));
    // Execute the function from the new locator
    locator2.invoke(() -> {
      Set<InternalDistributedMember> locators =
          ClusterStartupRule.getCache().getDistributionManager().getLocatorDistributionManagerIds();
      locators.forEach(locator -> {
        FunctionService.onMember(locator).setArguments(new HashSet<>())
            .execute(new GetClusterConfigurationFunction());
      });
    });
    /*
     * LogCheckers will detect the deserialization error in the logs and fail the
     * test if it occurs.
     */

  }

}


text:
EDG\::WP4\::CCM\::Fetch\::Download
##################################

****
NAME
****

EDG::WP4::CCM::Fetch::Download

***********
DESCRIPTION
***********

Module provides methods to handle the retrieval of the profiles.

*********
Functions
*********

- retrieve

 Stores $url into $cache if it's newer than $time, or if $self->{FORCE}
 is set.

 It returns undef in case of error, 0 if it there were no changes on the
 remote server since ``$time`` (the server returned a 304 code)
 and a ``CAF::FileWriter`` object with the
 downloaded contents if they had to be downloaded.

 Should be called ony by ``download``.

- download

 Downloads the files associated with $type (profile). In
 case of error it retries $self->{RETRIEVE_RETRIES} times, falling back
 to a failover URL if necessary (thus up to 2\*$self->{RETRIEVE_RETRIES}
 may happen.

 Returns undef (or dies) in case of error, or the result from ``retrieve`` method otherwise:

 - 0 if nothing had to be retrieved (files in the server were older than our local cache)

 - a ``CAF::FileWriter`` object with the downloaded contents, if something was actually downloaded


text:
import unittest
import echidna.core.spectra as spectra
import echidna.output.store as store
import random
import numpy

class TestStore(unittest.TestCase):

    def test_serialisation(self):
        """ Test saving and then reloading a test spectra.

        """
        test_decays = 10
        test_spectra = spectra.Spectra("Test", test_decays)
        for x in range(0, test_decays):
            energy = random.uniform(0, test_spectra._energy_high)
            radius = random.uniform(0, test_spectra._radial_high)
            time = random.uniform(0, test_spectra._time_high)
            test_spectra.fill(energy, radius, time)

        store.dump("test.hdf5", test_spectra)
        loaded_spectra = store.load("test.hdf5")
        self.assertTrue(loaded_spectra.sum() == test_decays)
        self.assertTrue(numpy.array_equal(test_spectra._data, loaded_spectra._data))
        self.assertTrue(test_spectra._energy_low == loaded_spectra._energy_low)
        self.assertTrue(test_spectra._energy_high == loaded_spectra._energy_high)
        self.assertTrue(test_spectra._energy_bins == loaded_spectra._energy_bins)
        self.assertTrue(test_spectra._energy_width == loaded_spectra._energy_width)
        self.assertTrue(test_spectra._radial_low == loaded_spectra._radial_low)
        self.assertTrue(test_spectra._radial_high == loaded_spectra._radial_high)
        self.assertTrue(test_spectra._radial_bins == loaded_spectra._radial_bins)
        self.assertTrue(test_spectra._radial_width == loaded_spectra._radial_width)
        self.assertTrue(test_spectra._time_low == loaded_spectra._time_low)
        self.assertTrue(test_spectra._time_high == loaded_spectra._time_high)
        self.assertTrue(test_spectra._time_bins == loaded_spectra._time_bins)
        self.assertTrue(test_spectra._time_width == loaded_spectra._time_width)
        self.assertTrue(test_spectra._num_decays == loaded_spectra._num_decays)


text:
/* deps: mocha */
var assert = require('assert');
var each = require('./');

describe('eachStringIndex:', function () {
  it('should get the index for each occurrence.', function () {
    assert.deepEqual(each('b', 'a b c d b e b f'), [2, 8, 12]);
    assert.deepEqual(each('b', 'bb c d b e b f'), [0, 1, 7, 11]);
    assert.deepEqual(each('foo', 'bb foo bar foo bar foo'), [3, 11, 19]);
  });
});


text:
<?php
namespace Platformsh\Cli\Command\Tunnel;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class TunnelCloseCommand extends TunnelCommandBase
{
    protected function configure()
    {
        $this
          ->setName('tunnel:close')
          ->setDescription('Close SSH tunnels')
            ->addOption('all', 'a', InputOption::VALUE_NONE, 'Close all tunnels');
        $this->addProjectOption();
        $this->addEnvironmentOption();
        $this->addAppOption();
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $tunnels = $this->getTunnelInfo();
        $allTunnelsCount = count($tunnels);
        if (!$allTunnelsCount) {
            $this->stdErr->writeln('No tunnels found.');
            return 1;
        }

        // Filter tunnels according to the current project and environment, if
        // available.
        if (!$input->getOption('all')) {
            $tunnels = $this->filterTunnels($tunnels, $input);
            if (!count($tunnels)) {
                $this->stdErr->writeln('No tunnels found. Use --all to close all tunnels.');
                return 1;
            }
        }

        /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */
        $questionHelper = $this->getService('question_helper');

        $error = false;
        foreach ($tunnels as $tunnel) {
            $relationshipString = $this->formatTunnelRelationship($tunnel);
            $appString = $tunnel['projectId'] . '-' . $tunnel['environmentId'];
            if ($tunnel['appName']) {
                $appString .= '--' . $tunnel['appName'];
            }
            $questionText = sprintf(
                'Close tunnel to relationship <comment>%s</comment> on %s?',
                $relationshipString,
                $appString
            );
            if ($questionHelper->confirm($questionText)) {
                if ($this->closeTunnel($tunnel)) {
                    $this->stdErr->writeln(sprintf(
                        'Closed tunnel to <info>%s</info> on %s',
                        $relationshipString,
                        $appString
                    ));
                } else {
                    $error = true;
                    $this->stdErr->writeln(sprintf(
                        'Failed to close tunnel to <error>%s</error> on %s',
                        $relationshipString,
                        $appString
                    ));
                }
            }
        }

        if (!$input->getOption('all') && count($tunnels) < $allTunnelsCount) {
            $this->stdErr->writeln('Use --all to close all tunnels.');
        }

        return $error ? 1 : 0;
    }
}


text:
package org.smartdata.erasurecode.rawcoder;

import org.junit.Before;

/**
 * Test the new raw Reed-solomon coder implemented in Java.
 */
public class TestRSRawCoder extends TestRSRawCoderBase {

  @Before
  public void setup() {
    this.encoderClass = RSRawEncoder.class;
    this.decoderClass = RSRawDecoder.class;
    setAllowDump(false);
  }
}


text:
package org.wso2.carbon.webapp.authenticator.framework.authenticator.oauth;

/**
 * Defines constants to be used inside oauth validators.
 */
public class OAuthConstants {

    public static final String AUTHORIZATION_HEADER_PREFIX_BEARER = "Bearer";
    public static final String AUTHORIZATION_HEADER_PREFIX_BASIC = "Basic";
    public static final String BEARER_TOKEN_TYPE = "bearer";
    public static final String BEARER_TOKEN_IDENTIFIER = "token";
    public static final String AUTHENTICATOR_NAME = "OAuthAuthenticator";
    public static final String RESOURCE_KEY = "resource";

}


text:
[![CircleCI](https://circleci.com/gh/brainsiq/opinionbee-api/tree/master.svg?style=svg&circle-token=010bc8270831fcda503790ca7075512c712b8b73)](https://circleci.com/gh/brainsiq/opinionbee-api/tree/master)

A Node.js client library for the [Opinionbee API](http://opinionbee.uk/api). Tested against Node.js versions 6, 7 and 8.

### Installation

`npm install opinionbee-api`

### Usage

```
const ApiClient = require('opinionbee-api');
const apiClient = new ApiClient({ apiKey: 'your-api-key' });

apiClient.polls()
  .then(polls => console.log(polls))
  .catch(console.error);
```

See [API documentation](API.md) for more details.


text:
<?php

namespace Arnapou\PFDB\Exception;

class NotDefinedFromIteratorException extends PFDBException
{
}


text:
<?php

namespace Liquid\Tests\Lib;

class CounterDrop extends \Liquid\Drop {
    protected $count = 0;

    public function count() {
        $this->count++;
        return $this->count;
    }
}


text:
FOUNDATION_EXPORT double Pods_RSPrescreener_TestsVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_RSPrescreener_TestsVersionString[];


text:
"""
Tests for the default UnitarySynthesis transpiler pass.
"""

import unittest

from test import combine

from ddt import ddt, data

from qiskit import transpile
from qiskit.test import QiskitTestCase
from qiskit.providers.fake_provider import FakeVigo, FakeMumbaiFractionalCX
from qiskit.providers.fake_provider.fake_backend_v2 import FakeBackendV2, FakeBackend5QV2
from qiskit.circuit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit.circuit.library import QuantumVolume
from qiskit.converters import circuit_to_dag, dag_to_circuit
from qiskit.transpiler.passes import UnitarySynthesis
from qiskit.quantum_info.operators import Operator
from qiskit.quantum_info.random import random_unitary
from qiskit.transpiler import PassManager, CouplingMap, Target, InstructionProperties
from qiskit.transpiler.exceptions import TranspilerError
from qiskit.exceptions import QiskitError
from qiskit.transpiler.passes import (
    Collect2qBlocks,
    ConsolidateBlocks,
    Optimize1qGates,
    SabreLayout,
    Depth,
    FixedPoint,
    FullAncillaAllocation,
    EnlargeWithAncilla,
    ApplyLayout,
    Unroll3qOrMore,
    CheckMap,
    BarrierBeforeFinalMeasurements,
    SabreSwap,
    TrivialLayout,
)
from qiskit.circuit.library import CXGate, ECRGate, UGate
from qiskit.circuit import Parameter

@ddt
class TestUnitarySynthesis(QiskitTestCase):
    """Test UnitarySynthesis pass."""

    def test_empty_basis_gates(self):
        """Verify when basis_gates is None, we do not synthesize unitaries."""
        qc = QuantumCircuit(1)
        qc.unitary([[0, 1], [1, 0]], [0])

        dag = circuit_to_dag(qc)

        out = UnitarySynthesis(None).run(dag)

        self.assertEqual(out.count_ops(), {"unitary": 1})

    @data(
        ["u3", "cx"],
        ["u1", "u2", "u3", "cx"],
        ["rx", "ry", "rxx"],
        ["rx", "rz", "iswap"],
        ["u3", "rx", "rz", "cz", "iswap"],
    )
    def test_two_qubit_synthesis_to_basis(self, basis_gates):
        """Verify two qubit unitaries are synthesized to match basis gates."""
        bell = QuantumCircuit(2)
        bell.h(0)
        bell.cx(0, 1)
        bell_op = Operator(bell)

        qc = QuantumCircuit(2)
        qc.unitary(bell_op, [0, 1])
        dag = circuit_to_dag(qc)

        out = UnitarySynthesis(basis_gates).run(dag)

        self.assertTrue(set(out.count_ops()).issubset(basis_gates))

    def test_two_qubit_synthesis_to_directional_cx_from_gate_errors(self):
        """Verify two qubit unitaries are synthesized to match basis gates."""
        # TODO: should make check more explicit e.g. explicitly set gate
        # direction in test instead of using specific fake backend
        backend = FakeVigo()
        conf = backend.configuration()
        qr = QuantumRegister(2)
        coupling_map = CouplingMap(conf.coupling_map)
        triv_layout_pass = TrivialLayout(coupling_map)
        qc = QuantumCircuit(qr)
        qc.unitary(random_unitary(4, seed=12), [0, 1])
        unisynth_pass = UnitarySynthesis(
            basis_gates=conf.basis_gates,
            coupling_map=None,
            backend_props=backend.properties(),
            pulse_optimize=True,
            natural_direction=False,
        )
        pm = PassManager([triv_layout_pass, unisynth_pass])
        qc_out = pm.run(qc)

        unisynth_pass_nat = UnitarySynthesis(
            basis_gates=conf.basis_gates,
            coupling_map=None,
            backend_props=backend.properties(),
            pulse_optimize=True,
            natural_direction=True,
        )

        pm_nat = PassManager([triv_layout_pass, unisynth_pass_nat])
        qc_out_nat = pm_nat.run(qc)
        self.assertEqual(Operator(qc), Operator(qc_out))
        self.assertEqual(Operator(qc), Operator(qc_out_nat))

    def test_swap_synthesis_to_directional_cx(self):
        """Verify two qubit unitaries are synthesized to match basis gates."""
        # TODO: should make check more explicit e.g. explicitly set gate
        # direction in test instead of using specific fake backend
        backend = FakeVigo()
        conf = backend.configuration()
        qr = QuantumRegister(2)
        coupling_map = CouplingMap(conf.coupling_map)
        triv_layout_pass = TrivialLayout(coupling_map)
        qc = QuantumCircuit(qr)
        qc.swap(qr[0], qr[1])
        unisynth_pass = UnitarySynthesis(
            basis_gates=conf.basis_gates,
            coupling_map=None,
            backend_props=backend.properties(),
            pulse_optimize=True,
            natural_direction=False,
        )
        pm = PassManager([triv_layout_pass, unisynth_pass])
        qc_out = pm.run(qc)

        unisynth_pass_nat = UnitarySynthesis(
            basis_gates=conf.basis_gates,
            coupling_map=None,
            backend_props=backend.properties(),
            pulse_optimize=True,
            natural_direction=True,
        )

        pm_nat = PassManager([triv_layout_pass, unisynth_pass_nat])
        qc_out_nat = pm_nat.run(qc)

        self.assertEqual(Operator(qc), Operator(qc_out))
        self.assertEqual(Operator(qc), Operator(qc_out_nat))

    def test_two_qubit_synthesis_to_directional_cx_multiple_registers(self):
        """Verify two qubit unitaries are synthesized to match basis gates
        across multiple registers."""
        # TODO: should make check more explicit e.g. explicitly set gate
        # direction in test instead of using specific fake backend
        backend = FakeVigo()
        conf = backend.configuration()
        qr0 = QuantumRegister(1)
        qr1 = QuantumRegister(1)
        coupling_map = CouplingMap(conf.coupling_map)
        triv_layout_pass = TrivialLayout(coupling_map)
        qc = QuantumCircuit(qr0, qr1)
        qc.unitary(random_unitary(4, seed=12), [qr0[0], qr1[0]])
        unisynth_pass = UnitarySynthesis(
            basis_gates=conf.basis_gates,
            coupling_map=None,
            backend_props=backend.properties(),
            pulse_optimize=True,
            natural_direction=False,
        )
        pm = PassManager([triv_layout_pass, unisynth_pass])
        qc_out = pm.run(qc)

        unisynth_pass_nat = UnitarySynthesis(
            basis_gates=conf.basis_gates,
            coupling_map=None,
            backend_props=backend.properties(),
            pulse_optimize=True,
            natural_direction=True,
        )

        pm_nat = PassManager([triv_layout_pass, unisynth_pass_nat])
        qc_out_nat = pm_nat.run(qc)
        self.assertEqual(Operator(qc), Operator(qc_out))
        self.assertEqual(Operator(qc), Operator(qc_out_nat))

    def test_two_qubit_synthesis_to_directional_cx_from_coupling_map(self):
        """Verify natural cx direction is used when specified in coupling map."""
        # TODO: should make check more explicit e.g. explicitly set gate
        # direction in test instead of using specific fake backend
        backend = FakeVigo()
        conf = backend.configuration()
        qr = QuantumRegister(2)
        coupling_map = CouplingMap([[0, 1], [1, 2], [1, 3], [3, 4]])
        triv_layout_pass = TrivialLayout(coupling_map)
        qc = QuantumCircuit(qr)
        qc.unitary(random_unitary(4, seed=12), [0, 1])
        unisynth_pass = UnitarySynthesis(
            basis_gates=conf.basis_gates,
            coupling_map=coupling_map,
            backend_props=backend.properties(),
            pulse_optimize=True,
            natural_direction=False,
        )
        pm = PassManager([triv_layout_pass, unisynth_pass])
        qc_out = pm.run(qc)

        unisynth_pass_nat = UnitarySynthesis(
            basis_gates=conf.basis_gates,
            coupling_map=coupling_map,
            backend_props=backend.properties(),
            pulse_optimize=True,
            natural_direction=True,
        )

        pm_nat = PassManager([triv_layout_pass, unisynth_pass_nat])
        qc_out_nat = pm_nat.run(qc)
        # the decomposer defaults to the [1, 0] direction but the coupling
        # map specifies a [0, 1] direction. Check that this is respected.
        self.assertTrue(
            all(((qr[1], qr[0]) == instr.qubits for instr in qc_out.get_instructions("cx")))
        )
        self.assertTrue(
            all(((qr[0], qr[1]) == instr.qubits for instr in qc_out_nat.get_instructions("cx")))
        )
        self.assertEqual(Operator(qc), Operator(qc_out))
        self.assertEqual(Operator(qc), Operator(qc_out_nat))

    def test_two_qubit_synthesis_to_directional_cx_from_coupling_map_natural_none(self):
        """Verify natural cx direction is used when specified in coupling map
        when natural_direction is None."""
        # TODO: should make check more explicit e.g. explicitly set gate
        # direction in test instead of using specific fake backend
        backend = FakeVigo()
        conf = backend.configuration()
        qr = QuantumRegister(2)
        coupling_map = CouplingMap([[0, 1], [1, 2], [1, 3], [3, 4]])
        triv_layout_pass = TrivialLayout(coupling_map)
        qc = QuantumCircuit(qr)
        qc.unitary(random_unitary(4, seed=12), [0, 1])
        unisynth_pass = UnitarySynthesis(
            basis_gates=conf.basis_gates,
            coupling_map=coupling_map,
            backend_props=backend.properties(),
            pulse_optimize=True,
            natural_direction=False,
        )
        pm = PassManager([triv_layout_pass, unisynth_pass])
        qc_out = pm.run(qc)

        unisynth_pass_nat = UnitarySynthesis(
            basis_gates=conf.basis_gates,
            coupling_map=coupling_map,
            backend_props=backend.properties(),
            pulse_optimize=True,
            natural_direction=None,
        )

        pm_nat = PassManager([triv_layout_pass, unisynth_pass_nat])
        qc_out_nat = pm_nat.run(qc)
        # the decomposer defaults to the [1, 0] direction but the coupling
        # map specifies a [0, 1] direction. Check that this is respected.
        self.assertTrue(
            all(((qr[1], qr[0]) == instr.qubits for instr in qc_out.get_instructions("cx")))
        )
        self.assertTrue(
            all(((qr[0], qr[1]) == instr.qubits for instr in qc_out_nat.get_instructions("cx")))
        )
        self.assertEqual(Operator(qc), Operator(qc_out))
        self.assertEqual(Operator(qc), Operator(qc_out_nat))

    def test_two_qubit_synthesis_to_directional_cx_from_coupling_map_natural_false(self):
        """Verify natural cx direction is used when specified in coupling map
        when natural_direction is None."""
        # TODO: should make check more explicit e.g. explicitly set gate
        # direction in test instead of using specific fake backend
        backend = FakeVigo()
        conf = backend.configuration()
        qr = QuantumRegister(2)
        coupling_map = CouplingMap([[0, 1], [1, 2], [1, 3], [3, 4]])
        triv_layout_pass = TrivialLayout(coupling_map)
        qc = QuantumCircuit(qr)
        qc.unitary(random_unitary(4, seed=12), [0, 1])
        unisynth_pass = UnitarySynthesis(
            basis_gates=conf.basis_gates,
            coupling_map=coupling_map,
            backend_props=backend.properties(),
            pulse_optimize=True,
            natural_direction=False,
        )
        pm = PassManager([triv_layout_pass, unisynth_pass])
        qc_out = pm.run(qc)

        unisynth_pass_nat = UnitarySynthesis(
            basis_gates=conf.basis_gates,
            coupling_map=coupling_map,
            backend_props=backend.properties(),
            pulse_optimize=True,
            natural_direction=False,
        )

        pm_nat = PassManager([triv_layout_pass, unisynth_pass_nat])
        qc_out_nat = pm_nat.run(qc)
        # the decomposer defaults to the [1, 0] direction but the coupling
        # map specifies a [0, 1] direction. Check that this is respected.
        self.assertTrue(
            all(((qr[1], qr[0]) == instr.qubits for instr in qc_out.get_instructions("cx")))
        )
        self.assertTrue(
            all(((qr[1], qr[0]) == instr.qubits for instr in qc_out_nat.get_instructions("cx")))
        )
        self.assertEqual(Operator(qc), Operator(qc_out))
        self.assertEqual(Operator(qc), Operator(qc_out_nat))

    def test_two_qubit_synthesis_not_pulse_optimal(self):
        """Verify not attempting pulse optimal decomposition when pulse_optimize==False."""
        backend = FakeVigo()
        conf = backend.configuration()
        qr = QuantumRegister(2)
        coupling_map = CouplingMap([[0, 1], [1, 2], [1, 3], [3, 4]])
        triv_layout_pass = TrivialLayout(coupling_map)
        qc = QuantumCircuit(qr)
        qc.unitary(random_unitary(4, seed=12), [0, 1])
        unisynth_pass = UnitarySynthesis(
            basis_gates=conf.basis_gates,
            coupling_map=coupling_map,
            backend_props=backend.properties(),
            pulse_optimize=False,
            natural_direction=True,
        )
        pm = PassManager([triv_layout_pass, unisynth_pass])
        qc_out = pm.run(qc)
        if isinstance(qc_out, QuantumCircuit):
            num_ops = qc_out.count_ops()
        else:
            num_ops = qc_out[0].count_ops()
        self.assertIn("sx", num_ops)
        self.assertGreaterEqual(num_ops["sx"], 16)

    def test_two_qubit_pulse_optimal_true_raises(self):
        """Verify raises if pulse optimal==True but cx is not in the backend basis."""
        backend = FakeVigo()
        conf = backend.configuration()
        # this assumes iswawp pulse optimal decomposition doesn't exist
        conf.basis_gates = [gate if gate != "cx" else "iswap" for gate in conf.basis_gates]
        qr = QuantumRegister(2)
        coupling_map = CouplingMap([[0, 1], [1, 2], [1, 3], [3, 4]])
        triv_layout_pass = TrivialLayout(coupling_map)
        qc = QuantumCircuit(qr)
        qc.unitary(random_unitary(4, seed=12), [0, 1])
        unisynth_pass = UnitarySynthesis(
            basis_gates=conf.basis_gates,
            coupling_map=coupling_map,
            backend_props=backend.properties(),
            pulse_optimize=True,
            natural_direction=True,
        )
        pm = PassManager([triv_layout_pass, unisynth_pass])
        with self.assertRaises(QiskitError):
            pm.run(qc)

    def test_two_qubit_natural_direction_true_duration_fallback(self):
        """Verify not attempting pulse optimal decomposition when pulse_optimize==False."""
        # this assumes iswawp pulse optimal decomposition doesn't exist
        backend = FakeVigo()
        conf = backend.configuration()
        # conf.basis_gates = [gate if gate != "cx" else "iswap" for gate in conf.basis_gates]
        qr = QuantumRegister(2)
        coupling_map = CouplingMap([[0, 1], [1, 0], [1, 2], [1, 3], [3, 4]])
        triv_layout_pass = TrivialLayout(coupling_map)
        qc = QuantumCircuit(qr)
        qc.unitary(random_unitary(4, seed=12), [0, 1])
        unisynth_pass = UnitarySynthesis(
            basis_gates=conf.basis_gates,
            coupling_map=coupling_map,
            backend_props=backend.properties(),
            pulse_optimize=True,
            natural_direction=True,
        )
        pm = PassManager([triv_layout_pass, unisynth_pass])
        qc_out = pm.run(qc)
        self.assertTrue(
            all(((qr[0], qr[1]) == instr.qubits for instr in qc_out.get_instructions("cx")))
        )

    def test_two_qubit_natural_direction_true_gate_length_raises(self):
        """Verify not attempting pulse optimal decomposition when pulse_optimize==False."""
        # this assumes iswawp pulse optimal decomposition doesn't exist
        backend = FakeVigo()
        conf = backend.configuration()
        for _, nduv in backend.properties()._gates["cx"].items():
            nduv["gate_length"] = (4e-7, nduv["gate_length"][1])
            nduv["gate_error"] = (7e-3, nduv["gate_error"][1])
        qr = QuantumRegister(2)
        coupling_map = CouplingMap([[0, 1], [1, 0], [1, 2], [1, 3], [3, 4]])
        triv_layout_pass = TrivialLayout(coupling_map)
        qc = QuantumCircuit(qr)
        qc.unitary(random_unitary(4, seed=12), [0, 1])
        unisynth_pass = UnitarySynthesis(
            basis_gates=conf.basis_gates,
            backend_props=backend.properties(),
            pulse_optimize=True,
            natural_direction=True,
        )
        pm = PassManager([triv_layout_pass, unisynth_pass])
        with self.assertRaises(TranspilerError):
            pm.run(qc)

    def test_two_qubit_pulse_optimal_none_optimal(self):
        """Verify pulse optimal decomposition when pulse_optimize==None."""
        # this assumes iswawp pulse optimal decomposition doesn't exist
        backend = FakeVigo()
        conf = backend.configuration()
        qr = QuantumRegister(2)
        coupling_map = CouplingMap([[0, 1], [1, 2], [1, 3], [3, 4]])
        triv_layout_pass = TrivialLayout(coupling_map)
        qc = QuantumCircuit(qr)
        qc.unitary(random_unitary(4, seed=12), [0, 1])
        unisynth_pass = UnitarySynthesis(
            basis_gates=conf.basis_gates,
            coupling_map=coupling_map,
            backend_props=backend.properties(),
            pulse_optimize=None,
            natural_direction=True,
        )
        pm = PassManager([triv_layout_pass, unisynth_pass])
        qc_out = pm.run(qc)
        if isinstance(qc_out, QuantumCircuit):
            num_ops = qc_out.count_ops()
        else:
            num_ops = qc_out[0].count_ops()
        self.assertIn("sx", num_ops)
        self.assertLessEqual(num_ops["sx"], 12)

    def test_two_qubit_pulse_optimal_none_no_raise(self):
        """Verify pulse optimal decomposition when pulse_optimize==None doesn't
        raise when pulse optimal decomposition unknown."""
        # this assumes iswawp pulse optimal decomposition doesn't exist
        backend = FakeVigo()
        conf = backend.configuration()
        conf.basis_gates = [gate if gate != "cx" else "iswap" for gate in conf.basis_gates]
        qr = QuantumRegister(2)
        coupling_map = CouplingMap([[0, 1], [1, 2], [1, 3], [3, 4]])
        triv_layout_pass = TrivialLayout(coupling_map)
        qc = QuantumCircuit(qr)
        qc.unitary(random_unitary(4, seed=12), [0, 1])
        unisynth_pass = UnitarySynthesis(
            basis_gates=conf.basis_gates,
            coupling_map=coupling_map,
            backend_props=backend.properties(),
            pulse_optimize=None,
            natural_direction=True,
        )
        pm = PassManager([triv_layout_pass, unisynth_pass])
        try:
            qc_out = pm.run(qc)
        except QiskitError:
            self.fail("pulse_optimize=None raised exception unexpectedly")
        if isinstance(qc_out, QuantumCircuit):
            num_ops = qc_out.count_ops()
        else:
            num_ops = qc_out[0].count_ops()
        self.assertIn("sx", num_ops)
        self.assertLessEqual(num_ops["sx"], 14)

    def test_qv_natural(self):
        """check that quantum volume circuit compiles for natural direction"""
        qv64 = QuantumVolume(5, seed=15)

        def construct_passmanager(basis_gates, coupling_map, synthesis_fidelity, pulse_optimize):
            def _repeat_condition(property_set):
                return not property_set["depth_fixed_point"]

            seed = 2
            _map = [SabreLayout(coupling_map, max_iterations=2, seed=seed)]
            _embed = [FullAncillaAllocation(coupling_map), EnlargeWithAncilla(), ApplyLayout()]
            _unroll3q = Unroll3qOrMore()
            _swap_check = CheckMap(coupling_map)
            _swap = [
                BarrierBeforeFinalMeasurements(),
                SabreSwap(coupling_map, heuristic="lookahead", seed=seed),
            ]
            _check_depth = [Depth(), FixedPoint("depth")]
            _optimize = [
                Collect2qBlocks(),
                ConsolidateBlocks(basis_gates=basis_gates),
                UnitarySynthesis(
                    basis_gates,
                    synthesis_fidelity,
                    coupling_map,
                    pulse_optimize=pulse_optimize,
                    natural_direction=True,
                ),
                Optimize1qGates(basis_gates),
            ]

            pm = PassManager()
            pm.append(_map)  # map to hardware by inserting swaps
            pm.append(_embed)
            pm.append(_unroll3q)
            pm.append(_swap_check)
            pm.append(_swap)
            pm.append(
                _check_depth + _optimize, do_while=_repeat_condition
            )  # translate to & optimize over hardware native gates
            return pm

        coupling_map = CouplingMap([[0, 1], [1, 2], [3, 2], [3, 4], [5, 4]])
        basis_gates = ["rz", "sx", "cx"]

        pm1 = construct_passmanager(
            basis_gates=basis_gates,
            coupling_map=coupling_map,
            synthesis_fidelity=0.99,
            pulse_optimize=True,
        )
        pm2 = construct_passmanager(
            basis_gates=basis_gates,
            coupling_map=coupling_map,
            synthesis_fidelity=0.99,
            pulse_optimize=False,
        )

        qv64_1 = pm1.run(qv64.decompose())
        qv64_2 = pm2.run(qv64.decompose())
        edges = [list(edge) for edge in coupling_map.get_edges()]
        self.assertTrue(
            all(
                [qv64_1.qubits.index(qubit) for qubit in instr.qubits] in edges
                for instr in qv64_1.get_instructions("cx")
            )
        )
        self.assertEqual(Operator(qv64_1), Operator(qv64_2))

    @data(1, 2, 3)
    def test_coupling_map_transpile(self, opt):
        """test natural_direction works with transpile/execute"""
        qr = QuantumRegister(2)
        circ = QuantumCircuit(qr)
        circ.append(random_unitary(4, seed=1), [0, 1])
        circ_01 = transpile(
            circ, basis_gates=["rz", "sx", "cx"], optimization_level=opt, coupling_map=[[0, 1]]
        )
        circ_10 = transpile(
            circ, basis_gates=["rz", "sx", "cx"], optimization_level=opt, coupling_map=[[1, 0]]
        )
        circ_01_index = {qubit: index for index, qubit in enumerate(circ_01.qubits)}
        circ_10_index = {qubit: index for index, qubit in enumerate(circ_10.qubits)}

        self.assertTrue(
            all(
                (
                    (1, 0) == (circ_10_index[instr.qubits[0]], circ_10_index[instr.qubits[1]])
                    for instr in circ_10.get_instructions("cx")
                )
            )
        )
        self.assertTrue(
            all(
                (
                    (0, 1) == (circ_01_index[instr.qubits[0]], circ_01_index[instr.qubits[1]])
                    for instr in circ_01.get_instructions("cx")
                )
            )
        )

    @combine(
        opt_level=[0, 1, 2, 3],
        bidirectional=[True, False],
        dsc=(
            "test natural_direction works with transpile using opt_level {opt_level} on"
            " target with multiple 2q gates with bidirectional={bidirectional}"
        ),
        name="opt_level_{opt_level}_bidirectional_{bidirectional}",
    )
    def test_coupling_map_transpile_with_backendv2(self, opt_level, bidirectional):
        backend = FakeBackend5QV2(bidirectional)
        qr = QuantumRegister(2)
        circ = QuantumCircuit(qr)
        circ.append(random_unitary(4, seed=1), [0, 1])
        circ_01 = transpile(
            circ, backend=backend, optimization_level=opt_level, layout_method="trivial"
        )
        circ_01_index = {qubit: index for index, qubit in enumerate(circ_01.qubits)}
        self.assertGreaterEqual(len(circ_01.get_instructions("cx")), 1)
        for instr in circ_01.get_instructions("cx"):
            self.assertEqual(
                (0, 1), (circ_01_index[instr.qubits[0]], circ_01_index[instr.qubits[1]])
            )

    @data(1, 2, 3)
    def test_coupling_map_unequal_durations(self, opt):
        """Test direction with transpile/execute with backend durations."""
        qr = QuantumRegister(2)
        circ = QuantumCircuit(qr)
        circ.append(random_unitary(4, seed=1), [1, 0])
        backend = FakeVigo()
        tqc = transpile(
            circ,
            backend=backend,
            optimization_level=opt,
            translation_method="synthesis",
            layout_method="trivial",
        )
        tqc_index = {qubit: index for index, qubit in enumerate(tqc.qubits)}
        self.assertTrue(
            all(
                (
                    (0, 1) == (tqc_index[instr.qubits[0]], tqc_index[instr.qubits[1]])
                    for instr in tqc.get_instructions("cx")
                )
            )
        )

    @combine(
        opt_level=[0, 1, 2, 3],
        bidirectional=[True, False],
        dsc=(
            "Test direction with transpile using opt_level {opt_level} on"
            " target with multiple 2q gates with bidirectional={bidirectional}"
        ),
        name="opt_level_{opt_level}_bidirectional_{bidirectional}",
    )
    def test_coupling_unequal_duration_with_backendv2(self, opt_level, bidirectional):
        qr = QuantumRegister(2)
        circ = QuantumCircuit(qr)
        circ.append(random_unitary(4, seed=1), [1, 0])
        backend = FakeBackend5QV2(bidirectional)
        tqc = transpile(
            circ,
            backend=backend,
            optimization_level=opt_level,
            translation_method="synthesis",
            layout_method="trivial",
        )
        tqc_index = {qubit: index for index, qubit in enumerate(tqc.qubits)}
        self.assertGreaterEqual(len(tqc.get_instructions("cx")), 1)
        if bidirectional:
            for instr in tqc.get_instructions("cx"):
                self.assertEqual((1, 0), (tqc_index[instr.qubits[0]], tqc_index[instr.qubits[1]]))

        else:
            for instr in tqc.get_instructions("cx"):
                self.assertEqual((0, 1), (tqc_index[instr.qubits[0]], tqc_index[instr.qubits[1]]))

    @combine(
        opt_level=[0, 1, 2, 3],
        dsc=(
            "Test direction with transpile using opt_level {opt_level} on"
            " target with multiple 2q gates"
        ),
        name="opt_level_{opt_level}",
    )
    def test_non_overlapping_kak_gates_with_backendv2(self, opt_level):
        qr = QuantumRegister(2)
        circ = QuantumCircuit(qr)
        circ.append(random_unitary(4, seed=1), [1, 0])
        backend = FakeBackendV2()
        tqc = transpile(
            circ,
            backend=backend,
            optimization_level=opt_level,
            translation_method="synthesis",
            layout_method="trivial",
        )
        tqc_index = {qubit: index for index, qubit in enumerate(tqc.qubits)}
        self.assertGreaterEqual(len(tqc.get_instructions("ecr")), 1)
        for instr in tqc.get_instructions("ecr"):
            self.assertEqual((1, 0), (tqc_index[instr.qubits[0]], tqc_index[instr.qubits[1]]))

    def test_fractional_cx_with_backendv2(self):
        """Test fractional CX gets used if present in target."""
        qr = QuantumRegister(2)
        circ = QuantumCircuit(qr)
        circ.append(random_unitary(4, seed=1), [0, 1])
        backend = FakeMumbaiFractionalCX()
        synth_pass = UnitarySynthesis(target=backend.target)
        tqc = synth_pass(circ)
        tqc_index = {qubit: index for index, qubit in enumerate(tqc.qubits)}
        self.assertGreaterEqual(len(tqc.get_instructions("rzx")), 1)
        for instr in tqc.get_instructions("rzx"):
            self.assertEqual((0, 1), (tqc_index[instr.qubits[0]], tqc_index[instr.qubits[1]]))

    @combine(
        opt_level=[0, 1, 2, 3],
        dsc=(
            "Test direction with transpile using opt_level {opt_level} on"
            "target with multiple 2q gates available in reverse direction"
        ),
        name="opt_level_{opt_level}",
    )
    def test_reverse_direction(self, opt_level):
        target = Target(2)
        target.add_instruction(CXGate(), {(0, 1): InstructionProperties(error=1.2e-6)})
        target.add_instruction(ECRGate(), {(0, 1): InstructionProperties(error=1.2e-7)})
        target.add_instruction(
            UGate(Parameter("theta"), Parameter("phi"), Parameter("lam")), {(0,): None, (1,): None}
        )
        qr = QuantumRegister(2)
        circ = QuantumCircuit(qr)
        circ.append(random_unitary(4, seed=1), [1, 0])
        tqc = transpile(
            circ,
            target=target,
            optimization_level=opt_level,
            translation_method="synthesis",
            layout_method="trivial",
        )
        tqc_index = {qubit: index for index, qubit in enumerate(tqc.qubits)}
        self.assertGreaterEqual(len(tqc.get_instructions("ecr")), 1)
        for instr in tqc.get_instructions("ecr"):
            self.assertEqual((0, 1), (tqc_index[instr.qubits[0]], tqc_index[instr.qubits[1]]))

    def test_if_simple(self):
        """Test a simple if statement."""
        basis_gates = {"u", "cx"}
        qr = QuantumRegister(2)
        cr = ClassicalRegister(2)

        qc_uni = QuantumCircuit(2)
        qc_uni.h(0)
        qc_uni.cx(0, 1)
        qc_uni_mat = Operator(qc_uni)

        qc_true_body = QuantumCircuit(2)
        qc_true_body.unitary(qc_uni_mat, [0, 1])

        qc = QuantumCircuit(qr, cr)
        qc.if_test((cr, 1), qc_true_body, [0, 1], [0, 1])
        dag = circuit_to_dag(qc)
        cdag = UnitarySynthesis(basis_gates=basis_gates).run(dag)
        cqc = dag_to_circuit(cdag)
        cbody = cqc.data[0].operation.params[0]
        self.assertEqual(cbody.count_ops().keys(), basis_gates)
        self.assertEqual(qc_uni_mat, Operator(cbody))

    def test_nested_control_flow(self):
        """Test unrolling nested control flow blocks."""
        qr = QuantumRegister(2)
        cr = ClassicalRegister(1)
        qc_uni1 = QuantumCircuit(2)
        qc_uni1.swap(0, 1)
        qc_uni1_mat = Operator(qc_uni1)

        qc = QuantumCircuit(qr, cr)
        with qc.for_loop(range(3)):
            with qc.while_loop((cr, 0)):
                qc.unitary(qc_uni1_mat, [0, 1])
        dag = circuit_to_dag(qc)
        cdag = UnitarySynthesis(basis_gates=["u", "cx"]).run(dag)
        cqc = dag_to_circuit(cdag)
        cbody = cqc.data[0].operation.params[2].data[0].operation.params[0]
        self.assertEqual(cbody.count_ops().keys(), {"u", "cx"})
        self.assertEqual(qc_uni1_mat, Operator(cbody))

if __name__ == "__main__":
    unittest.main()


text:
ask_for=document.getElementById('ask-for');
ask_for.addEventListener('click', askFor);

shuffle_in = document.getElementById('shuffle-in');
shuffle_in.addEventListener('click', shufflerIn);

shuffle_out = document.getElementById('shuffle-out');
shuffle_out.addEventListener('click', shufflerOut);

shuffle_out = document.getElementById('nodePush');
shuffle_out.addEventListener('click', nodePush);

// Ranuras maquina

var slot;
var slot_machine={};
var number_slots=[];

function nodePush(){
  var number_of_node= document.getElementById('nodos').value;
  for(var i=0; i<number_of_node; i++){
      slot_machine['node_'+(i+1)]=[];
      number_slots.push(i+1);
  }
}

// Método barajador de ranuras - Cambia posicion de numeros en un array.

function shuffleSlot(array) {
	for(var z=0; z<(array.length-1); z++){
    	var j, x, i = array.length;
    	j = parseInt(Math.random() * i);
    	x = array[--i];
    	array[i] = array[j];
    	array[j] = x;
    }
    return array;
};
// Métodos para barajar las cartas de entrada.

function shufflerIn(){
  var cards_pushed = 0;
  while(cards_pushed<deck.length) {
    var slot = shuffleSlot(number_slots);
    for (var a = 0; a < number_slots.length ; a++){
      var slot_picked=Math.floor(Math.random() * 3);
      var node=number_slots[slot_picked];
      slot_machine['node_'+node].push(deck[cards_pushed]);
      cards_pushed++;
      if(cards_pushed==deck.length){
        break
      }
    }
  }
}

// Método para elegir slot y sacar cartas

var output_deck=[]
var inner_deck=[]
var counting_cards=0;

function shufflerOut(){
  for(var i = 0; i<13; i++){
    var slot_picked=Math.floor(Math.random() * number_slots.length)+1;
    if(slot_machine['node_'+slot_picked].length!=0){
      var card_picked=Math.floor(Math.random() * slot_machine['node_'+slot_picked].length);
      output_deck.push(slot_machine['node_'+slot_picked][card_picked]);
      slot_machine['node_'+slot_picked].splice(card_picked, 1);
    }
    else {
      i--;
      console.log('Empy slot detected.');
    }
  }
}

// Método para salida y entrada de cartas subsecuentes.

function askFor(){
  drawCard(output_deck[0].color, output_deck[0].letra, output_deck[0].palo);
  inner_deck.push(output_deck[0]);
  output_deck.splice(0, 1);
  counting_cards++;
  if(counting_cards>=13){
    counting_cards=0;
    shufflerOut();
    deck=inner_deck;
    inner_deck=[];
    shufflerIn(deck);
  }
}

// Juego


text:
jQuery(document).ready(function() {
  $(".clickable").click(function() {
    $("#walrus-showing").slideToggle();
    $("#walrus-hidden").toggle();
  });
});


text:
/** @constructor */
ScalaJS.c.scala_xml_parsing_DefaultMarkupHandler = (function() {
  ScalaJS.c.scala_xml_parsing_MarkupHandler.call(this)
});
ScalaJS.c.scala_xml_parsing_DefaultMarkupHandler.prototype = new ScalaJS.inheritable.scala_xml_parsing_MarkupHandler();
ScalaJS.c.scala_xml_parsing_DefaultMarkupHandler.prototype.constructor = ScalaJS.c.scala_xml_parsing_DefaultMarkupHandler;
ScalaJS.c.scala_xml_parsing_DefaultMarkupHandler.prototype.elem__I__T__T__Lscala_xml_MetaData__Lscala_xml_NamespaceBinding__Z__Lscala_xml_NodeSeq__Lscala_xml_NodeSeq = (function(pos$3, pre, label, attrs, scope, empty, args) {
  return ScalaJS.modules.scala_xml_NodeSeq().Empty__Lscala_xml_NodeSeq()
});
ScalaJS.c.scala_xml_parsing_DefaultMarkupHandler.prototype.procInstr__I__T__T__Lscala_xml_NodeSeq = (function(pos, target, txt) {
  return ScalaJS.modules.scala_xml_NodeSeq().Empty__Lscala_xml_NodeSeq()
});
ScalaJS.c.scala_xml_parsing_DefaultMarkupHandler.prototype.comment__I__T__Lscala_xml_NodeSeq = (function(pos, comment) {
  return ScalaJS.modules.scala_xml_NodeSeq().Empty__Lscala_xml_NodeSeq()
});
ScalaJS.c.scala_xml_parsing_DefaultMarkupHandler.prototype.entityRef__I__T__Lscala_xml_NodeSeq = (function(pos, n) {
  return ScalaJS.modules.scala_xml_NodeSeq().Empty__Lscala_xml_NodeSeq()
});
ScalaJS.c.scala_xml_parsing_DefaultMarkupHandler.prototype.text__I__T__Lscala_xml_NodeSeq = (function(pos, txt) {
  return ScalaJS.modules.scala_xml_NodeSeq().Empty__Lscala_xml_NodeSeq()
});
/** @constructor */
ScalaJS.inheritable.scala_xml_parsing_DefaultMarkupHandler = (function() {
  /*<skip>*/
});
ScalaJS.inheritable.scala_xml_parsing_DefaultMarkupHandler.prototype = ScalaJS.c.scala_xml_parsing_DefaultMarkupHandler.prototype;
ScalaJS.is.scala_xml_parsing_DefaultMarkupHandler = (function(obj) {
  return (!(!((obj && obj.$classData) && obj.$classData.ancestors.scala_xml_parsing_DefaultMarkupHandler)))
});
ScalaJS.as.scala_xml_parsing_DefaultMarkupHandler = (function(obj) {
  if ((ScalaJS.is.scala_xml_parsing_DefaultMarkupHandler(obj) || (obj === null))) {
    return obj
  } else {
    ScalaJS.throwClassCastException(obj, "scala.xml.parsing.DefaultMarkupHandler")
  }
});
ScalaJS.isArrayOf.scala_xml_parsing_DefaultMarkupHandler = (function(obj, depth) {
  return (!(!(((obj && obj.$classData) && (obj.$classData.arrayDepth === depth)) && obj.$classData.arrayBase.ancestors.scala_xml_parsing_DefaultMarkupHandler)))
});
ScalaJS.asArrayOf.scala_xml_parsing_DefaultMarkupHandler = (function(obj, depth) {
  if ((ScalaJS.isArrayOf.scala_xml_parsing_DefaultMarkupHandler(obj, depth) || (obj === null))) {
    return obj
  } else {
    ScalaJS.throwArrayCastException(obj, "Lscala.xml.parsing.DefaultMarkupHandler;", depth)
  }
});
ScalaJS.data.scala_xml_parsing_DefaultMarkupHandler = new ScalaJS.ClassTypeData({
  scala_xml_parsing_DefaultMarkupHandler: 0
}, false, "scala.xml.parsing.DefaultMarkupHandler", ScalaJS.data.scala_xml_parsing_MarkupHandler, {
  scala_xml_parsing_DefaultMarkupHandler: 1,
  scala_xml_parsing_MarkupHandler: 1,
  scala_util_logging_Logged: 1,
  java_lang_Object: 1
});
ScalaJS.c.scala_xml_parsing_DefaultMarkupHandler.prototype.$classData = ScalaJS.data.scala_xml_parsing_DefaultMarkupHandler;
//@ sourceMappingURL=DefaultMarkupHandler.js.map


text:
$(function() {
    $('.relation_select2').select2();
});


text:
/*============================================================================*/
/*
  VFLib: https://github.com/vinniefalco/VFLib

  Copyright (C) 2008 by Vinnie Falco <vinnie.falco@gmail.com>

  This library contains portions of other open source products covered by
  separate licenses. Please see the corresponding source files for specific
  terms.

  VFLib is provided under the terms of The MIT License (MIT):

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  IN THE SOFTWARE.
*/
/*============================================================================*/

#ifndef VF_PATTERNFILL_VFHEADER
#define VF_PATTERNFILL_VFHEADER

/** Specifies the parameters for drawing a pattern fill.

    @ingroup vf_gui
*/
struct PatternFill
{
  Image image;              // [0.01 ... 10]
  double scale;             // [0.1 ... 1.5]
  Point <int> origin;
};

#endif


text:
set(crazyflie_driver_MSG_INCLUDE_DIRS "/home/loic_dubois/Documents/pdm_crazyflie/catkin/src/crazyflie_ros/crazyflie_driver/msg")
set(crazyflie_driver_MSG_DEPENDENCIES std_msgs)


text:
package arez;

import grim.annotations.OmitSymbol;
import grim.annotations.OmitType;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * A utility class that contains reference to singleton context when zones are disabled.
 * This is extracted to a separate class to eliminate the <clinit> from {@link Arez} and thus
 * make it much easier for GWT to optimize out code based on build time compilation parameters.
 */
@OmitType( when = "arez.enable_zones" )
final class ArezContextHolder
{
  @Nullable
  private static ArezContext c_context = Arez.areZonesEnabled() ? null : new ArezContext( null );

  private ArezContextHolder()
  {
  }

  /**
   * Return the ArezContext.
   *
   * @return the ArezContext.
   */
  @Nonnull
  static ArezContext context()
  {
    assert null != c_context;
    return c_context;
  }

  /**
   * cleanup context.
   * This is dangerous as it may leave dangling references and should only be done in tests.
   */
  @OmitSymbol
  static void reset()
  {
    c_context = Arez.areZonesEnabled() ? null : new ArezContext( null );
  }
}


text:
(async function() {
  TestRunner.addResult(`Tests that resources with JSON MIME types are previewed with the JSON viewer.\n`);
  await TestRunner.loadTestModule('network_test_runner');
  await TestRunner.loadLegacyModule('source_frame');
  await TestRunner.showPanel('network');

  function createNetworkRequestWithJSONMIMEType(type) {
    TestRunner.addResult('Creating a NetworkRequest with type: ' + type);
    var request = SDK.NetworkRequest.create(0, 'http://localhost');
    request.mimeType = type;
    request.setContentDataProvider(
        () => Promise.resolve(
            {error: null, content: '{"number": 42}', encoded: false}));
    return request;
  }

  async function testPreviewer(request) {
    var previewView = new Network.RequestPreviewView(request, null);
    previewView.wasShown();
    var previewer = await previewView.contentViewPromise;
    TestRunner.addResult('Its previewer is searchable: ' + (previewer && previewer instanceof UI.SearchableView));
    TestRunner.addResult(
        'Its previewer is the JSON previewer: ' +
        (previewer && previewer.searchProvider && previewer.searchProvider instanceof SourceFrame.JSONView));
  }

  function testType(contentType, callback) {
    var request = createNetworkRequestWithJSONMIMEType(contentType);
    testPreviewer(request).then(callback);
  }
  TestRunner.runTestSuite([
    function test1(next) {
      testType('application/json', next);
    },
    function test2(next) {
      testType('application/vnd.document+json', next);
    },
  ]);
})();


text:
package org.traccar.web.client.view;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Widget;
import com.sencha.gxt.cell.core.client.form.CheckBoxCell;
import com.sencha.gxt.core.client.Style.SelectionMode;
import com.sencha.gxt.core.client.ValueProvider;
import com.sencha.gxt.data.shared.ListStore;
import com.sencha.gxt.data.shared.ModelKeyProvider;
import com.sencha.gxt.data.shared.PropertyAccess;
import com.sencha.gxt.data.shared.Store;
import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
import com.sencha.gxt.widget.core.client.grid.Grid;
import org.traccar.web.client.i18n.Messages;
import org.traccar.web.shared.model.User;

import java.util.*;

public class UserShareDialog {

    private static UsersDialogUiBinder uiBinder = GWT.create(UsersDialogUiBinder.class);

    interface UsersDialogUiBinder extends UiBinder<Widget, UserShareDialog> {
    }

    public class UserShared {
        public final User user;
        public boolean shared;

        public UserShared(final User user, boolean shared) {
            this.user = user;
            this.shared = shared;
        }

        public long getId() {
            return user.getId();
        }

        public String getName() {
            return user.getLogin();
        }

        public boolean isShared() {
            return shared;
        }

        public void setShared(boolean shared) {
            this.shared = shared;
        }
    }

    public interface UserSharedProperties extends PropertyAccess<UserShared> {
        ModelKeyProvider<UserShared> id();

        ValueProvider<UserShared, String> name();

        ValueProvider<UserShared, Boolean> shared();
    }

    public interface UserShareHandler {
        public void onSaveShares(Map<User, Boolean> shares);
    }

    private UserShareHandler shareHandler;

    @UiField
    Window window;

    @UiField(provided = true)
    ColumnModel<UserShared> columnModel;

    @UiField(provided = true)
    ListStore<UserShared> shareStore;

    @UiField
    Grid<UserShared> grid;

    @UiField(provided = true)
    Messages i18n = GWT.create(Messages.class);

    public UserShareDialog(Map<User, Boolean> shares, UserShareHandler shareHandler) {
        this.shareHandler = shareHandler;

        List<User> users = new ArrayList<User>(shares.keySet());
        Collections.sort(users, new Comparator<User>() {
            @Override
            public int compare(User o1, User o2) {
                return o1.getLogin().toLowerCase().compareTo(o2.getLogin().toLowerCase());
            }
        });

        UserSharedProperties userSharedProperties = GWT.create(UserSharedProperties.class);

        shareStore = new ListStore<UserShared>(userSharedProperties.id());

        for (User user : users) {
            shareStore.add(new UserShared(user, shares.get(user)));
        }

        List<ColumnConfig<UserShared, ?>> columnConfigList = new LinkedList<ColumnConfig<UserShared, ?>>();
        columnConfigList.add(new ColumnConfig<UserShared, String>(userSharedProperties.name(), 25, i18n.name()));

        ColumnConfig<UserShared, Boolean> colManager = new ColumnConfig<UserShared, Boolean>(userSharedProperties.shared(), 25, i18n.share());
        colManager.setCell(new CheckBoxCell());
        columnConfigList.add(colManager);

        columnModel = new ColumnModel<UserShared>(columnConfigList);

        uiBinder.createAndBindUi(this);

        grid.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
    }

    public void show() {
        window.show();
    }

    public void hide() {
        window.hide();
    }

    @UiHandler("saveButton")
    public void onSaveClicked(SelectEvent event) {
        Map<User, Boolean> updatedShare = new HashMap<User, Boolean>(shareStore.getModifiedRecords().size());
        for (Store<UserShared>.Record record : shareStore.getModifiedRecords()) {
            UserShared updated = new UserShared(record.getModel().user, record.getModel().shared);
            for (Store.Change<UserShared, ?> change : record.getChanges()) {
                change.modify(updated);
            }
            updatedShare.put(updated.user, updated.shared);
        }
        shareHandler.onSaveShares(updatedShare);
        shareStore.commitChanges();
    }

    @UiHandler("cancelButton")
    public void onCancelClicked(SelectEvent event) {
        window.hide();
    }

}


text:
"use strict";
var util      = require('util')
  , events    = require('events')
  , Test      = require('./test.js')

var Suite = function(options)
{
    if(!(this instanceof Suite)) {
        return new Suite(options)
    }
    events.EventEmitter.call(this)
    this.options = options || {}
    this.tests = []
}

util.inherits(Suite, events.EventEmitter)

Suite.prototype.add = function(name, test, options)
{
    this.tests.push( new Test(name, test, options, this) )
    return this
}

Suite.prototype.run = function(options)
{
    var tl = this.tests.length
    var results = {}
    for(var a=0;a<5;a++) {
        for(var i=0;i<tl;i++) {
            var test = this.tests[i]
            var samples = test.run(options)
            if(!results[test.name]) {
                results[test.name] = samples
            }
            else {
                for(var j=0;j<samples.length;j++) {
                    results[test.name].push(samples[j])
                }
            }
        }
    }
    var stats = {}
    for(var i=0;i<tl;i++) {
        var test = this.tests[i]
        var s = results[test.name]
        stats[test.name] = this.doMathStuff(s)
    }
    console.log(stats)
}

Suite.prototype.doMathStuff = function(samples) {
    var l = samples.length
    var time = 0, runs = 0
    var maxOPS = 0
      , minOPS = Infinity
    for(var i=0; i < l ; i++ ) {
        time += samples[i][0]
        runs += samples[i][1]
        maxOPS = Math.max(samples[i][2], maxOPS)
        minOPS = Math.min(samples[i][2], minOPS)
    }
    return {
        avg: runs/time * 1e9,
        best: maxOPS,
        worst: minOPS
    }
}

module.exports = Suite


text:
from __future__ import absolute_import
import click
from ....cliutils import out

@click.group(help='Chats registered for processing')
def chats():
    pass

@chats.command(help='List all chats')
@click.pass_obj
def list(state):
    out(state, state.client.chats())

@chats.command(help='Show details about a single chat')
@click.argument('id',
                type=int)
@click.pass_obj
def show(state, id):
    out(state, state.client.chats(id))


text:
copyright:
  years: 2016

---

{:new_window: target="_blank"}
{:shortdesc: .shortdesc}
{:codeblock: .codeblock}
{:screen: .screen}
{:pre: .pre}

# Teste adicional
{: #etn_next}
Última atualização: 07 de outubro de 2016
{: .last-updated}

Os testes a seguir foram executados no ambiente do High Security Business Network (a menos que indicado de outra forma) para testar a função de chaincode, livro razão, execuções longas, simultaneidade e
transações complexas.  Os nós validadores e de serviços de associação foram executados como guests de VM (máquina virtual) dentro do contêiner de serviços seguros no LinuxONE OS.  Os valores usados abaixo foram escolhidos com base na entrada do
cliente e não devem ser confundidos com os valores máximos. (Nota: alguns desses testes são repetidos nas seções [Node.js SDK](etn_txn.html) e [Testando consenso
e disponibilidade](etn_pbft.html).)

{:shortdesc}

1. Função de chaincode - interfaces de chaincode foram exercitadas para assegurar que as transações `Implementar`, `Chamar` e `Consultar`
funcionam adequadamente usando a API REST e a CLI. A API REST e a CLI foram utilizadas para testar todas as funções de terminal, incluindo Bloco, Blockchain, Chaincode, Rede, Escrivão e
Transações, conforme descrito na Especificação de Protocolo do Hyperledger.
2. Livro Razão - a criação de 20.000 registros de 1 K de cargas úteis no livro razão baseada em diferentes ambientes de direcionamento. Os testes incluíram um
cliente criando 20 mil registros de uma maneira serializada.
3. Execuções longas - esse teste foi feito enviando chamadas, altura de cadeia e consultas ao longo de múltiplos nós por 72 horas usando o chaincode de demo example02.
4. Node.js SDK - o Node.js SDK aprimorado foi usado para registrar e inscrever usuários e executar implementação, chamadas e consulta em um peer no modo de desenvolvimento (peer de início com:
`peer node start –peer -chaincodedev`) e no modo de rede (peer inicial com: `peer node start`).
5. Simultaneidade básica - esse teste foi feito enviando chamadas simultâneas para cada um dos quatro peers por uma duração de 10 minutos, com 1 KB de cargas úteis, medindo a altura de cadeia e
consultando o estado do livro razão.
6. Transações complexas - esse teste foi feito enviando aleatoriamente uma combinação de consultas e chamadas de vários tamanhos de carga útil, variando de 10
mil a 500 mil, para peers por uma duração de 10 minutos. A altura de cadeia e a consulta de estado do mundo foram medidas para assegurar a sincronização do livro
razão compartilhado ao longo de peers de rede.


text:
#include "globus_net_manager.h"

/**
 * @brief Unregister a network manager
 * @ingroup globus_net_manager
 * @details
 * The globus_net_manager_unregister() function removes this network manager
 * from those which will be called by the network manager interface
 * when network events occur. This is typically called by the network
 * manager when its module is deactivated.
 * @param[in] manager
 *     Manager information to unregister.
 *
 */
globus_result_t
globus_net_manager_unregister(
    globus_net_manager_t               *manager)
{
    globus_extension_registry_remove(
        GLOBUS_NET_MANAGER_REGISTRY, (void *) manager->name);

    return GLOBUS_SUCCESS;
}